[Python-modules-team] Bug#955775: ipython3: entry_points not working with virtualenvwrapper

Magnus Nord magnunor at gmail.com
Sat Apr 4 21:23:20 BST 2020


Package: ipython3
Version: 7.13.0-1
Severity: important

In the most recent version of ipython3 in Debian Unstable, the entry_points functionality does not work for packages installed within a Python virtualenv (via virtualenvwrapper).
This causes some Python packages installed via pypi in a virtualenv not to work.
This bug is not present in Debian Stable, so this looks like a regression.
This bug is present in the current development version of Ubuntu (20.04).
This bug is not present in the current release version of Ubuntu (19.10).
I also tested this in the development version of Fedora (33), and the bug is not present there.
When installing only ipython3 itself via pip3, with all the dependencies via the Debian package manager, the bug is not present (see below for details).

So I suspect the bug is due to how ipython3 in Debian Unstable.

A workaround is starting ipython with: python3 -m IPython

To replicate this (for example in a docker container):

$ cd /root/
$ apt update && apt install --no-install-recommends -y python3-pip ipython3 virtualenvwrapper
$ mkdir myentrytest && cd myentrytest/

Making a test python package

$ echo "from setuptools import setup" >> setup.py
$ echo "setup(name='myentrytest', entry_points={'testentry': 'testentry = testentry'})" >> setup.py

$ source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
$ mkvirtualenv --system-site-packages -p /usr/bin/python3 testing
$ pip3 install -e . # Inside the testing virtualenv
$ ipython3

In the IPython prompt, running inside the virtualenv:

$ import pkg_resources
$ list(pkg_resources.iter_entry_points('testentry'))

For Debian Unstable this return an empty list []
In Debian Stable this returns [EntryPoint.parse('testentry = testentry')]

In the same virtualenv, but running the Python3 interpreter directly the entry points work in Debian Unstable:

$ python3

In the python3 interpreter:

$ import pkg_resources
$ list(pkg_resources.iter_entry_points('testentry'))
[EntryPoint.parse('testentry = testentry')]

This does not seem to be related to the upstream ipython package, as the bug is not present when installing all of ipython3's dependencies and just grabbing the package via pip. In a new Debian Unstable docker:

$ cd /root/
$ apt update && apt install --no-install-recommends -y python3-pip virtualenvwrapper
$ apt install --no-install-recommends -y python3-backcall python3-decorator python3-jedi python3-pexpect python3-pickleshare python3-pkg-resources python3-prompt-toolkit python3-pygments python3-traitlets
$ pip3 install ipython
$ mkdir myentrytest && cd myentrytest/
$ echo "from setuptools import setup" >> setup.py
$ echo "setup(name='myentrytest', entry_points={'testentry': 'testentry = testentry'})" >> setup.py
$ source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
$ mkvirtualenv --system-site-packages -p /usr/bin/python3 testing
$ pip3 install -e . # Inside the testing virtualenv
$ ipython3

In the IPython prompt:

$ import pkg_resources
$ list(pkg_resources.iter_entry_points('testentry'))

This returns the correct output: [EntryPoint.parse('testentry = testentry')]


-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.4.0-4-amd64 (SMP w/16 CPU cores)
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages ipython3 depends on:
ii  python3          3.8.2-2
ii  python3-ipython  7.13.0-1

ipython3 recommends no packages.

ipython3 suggests no packages.

-- no debconf information


More information about the Python-modules-team mailing list