pipenv: pipenv using wrong python with pyenv
pipenv is using python 3.5.3 instead of 3.6.2 for some reason
$ pipenv --version
pipenv, version 8.0.7
$ python --version
Python 3.6.2
$ which python
/Users/johria/.pyenv/shims/python
$ pipenv install --dev
Creating a virtualenv for this project…
⠋Using base prefix '/Users/johria/.pyenv/versions/3.5.3'
New python executable in /Users/johria/.local/share/virtualenvs/context-generator-d3x1ENAX/bin/python3.5
Also creating executable in /Users/johria/.local/share/virtualenvs/context-generator-d3x1ENAX/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: /Users/johria/.local/share/virtualenvs/context-generator-d3x1ENAX
Installing dependencies from Pipfile.lock…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 25/25 — 00:00:44
To activate this project's virtualenv, run the following:
$ pipenv shell
$ pyenv versions
system
2.7.13
3.5.3
* 3.6.2 (set by /Users/johria/Development/heliograf/apps/context-generator/.python-version)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 42 (26 by maintainers)
fixed! thank you all! 🎉
you’ll have to do a
pipenv --rmto start over.pipenvdoesn’t look at.python-versionorruntime.txtfiles to determine which python version to look for, as @nateprewitt mentioned addpython_requiresto yourPipfile, otherwise be explicit:pipenv --python 3.6.2 install --dev;TLDR for those who ran into this problem:
Replace V with the value of the
python_versionparameter from yourPipfileIf you are just starting a new project and do not have a
Pipfileyet, replace V with the Python version that you set up for this project withasdf,pyenv, or whatever tool you are using to manage Python versions.use
python_full_version = "3.6.2".I just upgraded my Python from 3.7.1 to 3.7.2 and I started having problem. My simple solution was to run “pipenv rm” and then “pipenv install -r requirements.txt” and the Python in the virtualenv has been updated to 3.7.2, which is what I wanted.
@SergiyKolesnikov I did see that, so I understand what is happening. Sorry, I only meant to offer a different workaround for others experiencing this issue. I had tried
pipenv --python=$PYENV_ROOT/shims/pythonfrom this comment, but that didn’t work for me becausePYENV_ROOTis not in my env.pipenv --python=$(which python3)is what I ended up using, instead.@aleksijohansson The
.python-versionproposal was already rejected a while ago because we want to avoid supporting non-standard stuff if possible. Usepipenv --python=$PYENV_ROOT/shims/pythonif you want to hook into the.python-versionconfiguration.Someone integrate PythonFinder please!
@uranusjr I understand and that makes sense. Relying on
python --versioncould be good though. Thanks for the suggested workaround!