Reputation: 1251
I am using Python 3.9.9 via pyenv
on a Mac with an Intel chip. I installed Jupyter using pip install juypter
. When I run which jupyter
I get the response /Users/<username>/.pyenv/shims/jupyter
, so Jupyter has installed. However, when I run jupyter notebook
I get the following error:
Traceback (most recent call last):
File "/Users/<username>/.pyenv/versions/3.9.9/bin/jupyter-notebook", line 8, in <module>
sys.exit(main())
File "/Users/<username>/.pyenv/versions/3.9.9/lib/python3.9/site-packages/jupyter_core/application.py", line 264, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/Users/<username>/.pyenv/versions/3.9.9/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
app.initialize(argv)
File "/Users/<username>/.pyenv/versions/3.9.9/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/Users/<username>/.pyenv/versions/3.9.9/lib/python3.9/site-packages/notebook/notebookapp.py", line 2141, in initialize
self._init_asyncio_patch()
File "/Users/<username>/.pyenv/versions/3.9.9/lib/python3.9/site-packages/notebook/notebookapp.py", line 2117, in _init_asyncio_patch
nest_asyncio.apply()
File "/Users/<username>/.pyenv/versions/3.9.9/lib/python3.9/site-packages/nest_asyncio.py", line 14, in apply
raise ValueError('Can\'t patch loop of type %s' % type(loop))
ValueError: Can't patch loop of type <class 'NoneType'>
I have never seen this error before and my search for a solution has been fruitless. Any ideas?
Upvotes: 3
Views: 4469
Reputation: 366
Apparently this error occurs for nest-asyncio=1.5.2
(issue). Upgrading to nest-asyncio=1.5.3
worked for me. You can run the following commands to uninstall the existing version and upgrade to 1.5.3
:
pip uninstall nest-asyncio
pip install nest-asyncio==1.5.3
Upvotes: 4
Reputation: 1919
Seens that it is a problem with jupyter and python 3.9:
https://github.com/jupyter/notebook/issues/5912
One possible solution is:
also, this issue contains mac os specific solution:
https://github.com/jupyter/notebook/issues/5872
Upvotes: 0
Reputation: 1919
faced similar issues and solved using:
pip3 install --upgrade pip
pip3 install jupyter
maybe in your case you should use pip3.9
you can check the match of pip and python with
python --version
python -m pip --version
Upvotes: 1