Skip to content

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

Closed

Description

@zhukovgreen

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

Activity

  1. sdispater commented on Jun 19, 2018

    @sdispater
    Member

    You can disable the automatic creation of virtualenvs by using:

    poetry config settings.virtualenvs.create false
    
  2. piotr-dobrogost commented on Jul 10, 2018

    @piotr-dobrogost

    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

  3. zhukovgreen commented on Jul 10, 2018

    @zhukovgreen
    Author

    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.

  4. wyl8899 commented on Jan 8, 2020

    @wyl8899
    Contributor

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

    poetry config virtualenvs.create false
    
  5. dyno commented on Mar 17, 2021

    @dyno

    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
    
  6. couling commented on May 12, 2022

    @couling
    Contributor

    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.

  7. clafoutis42 commented on Feb 24, 2023

    @clafoutis42

    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.

  8. github-actions commented on Feb 29, 2024

    @github-actions

    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.

  9. locked as resolved and limited conversation to collaborators on Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions