Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify pip --extra-index-url in environment.yml?

Tags:

python

pip

conda

Conda can create an environment.yml that specifies both conda packages & pip packages. The problem is, I want to specify a pip package (torch==1.12.1+cu116), that is only available in the following index: https://download.pytorch.org/whl/cu116.

How can I specify this in the environment.yml? Or at the very least, when running conda env create -f environment.yml, I would like to specify the extra index for pip.

like image 302
Roymunson Avatar asked Dec 06 '25 06:12

Roymunson


1 Answers

This configuration should work, see the advanced-pip-example for other options.

name: foo
channels:
  - defaults
dependencies:
  - python
  - pip
  - pip:
    - --extra-index-url https://download.pytorch.org/whl/cu116
    - torch==1.12.1+cu116

See also

  • Combining conda environment.yml with pip requirements.txt
  • Can conda be configured to use a private pypi repo?
like image 194
Romain Avatar answered Dec 08 '25 19:12

Romain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!