user6536435
user6536435

Reputation:

TypeError When Creating Conda Environment

I am attempting to create a conda environment from a yaml file with the following command:

conda env create -f myenv.yml python=3    

When my yaml file is written like this:

name: myenv
channels:
  - conda-forge
dependencies:
  - django=1.10.5
  - pip:
    - gunicorn==19.7.0
    - psycopg2==2.6.2

It works fine.

When my yaml file is written like this (without the conda-forge package/channel):

name: myenv
dependencies:
  - pip:
    - gunicorn==19.7.0
    - psycopg2==2.6.2

It generates the following error:

Traceback (most recent call last):
  File "/home/myuser/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 573, in conda_exception_handler
    return_value = func(*args, **kwargs)
  File "/home/myuser/anaconda3/lib/python3.6/site-packages/conda_env/cli/main_create.py", line 108, in execute
    installer.install(prefix, pkg_specs, args, env)
  File "/home/myuser/anaconda3/lib/python3.6/site-packages/conda_env/installers/pip.py", line 8, in install
    pip_cmd = pip_args(prefix) + ['install', ] + specs
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

I need to use the second yaml example without the conda-forge package.

Any advice?

Upvotes: 1

Views: 622

Answers (1)

Nehal J Wani
Nehal J Wani

Reputation: 16639

IMO, this looks like a bug in conda. However, you can get around this by adding pip as a dependency. So, make sure the file myenv.yml has the following contents:

name: myenv
dependencies:
  - pip=9.0.1=py27_1
  - pip:
    - gunicorn==19.7.0
    - psycopg2==2.6.2

Upvotes: 1

Related Questions