Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: can we pass extra-url to the env.yaml? #452

Open
LumenYoung opened this issue Mar 20, 2024 · 3 comments
Open

Question: can we pass extra-url to the env.yaml? #452

LumenYoung opened this issue Mar 20, 2024 · 3 comments

Comments

@LumenYoung
Copy link

LumenYoung commented Mar 20, 2024

Hi, thanks for this great development environment.

I would like to ask a question regarding the pip install supported in the env.yaml, this a thing because the pip and conda way of installing pytorch sometimes lead to undesired cpu version. So I use the following way to enforce a pytorch vision suitable for my need as following: pip install torch==2.1.2+cu121 torchvision==0.17.1+cu121 --extra-index-url https://download.pytorch.org/whl/cu121

In the normal micromamba, I can just use command line interface, but since micromamba way of installing only support env.yaml. I would like to ask whether I have a way to pass that to a pip field?

Something like:

name: robodiff
channels:
  - pytorch
  - nvidia
  - conda-forge
dependencies:
  - python=3.9
  - pip=22.2.2
  - pip:
    - torch==2.1.2+cu121 --extra-index-url https://download.pytorch.org/whl/cu121

I've looked at the docs and find no mention of this question, please correct me if I'm wrong. Thanks for all the help in advance!

@wholtz
Copy link
Member

wholtz commented Mar 20, 2024

Hello @LumenYoung,

I was able to create your environment using this:

name: robodiff
channels:
  - pytorch
  - nvidia
  - conda-forge
dependencies:
  - python=3.9
  - pip=22.2.2
  - pip:
    - torch==2.1.2+cu121
    - --extra-index-url=https://download.pytorch.org/whl/cu121

If those are the only things going into your environment, then there is no need to have the channels pytorch and nvidia, but maybe you want them for a later step?

@LumenYoung
Copy link
Author

Hello @LumenYoung,

I was able to create your environment using this:

name: robodiff
channels:
  - pytorch
  - nvidia
  - conda-forge
dependencies:
  - python=3.9
  - pip=22.2.2
  - pip:
    - torch==2.1.2+cu121
    - --extra-index-url=https://download.pytorch.org/whl/cu121

If those are the only things going into your environment, then there is no need to have the channels pytorch and nvidia, but maybe you want them for a later step?

Hi, thanks for the reply Will! I'm actually surprised that this works.

I was just cutting this config short to make an illustration. I'm actually very curious on how this pip field is parsed, because there are other packages that will be installed by pip, they not necessarily want to be affected by the --extra-index-url flag. Is it possible to have multiple pip field or to confine its affect field?

@wholtz
Copy link
Member

wholtz commented Mar 20, 2024

When instantiating a environment from a yaml file with a - pip: section, pip will be executed only once.

You can do this:

name: robodiff
channels:
  - pytorch
  - nvidia
  - conda-forge
dependencies:
  - python=3.9
  - pip=22.2.2
  - pip:
    - https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp39-cp39-linux_x86_64.whl

But I understand that isn't as nice, as it is specific to the CPU architecture and you must pin to an exact version.

You don't have to use a YAML file to define your environment (documentation). Or your can use a YAML file to install your conda packages and then call pip directly multiple times from within your activated conda environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants