notebook: Kernel error in jupyter notebook

    km.start_kernel(**kwargs)
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\manager.py", line 240, in start_kernel
    self.write_connection_file()
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
    kernel_name=self.kernel_name
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
    with secure_write(fname) as f:
  File "C:\Users\Khushboo.Girotra\anaconda3\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 100, in secure_write
    win32_restrict_file_to_user(fname)
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 53, in win32_restrict_file_to_user
    import win32api
ImportError: DLL load failed: The specified procedure could not be found.``` 

I have re-install the anaconda as well . but still It is showing the same kernel error.
 Kernel json file shows :
{
 "argv": [
  "C:\\Users\\Khushboo.Girotra\\python.exe",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
} 

I have tried lot of solution which are already there but nothing works out . Kindly help

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 93 (18 by maintainers)

Most upvoted comments

Hello,

I got through the same error today (this is really annoying, especially because it also breaks vscode interactive window and all my kernels).

After checking, pywin32 had a release 15 days ago for the first time in one year. Downgrading in my environment make jupyter work again (but it is obviously not a fix) : pip install --upgrade pywin32==224

Note that creating a new environment from scratch does not fix your problem : pip install jupyter reinstall pywin32==225 which is buggued and seems not to work on windows in its current state.

Try conda install pywin32 if you are using conda.

I’m referring to the setup.py that’s in the repository: https://github.com/jupyter/jupyter_client/blob/5.3.3/setup.py This file isn’t laid down during installation but it’s what is used during jupyter_client’s installation.

You might try pip install --upgrade jupyter_client. You should have pywin32 installed.

pip install --upgrade pywin32==224

This solved my problem.

pip install --upgrade pywin32==224 thank you very much,it work

I have installed anaconda , under that jupyter notebook also get installed . I have 5.3.3 version and pywin32 is installed . Still there is kernel error.

Closing issue based on recent successes.

Using the latest versions of jupyter_client (>=5.3.4) and jupyter_core (>=4.6.1) should be attempted prior to opening a new issue. Thank you.

I was facing the same issue with jupyter-client==5.3.4, jupyter_core==4.6.1, and pywin32==227. Running pip install --upgrade pywin32==224 --force-reinstall then fixed the issue for me.

My system is Windows 64 bit. This solved for me.

conda install -c conda-forge pywin32 conda install -c anaconda jupyter_client conda install -c conda-forge jupyter_core

I encountered this problem too but I wasn’t using Anaconda. Turns out there’s another step (it’s in the pywin32 README):

Note that if you want to use pywin32 for “system wide” features, such as registering COM objects or implementing Windows Services, then you must run the following command from an elevated command prompt: python Scripts/pywin32_postinstall.py -install

Hope this helps someone!

My system is Windows 64 bit. This solved for me.

conda install -c conda-forge pywin32 conda install -c anaconda jupyter_client conda install -c conda-forge jupyter_core

Thank you so much!! this worked me!

My system is Windows 64 bit. This solved for me.

conda install -c conda-forge pywin32 conda install -c anaconda jupyter_client conda install -c conda-forge jupyter_core

OMG bro you save me! Thanks!

Thanks for the update. You’ll need to figure out why import win32api is not working. There are a number of SO hits on this issue, some of which state that pip install pypiwin32 resolved the issue. I don’t have access to a windows machine, so can’t really help much more than this - sorry.

Runnig the postinstall from an elevated command prompt worked for me:

python Scripts/pywin32_postinstall.py -install

Please try relative to pywin32. Since this is a conda env - you might be better off with conda install pywin32.

@minrk updated the dependencies in conda-forge earlier today. These instructions might help get you going: https://github.com/conda-forge/jupyter_client-feedstock#installing-jupyter_client

Thanks big time Galileo-Galilei, downgrading pywin32 to 224 fixed the issue for me too. For my virtualenv, that is: pipenv run pip install --upgrade pywin32==224 And ye, pywin32==225 was released 15 Sep, pretty much the time I updated a load of modules + when Jupyter broke, so it all makes sense now.

Hello,

I got through the same error today (this is really annoying, especially because it also breaks vscode interactive window and all my kernels).

After checking, pywin32 had a release 15 days ago for the first time in one year. Downgrading in my environment make jupyter work again (but it is obviously not a fix) : pip install --upgrade pywin32==224

Note that creating a new environment from scratch does not fix your problem : pip install jupyter reinstall pywin32==225 which is buggued and seems not to work on windows in its current state.

Same issue, fixed downgrading to pywin32==224. Thanks a lot!

@kevin-bates

If codes are not visible then you can use your desktop or laptop for better visualization. Here is commands that are used in the video…!! step 2 command :- “conda activate (location of your env folder)” step 3 command: - “python -m ipykernel install --user”

Hello,

I got through the same error today (this is really annoying, especially because it also breaks vscode interactive window and all my kernels).

After checking, pywin32 had a release 15 days ago for the first time in one year. Downgrading in my environment make jupyter work again (but it is obviously not a fix) : pip install --upgrade pywin32==224

Note that creating a new environment from scratch does not fix your problem : pip install jupyter reinstall pywin32==225 which is buggued and seems not to work on windows in its current state.

Thank you, solved to me too. my actual pywin32 ver is 227, downgrading solved the problem.

Regards

Traceback (most recent call last): File “C:\Users\Toyosi\Anaconda3\lib\site-packages\tornado\web.py”, line 1699, in _execute result = await result File “C:\Users\Toyosi\Anaconda3\lib\site-packages\tornado\gen.py”, line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File “C:\Users\Toyosi\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py”, line 72, in post type=mtype)) File “C:\Users\Toyosi\Anaconda3\lib\site-packages\tornado\gen.py”, line 735, in run value = future.result() File “C:\Users\Toyosi\Anaconda3\lib\site-packages\tornado\gen.py”, line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File “C:\Users\Toyosi\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py”, line 88, in create_session kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name) File “C:\Users\Toyosi\Anaconda3\lib\site-packages\tornado\gen.py”, line 735, in run value = future.result() File “C:\Users\Toyosi\Anaconda3\lib\site-packages\tornado\gen.py”, line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File “C:\Users\Toyosi\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py”, line 101, in start_kernel_for_session self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name) File “C:\Users\Toyosi\Anaconda3\lib\site-packages\tornado\gen.py”, line 735, in run value = future.result() File “C:\Users\Toyosi\Anaconda3\lib\site-packages\tornado\gen.py”, line 209, in wrapper yielded = next(result) File “C:\Users\Toyosi\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py”, line 168, in start_kernel super(MappingKernelManager, self).start_kernel(**kwargs) File “C:\Users\Toyosi\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py”, line 110, in start_kernel km.start_kernel(**kwargs) File “C:\Users\Toyosi\Anaconda3\lib\site-packages\jupyter_client\manager.py”, line 240, in start_kernel self.write_connection_file() File “C:\Users\Toyosi\Anaconda3\lib\site-packages\jupyter_client\connect.py”, line 547, in write_connection_file kernel_name=self.kernel_name File “C:\Users\Toyosi\Anaconda3\lib\site-packages\jupyter_client\connect.py”, line 212, in write_connection_file with secure_write(fname) as f: File “C:\Users\Toyosi\Anaconda3\lib\contextlib.py”, line 112, in enter return next(self.gen) File “C:\Users\Toyosi\Anaconda3\lib\site-packages\jupyter_client\connect.py”, line 102, in secure_write with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f: PermissionError: [Errno 13] Permission denied: ‘C:\Users\Toyosi\AppData\Roaming\jupyter\runtime\kernel-a98340e4-22b5-4437-b93a-d01839ee180e.json’

I’m new to anaconda and this is what my kernel error says could someone help me fix it i’ve tried all the solutions, uninstalled and installed, but none worked.

Closing issue based on recent successes.

Using the latest versions of jupyter_client (>=5.3.4) and jupyter_core (>=4.6.1) should be attempted prior to opening a new issue. Thank you.

Had same issue and upgrading jupyter_client worked.

pip3 install --upgrade jupyter_client

Thanks a lot @Galileo-Galilei! This solved the issue for me too. As for the others, please note that if you have several conda virtual environments and you use them as a kernel in jupyter notebook. The process he mentioned needs to be repeated for each of them after activating them! So happy I got this working after 2 useless days