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

Cannot configure options through environment variables #5906

Closed
3 tasks done
jpreese opened this issue Jun 24, 2022 · 9 comments
Closed
3 tasks done

Cannot configure options through environment variables #5906

jpreese opened this issue Jun 24, 2022 · 9 comments
Labels
area/venv Related to virtualenv management kind/bug Something isn't working as expected

Comments

@jpreese
Copy link

jpreese commented Jun 24, 2022

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: macOS Montery version 12.4
  • Poetry version: 1.2.0b2

Issue

When calling poetry using environment variables to configure options, they do not seem to be respected. From the documentation, I would expect to be able to create a virtual environment without pip using something like the following:

POETRY_VIRTUALENVS_OPTIONS_NO_PIP=true POETRY_VIRTUALENVS_IN_PROJECT=true POETRY_VIRTUALENVS_PATH=.venv poetry install

The last two values work. Poetry is installed in the project in a folder named .venv -- however, pip is still in the site-packages folder.

I've tried the other "options" as well, and tried different ways to name them but have not been successful.

Are options able to be configured by environment variables?

@jpreese jpreese added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 24, 2022
@dimbleby
Copy link
Contributor

dimbleby commented Jun 25, 2022

Looks like not - see

flags=self._poetry.config.get("virtualenvs.options"),

that'll cause poetry to look for the POETRY_VIRTUALENVS_OPTIONS environment variable - which doesn't help at all

@l-rossetti
Copy link

still no way to make --always-copy work for virtualenv creation?

@dimbleby
Copy link
Contributor

dimbleby commented Sep 5, 2023

this issue is about not being able to configure those options through environment variables, per #7873 (comment) it works fine when configured another way

@nfantone
Copy link

I was hit by this today. POETRY_VIRTUALENVS_OPTIONS_NO_PIP=true seems to have no effect.

This is the end result of my venv after poetry install.

sh-5.2$ ls .virtualenvs/my-venv/bin -la
total 56
drwxr-xr-x 2 user user 4096 Dec 11 10:45 .
drwxr-xr-x 5 user user 4096 Dec 11 10:44 ..
-rw-r--r-- 1 user user 9033 Dec 11 10:44 Activate.ps1
-rw-r--r-- 1 user user 2354 Dec 11 10:44 activate
-rw-r--r-- 1 user user  936 Dec 11 10:44 activate.csh
-rw-r--r-- 1 user user 2215 Dec 11 10:44 activate.fish
-rwxr-xr-x 1 user user  292 Dec 11 10:44 django-admin
-rwxr-xr-x 1 user user  246 Dec 11 10:45 gunicorn
-rwxr-xr-x 1 user user  250 Dec 11 10:44 pip
-rwxr-xr-x 1 user user  250 Dec 11 10:44 pip3
-rwxr-xr-x 1 user user  250 Dec 11 10:44 pip3.12
lrwxrwxrwx 1 user user   21 Dec 11 10:44 python -> /usr/local/bin/python
lrwxrwxrwx 1 user user    6 Dec 11 10:44 python3 -> python
lrwxrwxrwx 1 user user    6 Dec 11 10:44 python3.12 -> python
-rwxr-xr-x 1 user user  245 Dec 11 10:44 sqlformat

sh-5.2$ pip --version
pip 23.2.1 from /home/user/.virtualenvs/my-venv/lib/python3.12/site-packages/pip (python 3.12)

@jyligehc
Copy link

Using Poetry version 1.7.1 (on Windows 10) noticed same issue with POETRY_VIRTUALENVS_OPTIONS_SYSTEM_SITE_PACKAGES.

Setting it to true will show correctly in the config list:
virtualenvs.options.system-site-packages = true

But when creating the venv (poetry install) or running poetry env use <python>
The line in pyvenv.cfg is not set correctly:
include-system-site-packages = false

If using command poetry config --local virtualenvs.options.system-site-packages true
the project's poetry.toml is updated correctly and also pyvenv.cfg has correct setting in venv.

@alexandreteles
Copy link

alexandreteles commented Jan 23, 2024

Using Poetry version 1.7.1 on Ubuntu (WSL2) and I can also reproduce this error. I did notice, however, that some flags work. For example, POETRY_VIRTUALENVS_IN_PROJECT=true resulted in the .venv being created in the project's root.

@dimbleby
Copy link
Contributor

dimbleby commented Jan 23, 2024

folks, this all has been well understood since #5906 (comment). No need to keep reporting that it is still a thing - that's represented already by this still being open.

what this issue needs now is someone who cares enough to make a merge request fixing it: if that's you then please go ahead!

@dimbleby
Copy link
Contributor

Fixed at #9015

@abn abn closed this as completed Feb 25, 2024
@radoering radoering added area/venv Related to virtualenv management and removed status/triage This issue needs to be triaged labels Feb 25, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/venv Related to virtualenv management kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

8 participants