Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

python - Import error: DLL load failed in Jupyter notebook but working in .py file

I installed BreakoutDetection the module in Anaconda environment. When I tried to import the module using import breakout_detection in jupyter notebook, I get the below error

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-18-96c0fdb15b96> in <module>()
----> 1 import breakout_detection

C:UserssgadiyarAppDataLocalContinuumAnaconda2libsite-packagesreakout_detection.py in <module>()
     15         except ImportError:
     16             return importlib.import_module('_breakout_detection')
---> 17     _breakout_detection = swig_import_helper()
     18     del swig_import_helper
     19 elif _swig_python_version_info >= (2, 6, 0):

C:UserssgadiyarAppDataLocalContinuumAnaconda2libsite-packagesreakout_detection.py in swig_import_helper()
     14             return importlib.import_module(mname)
     15         except ImportError:
---> 16             return importlib.import_module('_breakout_detection')
     17     _breakout_detection = swig_import_helper()
     18     del swig_import_helper

C:UserssgadiyarAppDataLocalContinuumAnaconda2libimportlib\__init__.pyc in import_module(name, package)
     35             level += 1
     36         name = _resolve_name(name[level:], package, level)
---> 37     __import__(name)
     38     return sys.modules[name]

ImportError: DLL load failed: The specified procedure could not be found.

I could import the same module in python shell

I looked at the system paths (print sys.path) and in both python shell and jupyter notebook. They both are the same. Executable path (print sys.executable) is also the same for the both.

Can someone help me out on the steps I should take to resolve this issue? Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I encountered the same problem running Jupyter Notebook from PowerShell. Even though the question was asked a year back, I am answering it here to help those who encounter the same error recently. In my case, first, I activated the root environment activate base then I ran jupyter notebook and it worked just fine. Once you activate the base, you will notice that the prompt will change like this: (base) X:Usersxxxxxcurrent-directory-name>.

  • Note that the command activate base will not work on Powershell. You have to switch to command prompt running cmd or you may try the whole thing on the command prompt instead of PowerShell.

  • If the required paths
    (path:oAnaconda3;path:oAnaconda3Scripts;path:oAnaconda3Librarymingw-w64in;path:oAnaconda3Libraryusrin;path:oAnaconda3Libraryin) are available to your PowerShell environment, then you don't need to activate the "base" environment.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...