简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM