ai-techsystems / deepC

vendor independent TinyML deep learning library, compiler and inference framework microcomputers and micro-controllers
https://cainvas.ai-tech.systems/
Apache License 2.0
552 stars 86 forks source link

ModuleNotFoundError: No module named '_dnnc' #135

Open mohaimenz opened 3 years ago

mohaimenz commented 3 years ago

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'
srohit0 commented 3 years ago

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>/

mohaimenz commented 3 years ago

@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?

srohit0 commented 3 years ago

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.

AnanyaPadmadharan commented 3 years ago

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.

srohit0 commented 3 years ago

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.

AnanyaPadmadharan commented 3 years ago

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'

srohit0 commented 3 years ago

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

AnanyaPadmadharan commented 3 years ago

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 .

srohit0 commented 3 years ago

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