Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am trying to create a conda environment using the following environment.yml file:

conda env create -n med -f environment.yml

File contents:

name: med
channels: 
  - defaults
  - conda-forge
dependencies: 
  - python=3.8
  - batchgenerators==0.23
  - pandas==1.1.5
  - SimpleITK==2.2.1
  - tensorboard==2.11.0
  - tqdm
  - pip
  - pip: 
    - --extra-index-url https://download.pytorch.org/whl/cu117
    - torch==1.13.1+cu117
    - torchvision==0.14.1+cu117

The setup fails with:

ResolvePackageNotFound:
- batchgenerators

If I delete batchgenerators from the yml file, create the environment, conda activate it and try pip install batchgenerators - it is successful.

Further, using pip also works

conda create -n med 
conda activate med
pip install -r requirements.txt
batchgenerators==0.23
pandas==1.1.5
SimpleITK==2.2.1
tensorboard==2.11.0
torch==1.13.1+cu117
torchvision==0.14.1+cu117

Any suggestions to make conda work directly? Thanks, Bogdan

Seems like there is no package "batchgenerators" in the default and conda-forge channels. You can ensure it at anaconda.org and conda-forge.org. It is a common case that there are packages in pypi and not in conda. – griko Dec 20, 2022 at 21:14 Try to put the "batchgenerators" in the "- pip:" section (where the installation of a specific torch version is declared) – griko Dec 20, 2022 at 21:16

Thanks to @griko! Adding batchgenerators to the yml file fixed the issue because the package is available on pypi but not in conda defaults or conda forge.

- pip: 
  - --extra-index-url https://download.pytorch.org/whl/cu117
  - torch==1.13.1+cu117
  - torchvision==0.14.1+cu117
  - batchgenerators==0.23
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.