pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

pyenv virtualenv create a wrong version env

Open RonaldinhoL opened this issue 6 years ago • 4 comments

when i use pyenv virtualenv miniconda2-latest py27 i mean to create a env with python 2.7 same as miniconda2, but it create a env with python 3.7.1, is there something wrong?

i am run on mac 10.14.2, pyenv 1.2.8, pyenv-virtualenv 1.1.3 (conda unknown).

RonaldinhoL avatar Dec 21 '18 07:12 RonaldinhoL

the log:

$ pyenv virtualenv miniconda2-latest py27
Solving environment: done

## Package Plan ##

  environment location: /Users/xxx/.pyenv/versions/miniconda2-latest/envs/py27

  added / updated specs: 
    - python


The following NEW packages will be INSTALLED:

    ca-certificates: 2018.03.07-0           
    certifi:         2018.11.29-py37_0      
    libcxx:          4.0.1-hcfea43d_1       
    libcxxabi:       4.0.1-hcfea43d_1       
    libedit:         3.1.20170329-hb402a30_2
    libffi:          3.2.1-h475c297_4       
    ncurses:         6.1-h0a44026_1         
    openssl:         1.1.1a-h1de35cc_0      
    pip:             18.1-py37_0            
    python:          3.7.1-haf84260_7       
    readline:        7.0-h1de35cc_5         
    setuptools:      40.6.3-py37_0          
    sqlite:          3.26.0-ha441bb4_0      
    tk:              8.6.8-ha441bb4_0       
    wheel:           0.32.3-py37_0          
    xz:              5.2.4-h1de35cc_4       
    zlib:            1.2.11-h1de35cc_3      

Preparing transaction: done
Verifying transaction: done
Executing transaction: / yenv virtualenv miniconda2-latest pydone
#
# To activate this environment, use
#
#     $ conda activate py27
#
# To deactivate an active environment, use
#
#     $ conda deactivate

RonaldinhoL avatar Dec 21 '18 07:12 RonaldinhoL

I also faced this issue.

Got this error, so I install ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib? ➜ ~ sudo apt install libssl1.0-dev

After that

➜  ~ pyenv install 2.7.6
Installing Python-2.7.6...
patching file ./Modules/readline.c
patching file ./Lib/site.py
patching file ./Lib/ssl.py
Hunk #2 succeeded at 430 (offset -5 lines).
patching file ./Modules/_ssl.c
Hunk #2 succeeded at 307 (offset -1 lines).
Hunk #3 succeeded at 1809 (offset -3 lines).
patching file ./configure
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Installed Python-2.7.6 to /home/thoong/.pyenv/versions/2.7.6

➜  ~ pyenv versions
* system (set by /home/thoong/.python-version)
  2.7.6

➜  ~ pyenv virtualenv 2.7.6 new_virtual_env
/home/thoong/.local/lib/python2.7/site-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a 2.7.x release that supports hmac.compare_digest as soon as possible.
  utils.DeprecatedIn23,
Requirement already satisfied: virtualenv in ./.local/lib/python2.7/site-packages (16.1.0)
New python executable in /home/thoong/.pyenv/versions/2.7.6/envs/new_virtual_env/bin/python
Installing setuptools, pip, wheel...
done.
ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules For the system python are usually handled by dpkg and apt-get.

    apt-get install python-<module name>

Install the python-pip package to use pip itself.  Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.

Installing pip from https://bootstrap.pypa.io/get-pip.py...
Collecting pip
  Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-18.1

➜  ~ pyenv activate new_virtual_env
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(new_virtual_env) ➜  ~ python -V
Python 2.7.15rc1
(new_virtual_env) ➜  ~ 

Current version: pyenv 1.2.8

thoongnv avatar Dec 26 '18 16:12 thoongnv

I solved my problems by setting version before creating virtualenv

~ pyenv local 2.7.6
~ pyenv virtualenv new_virtual_env

thoongnv avatar Dec 27 '18 16:12 thoongnv

same error using miniconda2-latest to create env with python2 but got python3.

No use to setting version before creating virtualenv

haoliplus avatar Apr 28 '19 12:04 haoliplus