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

Add option to install dependencies to the system site packages #234

Closed
zhukovgreen opened this issue Jun 19, 2018 · 8 comments
Closed

Add option to install dependencies to the system site packages #234

zhukovgreen opened this issue Jun 19, 2018 · 8 comments

Comments

@zhukovgreen
Copy link

zhukovgreen commented Jun 19, 2018

It is not always easy to have some packages installed inside the virtualenv + having the virtualenv inside the docker container, which only runs your app, makes no sense.

It would be nice to have an option i.e. --system to deploy your package right inside the system without venv.

Now solving it in a stupid way:

RUN mkdir -p /root/.cache/pypoetry/virtualenvs/phex-recutech-mcs-py3.6/lib/python3.6 
RUN ln -sf /usr/local/lib/python3.6/site-packages /root/.cache/pypoetry/virtualenvs/phex-recutech-mcs-py3.6/lib/python3.6
@sdispater
Copy link
Member

You can disable the automatic creation of virtualenvs by using:

poetry config settings.virtualenvs.create false

@piotr-dobrogost
Copy link

piotr-dobrogost commented Jul 10, 2018

having the virtualenv inside the docker container, which only runs your app, makes no sense

This is common misconception. See Deploying Python Applications with Docker - A Suggestion or Why people create virtualenv in a docker container?.

This is duplicate of issue #218

@zhukovgreen
Copy link
Author

zhukovgreen commented Jul 10, 2018

There are some situations when using a virtualenv creates complications. For example a docker container with some global python package. In my case it was compiled from the source freecad. Exposing it to the virtualenv is a headache.

@wyl8899
Copy link
Contributor

wyl8899 commented Jan 8, 2020

For those who find here later, the config command worked for me was:

poetry config virtualenvs.create false

@dyno
Copy link

dyno commented Mar 17, 2021

how about use the export option?

https://python-poetry.org/docs/cli/#export

poetry export -f requirements.txt --output requirements.txt
pip install -r requirements.txt

@couling
Copy link
Contributor

couling commented May 12, 2022

having the virtualenv inside the docker container, which only runs your app, makes no sense

This is common misconception. See Deploying Python Applications with Docker - A Suggestion or Why people create virtualenv in a docker container?.

This is duplicate of issue #218

I heard you liked virtual environments so I put a virtual environment in your virtual environment so you can isolate while you're isolated.

More seriously: calling this a "misconception" is overstated. There can be contexts where a virtual-env in a docker container is useful but many (and arguably most) of them are the result of an anti-pattern.

The most common anti-pattern to make them useful is breaking the "one app per container" rule. If your container is supposed to just run your python app then the "system" packages should be redundant and just useless files in the image. This redundancy should mean there's no need for a virualenv; you should just be able to clobber the system packages.

@clafoutis42
Copy link

how about use the export option?

https://python-poetry.org/docs/cli/#export

poetry export -f requirements.txt --output requirements.txt
pip install -r requirements.txt

The problem with this is that the application is not properly installed as a package. You only install the requirements.
For most applications this is not a problem, but for applications with various entrypoints you might want to install it to the system.

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
None yet
Projects
None yet
Development

No branches or pull requests

7 participants