Skip to content

Poetry from install-poetry.py does not install packages to system Python even with POETRY_VIRTUALENVS_CREATE=0 #3870

@ruohola

Description

@ruohola
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.

Poetry installed from the latest install-poetry.py does not install packages to system Python even with POETRY_VIRTUALENVS_CREATE=0.

Steps to reproduce:

Spin up a fresh container for demoing:

$ docker run -it python:3.9.2-buster bash

In the container:

$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/45a9b8f20384591d0a33ae876bcf23656f928ec0/install-poetry.py | python -
$ export PATH="/root/.local/bin:$PATH"
$ export POETRY_VIRTUALENVS_CREATE=0
$ poetry --version
Poetry version 1.1.5
$ poetry init  # go with the bare defaults

Install a package (note the "Skipping virtualenv creation" message):

$ poetry add django
Skipping virtualenv creation, as specified in config file.
Using version ^3.1.7 for Django

Updating dependencies
Resolving dependencies... (0.6s)

Writing lock file

Package operations: 4 installs, 0 updates, 0 removals

  • Installing asgiref (3.3.1)
  • Installing pytz (2021.1)
  • Installing sqlparse (0.4.1)
  • Installing django (3.1.7)

Then try to run

$ python -c 'import django'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'django'

We can see that django got installed to here:

$ find / -type d -name django
/root/.local/share/pypoetry/venv/lib/python3.9/site-packages/django
/root/.local/share/pypoetry/venv/lib/python3.9/site-packages/django/forms/templates/django
/root/.local/share/pypoetry/venv/lib/python3.9/site-packages/django/forms/jinja2/django

When pip would install it here:

$ pip install django
$ python -c 'import django'  # no errors
$ find / -type d -name django
/usr/local/lib/python3.9/site-packages/django
/usr/local/lib/python3.9/site-packages/django/forms/templates/django
/usr/local/lib/python3.9/site-packages/django/forms/jinja2/django
/root/.local/share/pypoetry/venv/lib/python3.9/site-packages/django
/root/.local/share/pypoetry/venv/lib/python3.9/site-packages/django/forms/templates/django
/root/.local/share/pypoetry/venv/lib/python3.9/site-packages/django/forms/jinja2/django

The same thing also happens with non-root users. This issue does NOT happen with Poetry installed from the latest get-poetry.py NOR with poetry==1.1.5 installed from pip.

Metadata

Metadata

Assignees

Labels

area/venvRelated to virtualenv managementkind/bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions