pypa / pypa/setuptools

site.py removal in 49.0.0 breaks eggs installed outside system prefix

Open
#2,295 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

site.py was removed in https://github.com/pypa/setuptools/issues/2165 and first released with setuptools 49.0.0

This now causes installed eggs to not be loaded when installed to a prefix and pointed to by PYTHONPATH.

E.g. a concrete example of this use is with GStreamer's cerbero build system which installs the meson build system to a custom prefix to avoid messing up user/system installations. Relevant code for that is: https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/master/recipes/build-tools/meson.recipe#L30

PYTHONPATH is constructed by cerbero to point to the necessary path for the installed location (e.g. PYTHONPATH=/path/to/cerbero/build/build-tools/lib/python3.8/site-packages/). Without the site.py that is installed, this does not work anymore.

One can reproduce by doing the following:

git clone https://gitlab.freedesktop.org/gstreamer/cerbero.git
cd cerbero
./cerbero-uninstalled -c config/build-tools.cbc build meson
./cerbero-uninstalled shell
python3 -c "import sys; print(sys.path)"
# should output a value containing '/path/to/cerbero/build/build-tools/lib/python3.8/site-packages/meson-0.54.0-py3.8.egg'

Reverting to python-setuptools < 49.0.0 is one workaround.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with Cerbero's build-tools/meson.recipe setup and the shown PYTHONPATH, then inspect the removal of site.py in setuptools 49.0.0. Confirm whether the installed egg is absent from sys.path; done means the reproduction loads the meson egg from the custom prefix without requiring setuptools below 49.0.0.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.