Skip to content
Advertisement

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-packagesbreakout_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-packagesbreakout_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!

Advertisement

Answer

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:toAnaconda3;path:toAnaconda3Scripts;path:toAnaconda3Librarymingw-w64bin;path:toAnaconda3Libraryusrbin;path:toAnaconda3Librarybin) are available to your PowerShell environment, then you don’t need to activate the “base” environment.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement