Search code examples
pythonpipconda-forge

Automating install of a mix of conda-forge and pip python libraries


I have a python package for which I need some other python libraries that are installed via conda-forge. However, it also needs a small number of libraries that are installed via pip. What is the best way to automate the installation of this mix of conda-forge and pip libraries when someone installs my package?


Solution

  • Conda's environment.yml file can take both conda dependencies and pip dependencies. I'll paste in from the docs:

    name: stats2
    channels:
      - javascript
    dependencies:
      - python=3.9
      - bokeh=2.4.2
      - numpy=1.21.*
      - nodejs=16.13.*
      - flask
      - pip
      - pip:
        - Flask-Testing
    

    The pip array at the end lists stuff you'd like to pull from PyPI rather than from conda repositories.