Conda: BUG: Conda ignores python version while creating environment from file

Created on 28 Feb 2017  路  3Comments  路  Source: conda/conda

Dear all, I've noticed that conda ignores python parameters while giving packages in file, for example the command:

$ conda create -n env_name python=2.7 --file ci/conda_requirements.txt

will fetch py3.6 packages instead of py27. This thing happens also for other python versions (3.5, 3.4). However when creating an evironment without file like:

$ conda create -n env_name python=2.7

conda creates the corrected 2.7 environment. This is the content of ci/conda_requirements.txt file:

pip
numpy
scipy
matplotlib
pandas
nose
pep8
ipython
pyflakes
flake8
python-dateutil
decorator

And this is my conda configuration:

Current conda install:

               platform : linux-64
          conda version : 4.3.13
       conda is private : False
      conda-env version : 4.3.13
    conda-build version : not installed
         python version : 3.4.5.final.0
       requests version : 2.13.0
       root environment : /root/miniconda3  (writable)
    default environment : /root/miniconda3
       envs directories : /root/miniconda3/envs
                          /root/.conda/envs
          package cache : /root/miniconda3/pkgs
                          /root/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : None
           offline mode : False
             user-agent : conda/4.3.13 requests/2.13.0 CPython/3.4.5 Linux/3.16.0-4-amd64 debian/wheezy/sid glibc/2.15
                UID:GID : 0:0

Thank you for your support!
Regards,
Paolo

source-community type-bug

Most helpful comment

In this case, as a workaround, I usually first create the env with just the right Python version and then add the packages from my requirements file:

conda create -n myenv python=2.7
conda install -n myenv --file=requirements.txt

Make sure to not add python to the requirements file.

All 3 comments

A small workaround for this issue is to specify at least one of the packages listed in the file with the complete python2.7 build string. For example:

(root) [root@bd715d11a33c ~]$ cat /tmp/z
pip
numpy
scipy
matplotlib
pandas=0.19.2=np112py27_1
nose
pep8
ipython
pyflakes
flake8
python-dateutil
decorator
(root) [root@bd715d11a33c ~]$ conda create -n blah --file /tmp/z
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /conda/envs/blah:

The following NEW packages will be INSTALLED:

    backports:         1.0-py27_0        
    cairo:             1.14.8-0          
    configparser:      3.5.0-py27_0      
    cycler:            0.10.0-py27_0     
    dbus:              1.10.10-0         
    decorator:         4.0.11-py27_0     
    enum34:            1.1.6-py27_0      
    expat:             2.1.0-0           
    flake8:            3.3.0-py27_0      
    fontconfig:        2.12.1-3          
    freetype:          2.5.5-2           
    functools32:       3.2.3.2-py27_0    
    get_terminal_size: 1.0.0-py27_0      
    glib:              2.50.2-1          
    gst-plugins-base:  1.8.0-0           
    gstreamer:         1.8.0-0           
    icu:               54.1-0            
    ipython:           5.3.0-py27_0      
    ipython_genutils:  0.1.0-py27_0      
    jpeg:              9b-0              
    libffi:            3.2.1-1           
    libgcc:            5.2.0-0           
    libgfortran:       3.0.0-1           
    libiconv:          1.14-0            
    libpng:            1.6.27-0          
    libxcb:            1.12-1            
    libxml2:           2.9.4-0           
    matplotlib:        2.0.0-np112py27_0 
    mccabe:            0.6.1-py27_0      
    mkl:               2017.0.1-0        
    nose:              1.3.7-py27_1      
    numpy:             1.12.0-py27_0     
    openssl:           1.0.2k-1          
    pandas:            0.19.2-np112py27_1
    path.py:           10.1-py27_0       
    pathlib2:          2.2.0-py27_0      
    pcre:              8.39-1            
    pep8:              1.7.0-py27_0      
    pexpect:           4.2.1-py27_0      
    pickleshare:       0.7.4-py27_0      
    pip:               9.0.1-py27_1      
    pixman:            0.34.0-0          
    prompt_toolkit:    1.0.9-py27_0      
    ptyprocess:        0.5.1-py27_0      
    pycairo:           1.10.0-py27_0     
    pycodestyle:       2.3.1-py27_0      
    pyflakes:          1.5.0-py27_0      
    pygments:          2.2.0-py27_0      
    pyparsing:         2.1.4-py27_0      
    pyqt:              5.6.0-py27_2      
    python:            2.7.13-0          
    python-dateutil:   2.6.0-py27_0      
    pytz:              2016.10-py27_0    
    qt:                5.6.2-3           
    readline:          6.2-2             
    scandir:           1.5-py27_0        
    scipy:             0.18.1-np112py27_1
    setuptools:        27.2.0-py27_0     
    simplegeneric:     0.8.1-py27_1      
    sip:               4.18-py27_0       
    six:               1.10.0-py27_0     
    sqlite:            3.13.0-0          
    subprocess32:      3.2.7-py27_0      
    tk:                8.5.18-0          
    traitlets:         4.3.2-py27_0      
    wcwidth:           0.1.7-py27_0      
    wheel:             0.29.0-py27_0     
    zlib:              1.2.8-3 

In this case, as a workaround, I usually first create the env with just the right Python version and then add the packages from my requirements file:

conda create -n myenv python=2.7
conda install -n myenv --file=requirements.txt

Make sure to not add python to the requirements file.

Dear all, thank you for your replies. At the moment, I create the python environment in two steps, as suggested by @wulmer ; I'm waiting for conda updates.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

readmanchiu picture readmanchiu  路  3Comments

jkarimi91 picture jkarimi91  路  3Comments

mhlr picture mhlr  路  3Comments

mathoha picture mathoha  路  3Comments

gnomic picture gnomic  路  3Comments