learnables / learn2learn

A PyTorch Library for Meta-learning Research
http://learn2learn.net
MIT License
2.59k stars 348 forks source link

Cant recognize PyTorch installed from conda #408

Open hans66hsu opened 1 year ago

hans66hsu commented 1 year ago

My environment already has Pytorch(1.12.1) installed with conda.

pytorch 1.12.1 py3.10_cuda11.3_cudnn8.3.2_0 pytorch pytorch-cluster 1.6.0 py310_torch_1.12.0_cu113 pyg pytorch-mutex 1.0 cuda pytorch pytorch-scatter 2.1.0 py310_torch_1.12.0_cu113 pyg pytorch-sparse 0.6.16 py310_torch_1.12.0_cu113 pyg

While I run pip install learn2learn the wheel cant recognize the existing pytorch and installed another new one (Pytorch 2.0.1). It should be "satisfied" instead of "collecting" if the package was recognized.

Collecting torch>=1.1.0 (from learn2learn) Using cached torch-2.0.1-cp310-cp310-manylinux1_x86_64.whl (619.9 MB) Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /media/storage/dl_env/miniforge3/envs/DC_50/lib/python3.10/site-packages (from torchvision>=0.3.0->learn2learn) (9.5.0)

At the end, my original PyTorch was removed due to conflicts.

Attempting uninstall: torch Found existing installation: torch 1.12.1 Uninstalling torch-1.12.1: Successfully uninstalled torch-1.12.1

The output of which -a pip:

...../miniforge3/envs/DC_50/bin/pip

The reason I need PyTorch 1.12.1 is for compatibility with other learning framework packages (such as PyG). Do you know any reasons why it can't recognize the already installed PyTorch?

seba-1511 commented 1 year ago

Hello @hans66hsu,

I'm not sure why this is happening, maybe try to reinstall the PyTorch version you'd like to use? learn2learn should be compatible with any pytorch>=1.1.0 (which is what we specify in the requirements).

hans66hsu commented 1 year ago

I suspected it's because PyTorch is named "pytorch" instead of "torch" when installing from conda. I solved it by removing torch and torchvision in setup.py and built it in pip install -e . It would be nice if a conda version can be released in the future.