pipenv installs 3.6.2 using pyenv, but creates 2.7 env

Created on 26 Sep 2017  Â·  4Comments  Â·  Source: pypa/pipenv

First of all, sorry for the 2.7.6 thingy, I am trying to use pipenv on an old server.
First issue: When I was trying pipenv --python 3.6.2, it was not clear that I needed to install pyenv (and activate it, omg so painful) first. I was getting:

Warning: Python 3.6.2 was not found on your system…
You can specify specific versions of Python with:
  $ pipenv --python path/to/python
 ```
I think the message could suggest you to install pyenv or do it automatically, but maybe the latter would be complicated to achieve.

Once I managed to install and activate pyenv, I tried `pipenv --python 3.6.2` again. This time I was asked if I wanted to install it using pyenv. So it installed it. All good so far.
But something went wrong and the created venv is 2.7, not 3.6.2. I suspect this little guy is the responsible for it: `bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory`. Does this mean pipenv is using virtualenvs created by virtualenvenvwrapper to create it's new virtualenv? virtualenvception? :scream: 

ubuntu@aws:~/project$ pipenv --python 3.6.2
Warning: Python 3.6.2 was not found on your system…
Would you like us to install CPython 3.6.2 with pyenv? [Y/n]: y
Installing CPython 3.6.2 with pyenv (this may take a few minutes)…
â ‹Downloading Python-3.6.2.tar.xz...
-> https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
Installing Python-3.6.2...
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
Installed Python-3.6.2 to /home/ubuntu/.pyenv/versions/3.6.2

Warning: The Python you just installed is not available on your PATH, apparently.
Creating a virtualenv for this project…
â ™New python executable in /home/ubuntu/.virtualenvs/project-mlX01u00/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /home/ubuntu/.virtualenvs/project-mlX01u00
Warning: Your Pipfile requires python_version 3.6, but you are using 2.7.6 (/home/ubuntu/./p/bin/python).
$ pipenv check will surely fail.
ubuntu@aws:~/project$ pipenv shell
Warning: Your Pipfile requires python_version 3.6, but you are using 2.7.6 (/home/ubuntu/./p/bin/python).
$ pipenv check will surely fail.
Spawning environment shell (/bin/bash).
source /home/ubuntu/.virtualenvs/project-mlX01u00/bin/activate
bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
ubuntu@aws:~/project$ source /home/ubuntu/.virtualenvs/project-mlX01u00/bin/activate
(project-mlX01u00) ubuntu@aws:~/project$ pipenv check
Checking PEP 508 requirements…
Specifier python_version does not match 3.6 (2.7).
Failed!
(project-mlX01u00) ubuntu@aws:~/project$ python --version
Python 2.7.6

Actually, I don't think virtualenvwrapper is the responsible for the error, because I am still getting this:

(project-mlX01u00) ubuntu@aws:~/project$ pipenv --python 3.6.2
Virtualenv already exists!
Removing existing virtualenv…
Warning: Python 3.6.2 was not found on your system…
Would you like us to install CPython 3.6.2 with pyenv? [Y/n]: Y
Installing CPython 3.6.2 with pyenv (this may take a few minutes)…
â ‹
Warning: The Python you just installed is not available on your PATH, apparently.
Creating a virtualenv for this project…
â ™New python executable in /home/ubuntu/.virtualenvs/project-mlX01u00/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /home/ubuntu/.virtualenvs/project-mlX01u00
Warning: Your Pipfile requires python_version 3.6, but you are using 2.7.6 (/home/ubuntu/./p/bin/python).
$ pipenv check will surely fail.
```
It is asking me again if I want to install 3.6.2, even if it is installed already. It doesn't install it again though. So the path to 3.6.2 is there, but it is not being used by pipenv.

Could this be the problem then? Warning: The Python you just installed is not available on your PATH, apparently., but it shouldn't, pipenv should be able to grab the path from pyenv. What do you think? This works: pipenv --python ~/.pyenv/versions/3.6.2/bin/python, but pipenv --python 3.6.2 should also work.

Thank you very much for all your hard work, I've been following pipenv's development on Twtitter! It is kinda hard for me to move away from pip and virtualenvwrapper, but I think pipenv has great potential and I am willing to give it a try! :+1:

Most helpful comment

Make sure you have PYENV_ROOT in your environment.

All 4 comments

it sounds like your shell is messed up.

Make sure you have PYENV_ROOT in your environment.

Thank you very much @kennethreitz ! That was the problem. Everything works now.
I opened a pr to improve this a little bit: https://github.com/kennethreitz/pipenv/pull/719
What do you think?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AkiraSama picture AkiraSama  Â·  3Comments

xi picture xi  Â·  3Comments

FooBarQuaxx picture FooBarQuaxx  Â·  3Comments

konstin picture konstin  Â·  3Comments

ipmb picture ipmb  Â·  3Comments