Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning after I run the command "conda env create -f environment.yml"

After I run the conda env create -f environment.yml in Conda, I receive the following warning:

Warning : you have pip-installed dependencies in your environment file, but you do not list pip itself as one of your conda dependencies...

What does this mean and what should I be doing instead?

like image 298
QMarkLi Avatar asked Oct 24 '19 15:10

QMarkLi


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 environment yml?

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 you activate an already created conda environment?

To activate your Conda environment, type source activate <yourenvironmentname> . Note that conda activate will not work on Discovery with this version. To install a specific package, type conda install -n <yourenvironmentname> [package] . To deactivate the current, active Conda environment, type conda deactivate .


2 Answers

When creating an environment the warning disappeared by including - pip explicitly in the yaml file. Yes, it is a bit awkward because if your environment has pip packages you already have declared that you used pip packages with - pip:
The yaml file would look like:

# Packages omitted for simplicity
name: myenv
channels:
  - anaconda
  - conda-forge
  - defaults
dependencies:
  - python
  - scipy
  - pip
  - pip:
    - datetime

At the time of creating a new environment from scratch this warming can be avoided by explicitly installing pip, for instance with: conda create -n env_with_pip python=3.7 numpy pip

like image 90
eliasmaxil Avatar answered Oct 05 '22 05:10

eliasmaxil


In your environment yml file under list of the packages you install through conda you must also add pip as a package to be installed. This installs the pip, and so you pip packages can be installed using this pip.

Previously pip was shipped with conda but now we have to explicitly install pip when using conda

like image 40
ArunJose Avatar answered Oct 05 '22 04:10

ArunJose