Notebook: ImportError: cannot import name 'secure_write'

Created on 29 Oct 2019  路  15Comments  路  Source: jupyter/notebook

Last time(a day ago) I lauched the notebook and close it, it was running fine. Then I double clicked to open the jupyer-notebook.exe, a jupyter console window showed up and disappeared in 3 seconds and without openning the localhost:8888 page, nor could I manually open the localhost address. I used jupyter notebook command in the cmd window, it shows the following respond:

Traceback (most recent call last):
File "d:\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "d:\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Python36\Scripts\jupyter-notebook.EXE__main__.py", line 4, in
File "d:\python36\lib\site-packages\notebook\notebookapp.py", line 81, in
from .services.kernels.kernelmanager import MappingKernelManager
File "d:\python36\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 19, in
from jupyter_client.session import Session
File "d:\python36\lib\site-packages\jupyter_client__init__.py", line 4, in
from .connect import *
File "d:\python36\lib\site-packages\jupyter_client\connect.py", line 35, in
from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write
ImportError: cannot import name 'secure_write'

I tried reinstalling jupyter notebook using pip uninstall jupyter and pip install jupyter,but there is no use. The command jupyter notebook --help gives the same response as above.

I tried to search for similar issues online but failed finding any. If anyone knows the solution, please help. Thank you in advance!

Most helpful comment

@GabriellaKwan Try this
pip install --upgrade jupyter_client

All 15 comments

@GabriellaKwan Try this
pip install --upgrade jupyter_client

Awesome. work perfectly.

Thanks saved my frustration

Hi @SangamSwadiK , help me please

Traceback (most recent call last):
File "c:\users\nb-zenta\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\nb-zenta\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\NB-ZENTA\Anaconda3\Scripts\jupyter-notebook.EXE__main__.py", line 5, in
File "c:\users\nb-zenta\anaconda3\lib\site-packages\notebook\notebookapp.py", line 78, in
from .services.kernels.kernelmanager import MappingKernelManager
File "c:\users\nb-zenta\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 19, in
from jupyter_client.session import Session
File "c:\users\nb-zenta\anaconda3\lib\site-packages\jupyter_client__init__.py", line 4, in
from .connect import *
File "c:\users\nb-zenta\anaconda3\lib\site-packages\jupyter_client\connect.py", line 35, in
from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write
ImportError: cannot import name 'secure_write' from 'jupyter_core.paths' (c:\users\nb-zenta\anaconda3\lib\site-packages\jupyter_core\paths.py)

@oscaralarcon I also just received this error. The solution above did not work for me. However, running Git Bash as administrator did for me.

Perhaps try this?

@oscaralarcon Try the last one in this ,(he replaces the _paths.py_ file )
https://community.deepcognition.ai/t/importerror-cannot-import-name-secure-write/1134

@phoenixedward , @SangamSwadiK
it was solved, thanks very much, bless

@GabriellaKwan Try this
pip install --upgrade jupyter_client

Thanks for help , it worked

Right on - glad folks are succeeding with the helpful tips! I'm going to close this due to the success.

Generally speaking, ensure that jupyter_client >= 5.3.4 and jupyter_core >= 4.6.1 for issues surrounding secure_write().

thanks it works with me

Awesome! thanks that work fine for me too!

Thanks for suggestion, it worked

it is working

thanks

Many thanks !!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ehossain1982 picture ehossain1982  路  3Comments

arbaazsama picture arbaazsama  路  3Comments

pylang picture pylang  路  3Comments

cancan101 picture cancan101  路  3Comments

toasteez picture toasteez  路  3Comments