31

I update the Jupyter notebook from the old version to latest 5.3.1. However, when I try to launch the notebook from anaconda, it throws an import error: I tried to remove and install Jupyter package, still, the issue persists.

Traceback (most recent call last):
File "C:\Users\v-kangsa\AppData\Local\Continuum\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in 
from notebook.notebookapp import main
File "C:\Users\v-kangsa\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\__init__.py", line 25, in 
from .nbextensions import install_nbextension
File "C:\Users\v-kangsa\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\nbextensions.py", line 27, in 
from jupyter_core.utils import ensure_dir_exists
ImportError: cannot import name 'ensure_dir_exists'
aL_eX
  • 1,453
  • 2
  • 15
  • 30
Santosh Kangane
  • 377
  • 1
  • 3
  • 12

6 Answers6

61

You need to update jupyter_core and jupyter_client manually from your terminal:

conda update jupyter_core jupyter_client
piratefache
  • 1,308
  • 11
  • 17
25

If you've installed jupyter using pip3.

pip3 install --upgrade jupyter_core jupyter_client
pavan
  • 3,225
  • 3
  • 25
  • 29
  • 1
    I get "Cannot uninstall 'jupyter-core'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall." – liyuan Dec 20 '18 at 02:21
9

update jupyter core

pip install jupyter-core --upgrade

this working for me in Anaconda3 with python 3.6

Cristian Q
  • 617
  • 5
  • 9
3

I've met the same problem when I use ipython notebook .

After I tried upgrade jupyter, then I tried reinstall the ipython. The import error seem fixed.

pip3 uninstall ipython

pip3 install ipython

Community
  • 1
  • 1
Wu Wenter
  • 171
  • 5
2

When I tried to install R the notebook was upgraded to 5.3.1 and same problem appeared, however the highest vote answer apparently didn't work for me.

What I did was:

conda uninstall jupyter notebook

then:

conda install jupyter notebook

and the problem solved with the old version.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
0

I had a similar issue on Ubuntu after installing RStudio on my system. To solve it, first I tried @MichaelCara suggestion to update jupyter. However, after that I got the following new message error:

ImportError: libsodium.so.23: cannot open shared object file: No such file or directory

which I solved installing libsodium as explained here.

In short:

conda update jupyter_core jupyter_client jupyter_console
conda install libsodium

tbnsilveira
  • 468
  • 3
  • 8