Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter notebook does not launch (ImportError: DLL load failed while importing)

Recently my jupyter notebook stopped launching. When I try the command jupyter notebook from anaconda prompt but it gives error

Traceback (most recent call last): File "C:\Users\Dell\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in from notebook.notebookapp import main
File "C:\Users\Dell\anaconda3\lib\site-packages\notebook\notebookapp.py", line 51, in from zmq.eventloop import ioloop
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq_init_.py", line 50, in from zmq import backend
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\backend_init_.py", line 40, in reraise(*exc_info)
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise raise value
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\backend_init_.py", line 27, in ns = select_backend(first)
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend mod = import(name, fromlist=public_api)
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\backend\cython_init
.py", line 6, in from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.

I even tried reinstalling anaconda and upgraded to python 3.8.3 on windows 10 but still get the same error. When I tried to check jupyter notebook's version it said that ipykernel and some other things were not installed. jupyter --version gives me this:

jupyter core : 4.6.3
jupyter-notebook : 6.1.1
qtconsole : 4.7.6
ipython : 7.18.1
ipykernel : not installed
jupyter client : not installed
jupyter lab : not installed
nbconvert : 5.6.1

But installing ipykernel with conda install ipykernel says

All requested packages already installed.

I also tried ipython kernel install --name <env_name> --user but this gives another dll error.

Reading some other problems in stackoverflow I went and checked my enviroment variables.

System Variables

User Variables

Is there a problem with this environment variable. Please help.

Screenshot of the anaconda prompt with error. Screenshot of the anaconda prompt

Edit: The anaconda navigator does not launch either. anaconda-navigator on the anaconda prompt gives another error: Anaconda navigator error

I also tried:

conda install qt --force
conda install pyqt --force

But that did'nt help. Does previously installed anaconda cause such error?

like image 695
Anav Katwal Avatar asked Sep 20 '20 12:09

Anav Katwal


2 Answers

Just for other people having similar issue.

In my case, when I run jupyter notebook on command line, I got the same error as @Anav Katwal . However if I run jupyter notebook on Anaconda Prompt, then the error is gone.

If you truly want to execute jupyter notebook on cmd, then you could add the following paths to your system environment variable:

  • C:\Users\USERNAME\anaconda3\Library\bin
  • C:\Users\USERNAME\anaconda3\Scripts
  • C:\Users\USERNAME\anaconda3\condabin
like image 182
johnnyasd12 Avatar answered Nov 14 '22 21:11

johnnyasd12


I found what I did wrong (silly me). Microsoft visual C++ 2015-2019 was somehow removed when I tried to install openCV manually. Didn't think that such an install would make such big impact, have to keep that in mind now but installing the latest solved all the problems.

P.S.: This solution might not work for someone else with similar problem. But its worth taking a note.

like image 29
Anav Katwal Avatar answered Nov 14 '22 23:11

Anav Katwal