Jupyter Notebook not Working in Pycharm

Hello,

I'm trying to run Jupyter Notebooks on PyCharm Professional 2020.2.

When I open a ipynb file, PyCharm starts a managed Server with the following configuration:

But in the Toolbar the drop down menu only has "Python 3" as an interpreter to choose from, and not the project default. When I execute a code cell I get the following warning:

When I click on "Register project interpreter as kernel, I get the following error pop up and traceback:

```

Traceback (most recent call last):
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
import zmq
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\kutsch\Miniconda3\envs\TFinPractice\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

Process finished with exit code 1

```

The German text next to the ImportError says that the Module was not found. Even so, the Jupyter toolbar interpreter drop down menu now shows the project default interpreter, but when I try to execute a cell I get the following warning text:

 

 

 

8 comments
Comment actions Permalink

PS: If I access the Jupyter Server that I started in PyCharm in the browser, then everything works fine.

0
Comment actions Permalink

There should be a message "Register project kernel", have you tried clicking "Register"? 

0
Comment actions Permalink

Andrey Resler do you mean "Register project interpreter as kernel" like in the second image?

0
Comment actions Permalink

Hmm, seems like the issue has been reported previously: https://youtrack.jetbrains.com/issue/PY-39047

Please try to delete and recreate the project interpreter from scratch, reinstall Jupyter, and try again.

0
Comment actions Permalink

I got the exact problem with Pycharm 2021.1.2, Build #PY-211.7442.45.

1
Comment actions Permalink

I am facing the same issue in PyCharm 2021.2 Build #PY-212.4535.11

0
Comment actions Permalink

Hello @Pallavlearn and Giang Le

 

Could you please run:

jupyter notebook

 

 in the terminal (out PyCharm)? Will you get the same error? Please see the https://github.com/jupyter/notebook/issues/4909

 

 

0
Comment actions Permalink

Hello I have exactly the same problem.
When typing jupyter notebook in the terminal inside Pycharm I get the error:

ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (C:\Users\sam24\.conda\envs\pytorch_ml\lib\site-packages\zmq\backend\cython\__init__.py)

To run jupyter notebook in the terminal I have to first activate the conda environment.

0

Please sign in to leave a comment.