Skip to content

Request to add poetry install --global to install to global environment #8343

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

Closed
2 tasks done
fritzb opened this issue Aug 21, 2023 · 4 comments
Closed
2 tasks done
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@fritzb
Copy link

fritzb commented Aug 21, 2023

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

Please add a flag to install packages into global environment without of having to configure poetry config virtualenvs.create false

ie.

poetry install --global

similar to

pipenv install --system

Main use case: Docker image build where virtual environment is not preferred over global installation.

@fritzb fritzb added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Aug 21, 2023
@ghost
Copy link

ghost commented Aug 21, 2023

Docker image build where virtual environment is not preferred over global installation.

Why not keep everything in a local environment? Never install anything globally.

Using poetry environments inside docker works as expected.

FROM python:3.11-slim

RUN pip install pip poetry -U

WORKDIR /usr/src

# Copy dependency setup
COPY pyproject.toml poetry.lock .

# install dependencies before the code copy so code updates don't trigger all deps being pulled every time
RUN poetry install --only main

# copy your code directory
COPY modulename modulename

# double install because poetry requires it to stop complaining about script commands now
# (may also require copying your README.md since poetry cares about it now too)
RUN poetry install

CMD ["poetry", "run", "my-server"]

@fritzb
Copy link
Author

fritzb commented Aug 21, 2023

There are various reason, one of them is to load driver, as an example GPU driver.
I found a way, using environment variable POETRY_VIRTUALENVS_CREATE=false, and we can close this issue.

Example:

POETRY_VIRTUALENVS_CREATE=false poetry install --only main --no-cache --no-interaction

@dimbleby
Copy link
Contributor

as you note, there is already a config option to do what you want.

making this easier is the opposite of the likely direction of travel - eg #6398 for more discussion - so yes, please close

@radoering radoering closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2023
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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants