pipenv: Pipenv doesn't resolve --system python correctly.
Describe you environment
- OS Type
Docker Alpine Python
-> https://github.com/docker-library/python/blob/1d59eb2dd813c64891bf554a8ea01754aba25816/3.6/alpine3.6/Dockerfile - Python version:
Python 3.6.3
- Pipenv version:
pipenv, version 8.3.1
Expected result
If I set PIP_PYTHON_PATH it’s ignored and overrided by pipenv (my question is why, what’s reasoning behind that?) because https://github.com/kennethreitz/pipenv/blob/master/pipenv/utils.py#L367 It’s overriding this ENV variable when I use flag --system
. I’ve catched that issue because when building my docker image it was failing on pipenv install --system
Why I know this? Because there is other function that works incorrectly.
'/bin/python'
(Pdb) which('python')
'/bin/python'
(Pdb) print(sys.executable)
'/usr/local/bin/python'
/ # /bin/python
sh: /bin/python: not found
I think issue is somewhere here: https://github.com/kennethreitz/pipenv/blob/1bf6f5101a3bf1dca78be814e742411cc5bdb2dd/pipenv/cli.py#L1440
p = os.sep.join([location] + ['bin/{0}'.format(command)])
this should return /usr/local/bin/python
but for some strange reason it’s returning /bin/python
Actual result
pipenv install --system
should install not failed that /bin/python is not found.
Steps to replicate
pipenv install --system
on that docker image will fail
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 46 (19 by maintainers)
Commits related to this issue
- fixed problem with not respecting --system (closes: #1002) — committed to Solution4Future/pipenv by galuszkak 7 years ago
- fixed problem with not respecting --system (closes: #1002) — committed to Solution4Future/pipenv by galuszkak 7 years ago
- fixed problem with not respecting --system (closes: #1002) — committed to Solution4Future/pipenv by galuszkak 7 years ago
- Pass 'allow_global' to resolve_deps - Fixes #1002 — committed to techalchemy/pipenv by techalchemy 7 years ago
- Pass 'allow_global' to resolve_deps - Fixes #1002 — committed to pypa/pipenv by techalchemy 7 years ago
- Pass 'allow_global' to resolve_deps - Fixes #1002 — committed to pypa/pipenv by techalchemy 7 years ago
- Fixes #1002, #1939 Signed-off-by: Dan Ryan <dan@danryan.co> — committed to pypa/pipenv by techalchemy 6 years ago
no movement in 30 days. it’ll come back up if its important
@kennethreitz issue is not resolved, can You don’t close things that aren’t fixed yet. Issue is still reproducible.
I can repro the problem in master. Although it is closed, the PR #1097 that suppose to solve this problem didn’t actually get merged into master. Please reopen
I just tried,
pip install git+git://github.com/pypa/pipenv.git@master
andpipenv install --dev --system
started working in mypython:3.6.3
docker image. Can another release be made?@kennethreitz issue has 23 days now not 30 days, so You closed it too quickly. Also there is pending PR after first one was closed. So there is still pending action on this issue…
Please reopen issue.
This will be resolved by #1097 if and when it is merged
Sorry for the ongoing trouble here folks, we had some trouble with our testing infrastructure but we will get this looked at
Here is the Dockerfile I am using for dev:
Unfortunately I’m still running into this in both
python:3.6.3
andubuntu:17.10
containers, with all versions of pipenv mentioned here, including the one suggested by @sbdchd .Edit: Sorry that was a little unhelpful. I wasn’t able to recreate it with a more minimal Dockerfile, so it must be something specific (and probably stupid) I’m doing. I’ll report back if I find it!
@LuRsT I just install via the git commit sha, which has the fix.
Currently waiting for a new release.
EDIT: you will need to install git for this to work.
Hi there!
Just got the same issue here with the
python:3.6
Docker image andpipenv-11.9.0
.Here’s a Dockerfile sample:
For now, I’m using @Jitsusama work-around.
Thanks.
I have added a work-around that is pretty simple to use in Docker in #917. The comment is https://github.com/pypa/pipenv/issues/917#issuecomment-375312947. While not ideal, I do think that it is quite simple. @mcgeeco; my scenario was similar to yours for wanting this, so maybe you’ll find my work-around useful?
Pass
system
to the function, wherewhich
is being passed, and pass it to the passedwhich
.My shell was ZSH. After setting LC_ALL and LANG in .zshrc everything works fine. But I’m not sure why LANG/LC_ALL should have any impact on choosing python interpreter.
@galuszkak Apologies; I understand that, I guess I am unsure why this needs to be set in this case. We should definitely address this bug and fix it. I’m just wondering if there is more going on with docker alpine which required the PIP_PYTHON_PATH being set.
Using this Dockerifle, which is based on the one commited to this repo I cannot reproduce this issue, not saying it doesn’t exist, looks like something is up, buy this dockerfile seems to work: