7

While opening Jupyter notebook or Spyder, I am continuously getting 'kernel error' notification.

Tried to reinstall anaconda3, ipython, kernel but the issue stays. I had downloaded Python 3.7 in Windows 10 system.

I am getting the below error in log.

"> Traceback (most recent call last): File "> "C:\Users\AppData\Local\Continuum\anaconda3\lib\site‑packages\spyder\plugins\ipytho"nconsole.py",

line 1572, in create_kernel_manager_and_kernel_client kernel_manager.start_kernel(stderr=stderr_handle) File "C:\Users\AppData\Roaming\Python\Python37\site‑packages\jupyter_client\manager.py", line 240, in start_kernel self.write_connection_file() File "C:\Users\AppData\Roaming\Python\Python37\site‑packages\jupyter_client\connect.py", line 476, in write_connection_file kernel_name=self.kernel_name File "C:\Users\AppData\Roaming\Python\Python37\site‑packages\jupyter_client\connect.py", line 141, in write_connection_file with secure_write(fname) as f: File "C:\Users\AppData\Local\Continuum\anaconda3\lib\contextlib.py", line 112, in enter return next(self.gen) File "C:\Users\AppData\Roaming\Python\Python37\site‑packages\jupyter_core\paths.py", line 404, in secure_write win32_restrict_file_to_user(fname) File "C:\Users\AppData\Roaming\Python\Python37\site‑packages\jupyter_core\paths.py", line 359, in win32_restrict_file_to_user import win32api ImportError: DLL load failed: The specified procedure could not be found.

Santanu Basu
  • 71
  • 1
  • 1
  • 5
  • `win32_restrict_file_to_user import win32api ImportError: DLL load failed: The specified procedure could not be found.` --> seems your problem is Windows. Also try to run it as admin – Leos313 Oct 11 '19 at 13:04
  • 5
    Thanks Leos313. The problem has been resolved by downgrading the pywin32.Required to run this- pip install --upgrade pywin32==224 – Santanu Basu Oct 11 '19 at 14:11

9 Answers9

6

Its basically system compatible issues with python/Jupiter.

Please locate the file pywin32_postinstall.py in your python installed path

Example

C:\Users\AppData\Local\Programs\Python\Python38-32\Scripts>

And navigate to the path and run the file/command pywin32_postinstall.py -install

3

pip install pywin32 -U

Should do the trick

Ohad Zadok
  • 3,452
  • 1
  • 22
  • 26
1

After longer looking here and there I found this question but none of answers helped me, after all I have noticed the correct solution in comments, so I add it here as answer for future readers that might not check the comments at first like me.

Downgrading pywin32 to version 224 is the way:

pip install --upgrade pywin32==224 
Ruli
  • 2,592
  • 12
  • 30
  • 40
1

I had this issue for several days. I was using Jupyter notebook. Installation was Anaconda and Python version was 3.8.

I did the following to finally get it fixed:

1.I copied the 2 win32 dlls from C:\Users\YourUser\anaconda3\pkgs\pywin32-227-py38he774522_1\Lib\site-packages\pywin32_system32 <path where anaconda is installed

to c:\windows\system32 per advice in this thread (not sure if this was necessary, as this didn't immediately fix the problem. The next 2 steps are what fixed it for me.

2.per this https://github.com/jupyter/notebook/issues/4980#issuecomment-663885620 (he says pip uninstall pywin32 and conda install it.)

I ran a terminal cmd prompt from anaconda navigator (have to be running as admin) to pip uninstall pywin32

I had to look up how to run pip install and uninstall from anaconda installation. Googled how to use pip with anaconda and the following instructions came up which worked great.

  • Open Anaconda. Select Environments in the left hand pane below home. Just to the right of where you selected and below the "search environments" bar, you should see base(root). Click on it. A triangle pointing right should appear, click on it an select "open terminal" Use the regular pip install command here.

3.ran conda install from anaconda prompt as admin per this website, https://anaconda.org/anaconda/pywin32 :
conda install -c anaconda pywin32

Finally Jupyter Kernel stopped crashing.

0

Copying the win32api file from the ..//site-packages/win32 folder to the ..//site-packages//jupyter_core folder finally did the trick for me.

0

Follow this to resolve the issue when a kernel is dead.

pip install --upgrade pywin32==224 (downgrade the pywin32 from 225 to 224) or pip install --upgrade pywin32==224 --user

If the above still not work and one prompt appears that pythoncom37.dll should not be the path 'C:\Windows\System32' then remove the 'pythoncom37.dll' from 'C:\Windows\System32'.

Palash Mondal
  • 468
  • 4
  • 10
0

I started all over:

  • I uninstalled notebook.

  • I uninstalled python 3.7.9.

  • I then reinstalled python 3.8.4 and.

  • reinstalled notebook.

Problem solved!

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
  • 1
    `pip install --upgrade jupyter_client` via https://github.com/jupyter/notebook/issues/5014#issuecomment-547762322 – Max Reeder Dec 16 '21 at 18:05
0

If you are working in a miniconda on conda environment. You could just install pywin32 using conda instead of pip.

This solved my problem

conda install pywin32

siaka karl
  • 161
  • 2
  • 10
0

Try creating a new environment with python 3.9 or 3.10. This is an environment related issue.

Parth chokhra
  • 91
  • 1
  • 6