Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pip install packages in a conda environment.yml file?

Tags:

python

conda

I get the following error when I run the below code:

name: myapp-env
dependencies:
- python=3.5
- pip
- django=1.8
- pip:
    - django-environ=0.4

Error:

yaml.scanner.ScannerError: while scanning for the next token
found character '\t' that cannot start any token
  in "<string>", line 7, column 1:
        - django-environ=0.4

What is the proper way to format the .yml file to pip install a package?

like image 996
blahblahblah Avatar asked Dec 16 '15 14:12

blahblahblah


People also ask

Should I use pip or conda to install packages?

It's fully recommended to use pip inside of conda. It's better to install using conda, but for any packages that don't have a conda build, it's perfectly acceptable to use pip.


2 Answers

It's quite explicit there: YAML (as implemented in pyyaml) forbids the use of tab-characters for indentation. Change that line to <space><space><space><space>- django-environ=0.4.

like image 152
filmor Avatar answered Sep 30 '22 00:09

filmor


I noticed my problem. I was using Sublime text and Indentation was set to Tab. I selected Convert Indentation to Spaces and it worked.

Also, the .yml file should be as follows (two == for pip package version).

name: myapp-env
dependencies:
- python=3.5
- pip
- django=1.8
- pip:
    - django-environ==0.4
like image 40
blahblahblah Avatar answered Sep 30 '22 00:09

blahblahblah