Skip to content

test_env_system_packages_are_relative_to_lib fails on some systems #9878

@dimbleby

Description

@dimbleby

Description

eg I am on ubuntu 24.04, and have a virtual environment derived from /usr/bin/python3.12, which in turns comes from the python3.12-minimal package:

$ dpkg -S /usr/bin/python3.12
python3.12-minimal: /usr/bin/python3.12

in that parent python:

>>> sysconfig.get_paths()
{'stdlib': '/usr/lib/python3.12', 'platstdlib': '/usr/lib/python3.12', 'purelib': '/usr/local/lib/python3.12/dist-packages', 'platlib': '/usr/local/lib/python3.12/dist-packages', 'include': '/usr/include/python3.12', 'platinclude': '/usr/include/python3.12', 'scripts': '/usr/local/bin', 'data': '/usr/local'}

and sure enough, /usr/local/lib/python3.12/dist-packages is an empty directory (I run a tight ship)

poetry unit tests assert that this is impossible:

$ pytest -k test_env_system_packages_are_relative_to_lib
...
=================================================== short test summary info ====================================================
FAILED tests/utils/env/test_env.py::test_env_system_packages_are_relative_to_lib[False] - Failed: No distributions found in the base environment of the virtualenv
FAILED tests/utils/env/test_env.py::test_env_system_packages_are_relative_to_lib[True] - Failed: No distributions found in the base environment of the virtualenv

Workarounds

I guess I could install something on my system just to keep the poetry unit tests happy

Poetry Installation Method

other

Operating System

Ubuntu 24.04

Poetry Version

1.8.4

Poetry Configuration

n/a

Python Sysconfig

No response

Example pyproject.toml

n/a

Poetry Runtime Logs

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions