Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Cannot install Python 2 kernel in Jupyter Notebook

$
0
0

I am trying to use a Python program written for Python 2.7. I am using a Macbook Pro running Catalina. The program is here: https://github.com/geoss/censumander. The program has two Jupyter Notebooks to practice with. I have Anaconda 4.9.2 installed and pip 20.2.4. When I open Jupyter Notebook it defaults to Python 3 and has no kernel option to change to Python 2. I have used the guide here to try to install the Python 2 kernel: https://ipython.readthedocs.io/en/latest/install/kernel_install.html.

When I run

python2 -m pip install ipykernel

I get back

Could not find a version that satisfies the requirement ipykernel (from versions: )

No matching distribution found for ipykernel.

I am pretty new to using Python (typically use R) and am trying to get the hang of stuff like this, so apologies if the answer here is obvious. I've tried the solutions here to no avail: Jupyter notebook with Python 2 and Python3 Kernel

I have also tried the solutions here: Jupyter Notebook - install python 2. The first solution

$ python2 /path/to/jupyter-notebook

is unclear to me as I don't understand to what file path the code points (for jupyter_notebook). (This is likely a consequence of my noobiness.)

The second,

conda create -n ipykernel_py2 python=2 ipykernelconda activate ipykernel_py2    python -m ipykernel install --user

triggers the following traceback after the third line:

Traceback (most recent call last):  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/runpy.py", line 163, in _run_module_as_main    mod_name, _Error)  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/runpy.py", line 111, in _get_module_details    __import__(mod_name)  # Do not catch exceptions initializing package  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/ipykernel/__init__.py", line 2, in <module>    from .connect import *  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/ipykernel/connect.py", line 13, in <module>    from IPython.core.profiledir import ProfileDir  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/__init__.py", line 49, in <module>    from .terminal.embed import embed  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/terminal/embed.py", line 18, in <module>    from IPython.terminal.interactiveshell import TerminalInteractiveShell  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 16, in <module>    from prompt_toolkit.document import Document  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/__init__.py", line 16, in <module>    from .interface import CommandLineInterface  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/interface.py", line 19, in <module>    from .application import Application, AbortAction  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/application.py", line 3, in <module>    from .buffer import Buffer, AcceptAction  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/buffer.py", line 7, in <module>    from .auto_suggest import AutoSuggest  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/auto_suggest.py", line 13, in <module>    from .filters import to_cli_filter  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/filters/__init__.py", line 33, in <module>    from .base import *  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/filters/base.py", line 5, in <module>    from prompt_toolkit.utils import test_callable_args  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/utils.py", line 9, in <module>    from wcwidth import wcwidth  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/wcwidth/__init__.py", line 12, in <module>    from .wcwidth import ZERO_WIDTH  # noqa  File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/wcwidth/wcwidth.py", line 79, in <module>    from backports.functools_lru_cache import lru_cacheImportError: No module named functools_lru_cache

Thanks, all.


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>