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

Question:

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?

Asked By: QMarkLi

||

Answers:

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 your 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

Answered By: ArunJose

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

Answered By: eliasmaxil
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.