Search code examples
pythonpipcondapython-packagingrequirements.txt

pip installing environment.yml as if it's a requirements.txt


I have an environment.yml file, but don't want to use Conda:

name: foo
channels:
  - defaults
dependencies:
  - matplotlib=2.2.2

Is it possible to have pip install the dependencies inside an environment.yml file as if it's a requirements.txt file?

I tried pip install -r environment.yml and it doesn't work with pip==22.1.2.


Solution

  • No, pip does not support this format. The format it expects for a requirements file is documented here. You'll have to convert the environment.yml file to a requirements.txt format either manually or via a script that automates this process. However, keep in mind that not all packages on Conda will be available on PyPI.