Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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:\Users\xxxxx\current-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:\to\Anaconda3\;path:\to\Anaconda3\Scripts;path:\to\Anaconda3\Library\mingw-w64\bin;path:\to\Anaconda3\Library\usr\bin;path:\to\Anaconda3\Library\bin) are available to your PowerShell environment, then you don't need to activate the "base" environment.

Solution 2:

In windows, active root(base) in command prompt first by

activate root

then

jupyter notebook

Solution 3:

I recently re-installed Anaconda to a new directory (from D: to C:). After that, opening and running PowerShell (in Windows 10) caused it to throw the same errors.

By following @picklu 's answer I was able to run it temporarily from the CMD (by running 'activate base' and then 'jupyter notebook'). Even 'activate root' worked instead of activate base. Also running it from conda prompt, anaconda navigator and the default shortcut for Jupyter Notebook worked. However, using these methods I wasn't able to start from the folder I had opened the PowerShell window in (by using Ctrl+Shift+ mouseRightCLick).

However, by following the second part of @picklu 's answer I was able to successfully change the system variable PATH from the old D: drive to the current C: .

I added the following:

  1. c:\users\USERNAME\anaconda3
  2. c:\users\USERNAME\anaconda3\scripts
  3. c:\users\USERNAME\anaconda3\library\bin
  4. c:\users\USERNAME\anaconda3\library\usr\bin

where c:\users\USERNAME\anaconda3 is the anaconda install location.

Solution 4:

If you have already added anaconda to PATH variable then you have to do the following

activate base jupyter kernelspec list python -m ipykernel install --user

It worked for me

Solution 5:

I had the same problem when I import sklearn. I guess some packages needed to be upgraded. So I just ran (conda update --all) to upgrade all the packages, and it finally worked.

Post a Comment for "Import Error: Dll Load Failed In Jupyter Notebook But Working In .py File"