deepC icon indicating copy to clipboard operation
deepC copied to clipboard

ModuleNotFoundError: No module named '_dnnc'

Open mohaimenz opened this issue 4 years ago • 9 comments

Hi, After installing deepC, I am trying to test if it is working. I see the following error. Any suggestion regarding this error? Environment: Mac OS

(base) MU00158281X:~ mmoh0027$ python -c "import deepC.dnnc as dc; print(dc.arange(5));"
Traceback (most recent call last):
  File "/Users/mmoh0027/opt/anaconda3/lib/python3.7/site-packages/deepC/dnnc.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/Users/mmoh0027/opt/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: dlopen(/Users/mmoh0027/opt/anaconda3/lib/python3.7/site-packages/deepC/_dnnc.so, 2): no suitable image found.  Did find:
	/Users/mmoh0027/opt/anaconda3/lib/python3.7/site-packages/deepC/_dnnc.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
	/Users/mmoh0027/opt/anaconda3/lib/python3.7/site-packages/deepC/_dnnc.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/mmoh0027/opt/anaconda3/lib/python3.7/site-packages/deepC/dnnc.py", line 17, in <module>
    _dnnc = swig_import_helper()
  File "/Users/mmoh0027/opt/anaconda3/lib/python3.7/site-packages/deepC/dnnc.py", line 16, in swig_import_helper
    return importlib.import_module('_dnnc')
  File "/Users/mmoh0027/opt/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_dnnc'

mohaimenz avatar Oct 24 '20 12:10 mohaimenz

It should not occur, if you used

python3 setup.py install

Workaround 1: run sudo python3 setup.py install

Workaround 1: set environmental variable PYTHONPATH, e.g. export PYTHONPATH=<deepC-root-dir>/

srohit0 avatar Oct 24 '20 14:10 srohit0

@srohit0 Hi Rohit, Thanks for your suggestion. I have used pip install deepC that all your tutorials and videos suggested. It always said 'deepC.dnnc is not found'. I manually checked the installation and it was not there. Then cloned the git repo and I used all your suggested options but no luck, same error. I have also tried the suggested way provided at the top of the setup.py file how to run this script: python setup.py bdist_wheel how to test install: python -m pip install ~/dnnc/master/deepC/dist/dnnc-0.1-py3-none-any.whl --root pip_install_test

So, I haven't been able to use deepC anyway. Am I missing something?

mohaimenz avatar Oct 25 '20 10:10 mohaimenz

Few developers have used MAC in the past successfully.

You can use cainvas.ai-tech.systems to avoid installation.

We'd be glad to help out, if you're open.

srohit0 avatar Oct 25 '20 23:10 srohit0

Hi, I have developed a tensorflow model and convertred it to onnx. Now I need to port it to micro controller. I need to convert it to c. I am using windows 10. I tried these codes and I am also getting the "ModuleNotFoundError: No module named '_dnnc'. Can you please help me.

AnanyaPadmadharan avatar May 25 '21 13:05 AnanyaPadmadharan

Sure, we'd be happy to help if you can share your screen to resolve the issue.

Alternatively, you can use cainvas.ai-tech.systems to avoid installation and the issue altogether.

srohit0 avatar May 28 '21 14:05 srohit0

C:\Users\Anaconda3\Lib\site-packages\deepC\scripts>python -m onnx2cpp tf_to_onnx_model.onnx Traceback (most recent call last): File "C:\Users\Anaconda3\lib\site-packages\deepC\dnnc.py", line 14, in swig_import_helper return importlib.import_module(mname) File "C:\Users\Anaconda3\lib\importlib_init_.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'deepC._dnnc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Anaconda3\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\40010033\Anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Anaconda3\Lib\site-packages\deepC\scripts\onnx2cpp.py", line 31, in import deepC.dnnc as dnnc File "C:\Users\Anaconda3\lib\site-packages\deepC\dnnc.py", line 17, in _dnnc = swig_import_helper() File "C:\Users\Anaconda3\lib\site-packages\deepC\dnnc.py", line 16, in swig_import_helper return importlib.import_module('dnnc') File "C:\Users\Anaconda3\lib\importlib_init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_dnnc'

AnanyaPadmadharan avatar May 31 '21 13:05 AnanyaPadmadharan

Thanks. Please reach out to hi @ ai-techayatems .c0m for further installation support.

srohit0 avatar May 31 '21 15:05 srohit0

Can you please describe the steps to be followed to convert an onnx model( converted from tensorflow) to c which can be deployed on microcontroller (windows environment)

On Mon, May 31, 2021, 8:32 PM Rohit Sharma @.***> wrote:

Thanks. Please reach out to hi @ ai-techayatems .c0m for further installation support.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ai-techsystems/deepC/issues/135#issuecomment-851546118, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKZDRPDJX4PSKCGC27XXGZLTQOQHXANCNFSM4S5RYRMA .

AnanyaPadmadharan avatar Jun 01 '21 05:06 AnanyaPadmadharan

You're one of the few reporting this. Unless we see the issue in action, there are no steps we can recommend.

srohit0 avatar Jun 03 '21 05:06 srohit0