Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set optional arguments in the conda environment.yml file?

I am currently working with GeoPython - Auto GIS. After research on the work flow with conda+python, I have found out how to create and specify the packages in an environment.yml file. But I found no way to specify an optional arguement. An example is as follows,

The equivalent of this conda command

conda install -y -c conda-forge geopandas

is the following in environment.yml

name: parkar
channels:
- conda-forge
- defaults
dependencies:
- geopandas

(See how conda environment files are made at section Conda Environment Files of this link)

But I could not find a way to specify the following command [a],

conda install -y -c conda-forge basemap=1.0.8.dev0 --no-deps

I did try it like this,

- basemap=1.0.8.dev0 --no-deps

But ended up with the following promt when I ran conda env update --file environment.yml

CondaValueError: invalid package specification: basemap=1.0.8.dev0 --no-deps

I also tried exporting the environment.yml file of the 'base' conda environment after running the above command [a] and got the following line where basemap=1.0.8.dev0 dependency was at,

  - basemap=1.0.8.dev0=np111py35_1

Any one ever encountered this problem or has a solution?

like image 508
Isuru Dharmadasa Avatar asked May 06 '18 04:05

Isuru Dharmadasa


People also ask

What is environment yml in conda?

yml file. Note that by convention Conda environment files are called environment. yml . As such if you use the conda env create sub-command without passing the --file option, then conda will expect to find a file called environment.

What is an environment yml file?

A . yml file is a text file that contains a list of dependencies and which channels you prioritize downloading them on. You can use the earth-analytics-python yaml file called environment.

How do I name a YAML file in a Conda environment?

conda env create --name NAME --file FILE where FILE is the YAML file and NAME is what you want to name the environment. (The accepted answer used to suggest conda create, but that only works on the output of conda list --explicit, not on Conda environment YAML files.)

How do I create an environment in conda?

Create the environment from the environment.yml file: conda env create -f environment.yml The first line of the yml file sets the new environment's name. For details see Creating an environment file manually.

Should the yml packages be installed to the created Conda env?

The packages listed in the yml should be installed to the created conda env, however they are not.

Can I install additional conda packages in a different environment?

Environments take up little space thanks to hard links. Care should be taken to avoid running pip in the root environment. Once pip has been used, conda will be unaware of the changes. To install additional conda packages, it is best to recreate the environment.


1 Answers

Specifying the optional argument as follows resulted in avoiding the above error

- basemap=1.0.8.dev0 [--no-deps]
like image 188
Isuru Dharmadasa Avatar answered Oct 23 '22 08:10

Isuru Dharmadasa