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

Support install --system <pkg> and PIPENV_SYSTEM env #2239

Closed
MatthewMiele opened this issue May 22, 2018 · 5 comments
Closed

Support install --system <pkg> and PIPENV_SYSTEM env #2239

MatthewMiele opened this issue May 22, 2018 · 5 comments

Comments

@MatthewMiele
Copy link

MatthewMiele commented May 22, 2018

Firstly thank you Kenneth for Pipenv and being able to meet you and the rest of the Pipenv team at PyCon this year. Trying to now use Pipenv in our daily workflow at work and have come into a few snags.

Is your feature request related to a problem? Please describe.
At work all our systems are dockerised and both local development and deployments / production use the same docker image. We docker run --rm <image> bash locally and do our development from there. Our Dockerfile contains these build steps

RUN pip install pipenv
COPY Pipfile Pipfile.lock /tmp/
RUN cd /tmp && pipenv install --deploy --system --dev
...

The issue comes when we start developing inside the image and want to install new packages. As its a container we dont need any virtualenvs. There seems to be no way to install a single package straight to system. This has caused a bit of confusion as all the base packages are importable (since they where installed from a Pipfile with --system, but a new package installed while developing with pipenv install x is not importable (from system python) as it goes into a virtualenv.

This leads us to having to install these packages twice. pipenv install x (to get it into the Pipfile) and then pipenv install --system to then reinstall the Pipfile with the new package for system python to be able to see it.

Describe the solution you'd like
It would be nice to have 1) --system when installing of specific packages and then 2) a way of setting --system globally so we can set it as an ENV in our dockerfile as Pipenv in docker would only ever be used with system Python. I feel this would be the use case for most people doing development inside docker containers.

I have looked into the code and noticed there are some undocumented envs that would turn on --system by default (but its not 100% clear and not a pipenv specific variable, seems like I need to
export VIRTUAL_ENV=
for python to be able to cast it to False correctly https://github.com/pypa/pipenv/blob/master/pipenv/environments.py#L52). But as a found out it does not apply for installing specific packages. Just from the pipfile.

@kennethreitz
Copy link
Contributor

this is not how pipenv is designed, currently. we're aware of this issue and are tracking it in our internal project tracker. thank you for your feedback!

@grischa
Copy link

grischa commented Jul 26, 2018

I also think this is a shortcoming. E.g. PyCharm supports developing inside Docker, and so there is no need to use virtualenvs, --system is fine. However, I still want the project to be using Pipenv, for version locking, for colleagues to be able to use virtualenvs etc.
In the current state I have to hand edit Pipfile, and run pipenv lock. Maybe a command to add a package to Pipfile and Pipfile.lock but not actually install them would be handy?

@uranusjr
Copy link
Member

Pipenv has “env” in its name for a reason. You don’t need Pipenv to deal with a Pipfile and Pipfile.lock.

@MatthewMiele
Copy link
Author

MatthewMiele commented Feb 7, 2020

@kennethreitz

we're aware of this issue and are tracking it in our internal project tracker

I have tried to have a look at the current documentation and MRs but cant find much relating to this request. I have found a couple of similar open Issue tickets though (#4086) . Just wondering if there is any update on this or if its been addressed?

You don’t need Pipenv to deal with a Pipfile and Pipfile.lock.

There doesnt seem to be any other tools that work as well as Pipenv or that are solely for Pipfiles and .lock files. They all seem to include virtualenv building too

@uranusjr
Copy link
Member

uranusjr commented Feb 7, 2020

There doesnt seem to be any other tools that work as well as Pipenv or that are solely for Pipfiles and .lock files. They all seem to include virtualenv building too.

They are in standard formats (TOML and JSON respectively) with a standardised structure. You don’t need tools, only Python (well, and a third-party TOML parser package).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants