Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: ipython version incompatibility #1157

Closed
wants to merge 3 commits into from

Conversation

idling-mind
Copy link

ipython requires python>=3.9 where as ipykernel requires python>=3.8

This mismatch causes kernel installs with python=3.8 to fail.

@ccordoba12
Copy link
Member

ccordoba12 commented Oct 23, 2023

The right IPython version should be picked up by pip when installing in a Python 3.8 env, unless you're using a very old version of it.

So I think this is not really necessary.

@idling-mind
Copy link
Author

I'm using python 3.8.5 at work, it's distributed by our IT (I dont have much control over this). I can create virtual envs and install ipython kernels. Tried the following.

$ python -m venv venv
$ source venv/bin/activate
$ pip install ipykernel
(Truncated output below)
Collecting ipykernel
  Downloading https://localpypi.internal/DefaultCollection/_packaging/9e526b0b-a96f-4467-acd5-9d27dd953a6b/pypi/download/ipykernel/6.25.2/ipykernel-6.25.2-py3-none-any.whl
.....
.....
Collecting ipython>=7.23.1
  Downloading https://localpypi.internal/DefaultCollection/_packaging/9e526b0b-a96f-4467-acd5-9d27dd953a6b/pypi/download/ipython/8.13/ipython-8.13.0-py3-none-any.whl
....
....
Successfully installed asttokens-2.4.0 backcall-0.2.0 comm-0.1.4 debugpy-1.8.0 decorator-5.1.1 executing-2.0.0 importlib-metadata-6.8.0 ipykernel-6.25.2 ipython-8.13.0 jedi-0.19.1 jupyter-client-8.4.0 jupyter-core-5.4.0 matplotlib-inline-0.1.6 nest-asyncio-1.5.8 packaging-23.2 parso-0.8.3 pexpect-4.8.0 pickleshare-0.7.5 platformdirs-3.11.0 prompt-toolkit-3.0.39 psutil-5.9.6 ptyprocess-0.7.0 pure-eval-0.2.2 pygments-2.16.1 python-dateutil-2.8.2 pyzmq-25.1.1 six-1.16.0 stack-data-0.6.3 tornado-6.3.3 traitlets-5.11.2 typing-extensions-4.8.0 wcwidth-0.2.8 zipp-3.17.0




$ python -m ipykernel install
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/me/temp/venv/lib/python3.8/site-packages/ipykernel/__main__.py", line 3, in <module>
    from ipykernel import kernelapp as app
  File "/home/me/temp/venv/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 19, in <module>
    from IPython.core.application import (  # type:ignore[attr-defined]
  File "/home/me/temp/venv/lib/python3.8/site-packages/IPython/__init__.py", line 30, in <module>
    raise ImportError(
ImportError: 
IPython 8.13+ supports Python 3.9 and above, following NEP 29.
IPython 8.0-8.12 supports Python 3.8 and above, following NEP 29.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Python 3.3 and 3.4 were supported up to IPython 6.x.
Python 3.5 was supported with IPython 7.0 to 7.9.
Python 3.6 was supported with IPython up to 7.16.
Python 3.7 was still supported with the 7.x branch.

See IPython `README.rst` file for more information:

    https://github.com/ipython/ipython/blob/main/README.rst

This error disappears if I pin the version of ipython<=8.12

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using python 3.8.5 at work, it's distributed by our IT (I dont have much control over this).

Ok, I see. I left a small suggestion for you to fix the change you made.

pyproject.toml Show resolved Hide resolved
@blink1073
Copy link
Contributor

@idling-mind, it would work if your first run pip install --upgrade pip in your virtual environment. I don't think we should be working around old pips this way.

@idling-mind
Copy link
Author

Updating pip did not resolve my issue.

However, I think I found out the root cause. It is related to ipython/ipython#14053. ipython==8.13.0 had a bug with the setup.cfg file where it's required python version was >=3.8. This version was later yanked. However, since we use an internal pypi at work, this version of ipython was synced there and was getting picked up by ipykernel installations.

Since I have access to yank the version in this internal pypi, this issue can be resolved with that.
Closing the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants