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

[BUG] pip editable modules incorrectly installed when setuptools>=60.0.0 #3377

Closed
IgnacioHeredia opened this issue Jun 15, 2022 · 1 comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@IgnacioHeredia
Copy link

setuptools version

setuptools>=60.0.0

Python version

3.8.10

OS

Ubuntu 20.04

Additional environment information

No response

Description

Hi all,

I found a bug in Ubuntu 20.04 related to pip and setuptools.

When you pip install a Python module in Ubuntu 20.04 in editable mode (-e flag), the module is not listed in pip.
When the module is installed normally (no -e flag), everything works as usual, and pip finds the module.

This happens because depending on the setuptools version, the module is installed at a different path (and thus not found in the PYTHONPATH in some cases):

  • setuptools 45.2.0 works fine
    Module installation path: /usr/local/lib/python3.8/dist-packages/
$ python3 -c "import sys; print(sys.path)"
['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/samplemod', '/usr/lib/python3/dist-packages']
  • setuptools 62.4.0 breaks
    Module installation path: /usr/lib/python3.8/site-packages/
$ python3 -c "import sys; print(sys.path)"
['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']

The last working version is setuptools==59.8.0. Starting from setuptools==60.0.0 it breaks.
I opened an issue in pip and was forwarded here.

Expected behavior

The module should be correctly installed and listed.

$ pip3 list -e
Package Version Editable project location
------- ------- -------------------------
sample  0.1.0   /samplemod

How to Reproduce

I attach a minimal Dockerfile to reproduce the issue.

FROM ubuntu:20.04

# Refresh cache and install packages
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
    apt-get install -y --no-install-recommends git

# Install pip
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip
RUN pip install --upgrade setuptools  # THIS BREAKS THE INSTALLATION: setuptools 45.2.0 -->  setuptools 62.4.0
RUN pip install --upgrade pip  # pip 20.0.2 -->  pip 22.1.2

# Install sample Python module in **editable** (-e) mode
RUN git clone https://github.com/navdeep-G/samplemod && \
    cd  samplemod && \
    pip install -v -e . && \
    cd ..

# Check behaviour
RUN python3 --version
RUN pip --version
RUN pip list -e
RUN python3 -c "import sys; print(sys.path)"

Output

  • setuptools 45.2.0 ✔️
Python 3.8.10
pip 22.1.2 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)

Pip install log:
[...] Creating /usr/local/lib/python3.8/dist-packages/sample.egg-link

$ pip3 list -e
Package Version Editable project location
------- ------- -------------------------
sample  0.1.0   /samplemod
  • setuptools 62.4.0 ❌
Python 3.8.10
pip 22.1.2 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)

pip install logs:
[...] Creating /usr/lib/python3.8/site-packages/sample.egg-link (link to .)

$ pip3 list -e
@IgnacioHeredia IgnacioHeredia added bug Needs Triage Issues that need to be evaluated for severity and status. labels Jun 15, 2022
@IgnacioHeredia
Copy link
Author

Sorry, closing this as it is duplicated with #3301

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

1 participant