Pipenv doesn't respect the PIPENV_PYTHON to select the correct python version.
See original GitHub issueHi,
See my following testing on using the env var PIPENV_PYTHON:
Run the following commands from my project folder:
$ pipenv --version
pipenv, version 2018.11.26
$ env | grep PIPENV_PYTHON
PIPENV_PYTHON=/home/werner/.pyenv/shims/python
$ /home/werner/.pyenv/shims/python --version
Python 3.4.9
$ pipenv --three
Creating a virtualenv for this project…
Pipfile: /home/werner/aaa/Pipfile
Using /home/werner/.pyenv/versions/3.7.5/bin/python3 (3.7.5) to create virtualenv…
⠧ Creating virtual environment...Already using interpreter /home/werner/.pyenv/versions/3.7.5/bin/python3
Using base prefix '/home/werner/.pyenv/versions/3.7.5'
New python executable in /home/werner/aaa/.venv/bin/python3
Also creating executable in /home/werner/aaa/.venv/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /home/werner/.pyenv/versions/3.7.5/bin/python3
✔ Successfully created virtual environment!
Virtualenv location: /home/werner/aaa/.venv
Creating a Pipfile for this project…
As you can see, I set the PIPENV_PYTHON the env var, and it’s pointing to python 3.4.9, why still the pipenv will use another python version, for my case, it’s 3.7.5?
Regards
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Why is pipenv telling me the wrong version of python?
This will create a Pipfile if one doesn't exist. ... Then check that your existing Pipfile has the correct version set in python_version...
Read more >Frequently Encountered Pipenv Problems - Read the Docs
Pipenv only supports CPython distributions, with version name like 3.6.4 or similar. ☤ Pipenv does not respect pyenv's global and local Python versions¶....
Read more >Pipenv: Python Dev Workflow for Humans — pipenv 2022.12 ...
Automatically install required Python version when pyenv is available. ... Pipenv does not respect pyenv's global and local Python versions ...
Read more >Understanding Virtual Environments and Pipenv - Python
I've completed the Pipenv lesson in the Learn Python 3 course but I've been left with a lot of questions that Googling doesn't...
Read more >pipenv Documentation - Read the Docs
Pipenv uses a set of commands to manage your Project's dependencies and custom ... 3.5.4 Pipenv does not respect pyenv's global and local...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
PIPENV_PYTHON
is not meant to point at a full python path, it is only ever meant to point at a numeric python version (e.g.3.7
. Whatever you set inPIPENV_PYTHON
will be appended to the name of the virtualenv created by pipenv, e.g./path/to/your/.virtualenvs/yourfolder-<somehash>-$PIPENV_PYTHON
– this is meant for use in environments where you intend to have multiple versions of the same virtual environment for a single project, so you might want, for instance:If you would like to specify a python version, you will have to pass that in directly via
--python
(e.g.pipenv install --python=/path/to/python
). As a side note, pyenv’s shim python path is just a shell script that wraps some pyenv internals, so there is no guarantee that will actually resolve to python when pipenv encounters it. Pipenv bypasses pyenv shims by default and works more successfully if you specify nothing (as it will determine that you are using pyenv and resolve the shim for you – at least in the next release it will).I would strongly recommend using only the version number to tell pipenv which python version you are looking for, e.g.
3.8
or2.7
or whatever version you like, as this will ensure that you don’t wind up with mangled environment paths that become orphaned if you misremember them or fail to set the environment up again later.Hope this helps to clear up how the environment variable works – if you are still struggling, make sure to use the latest prerelease of pipenv (
pip install --upgrade --pre pipenv
) as it will provide more of the functionality you are looking for.Thanks!
No, I don’t want to use method, though I don’t try it either. But IMO, this method is not portable, I want to let the pipenv use the python version set by pyenv locally/globally.
Regards