umyelab / LabGym

Quantify user-defined behaviors.
GNU General Public License v3.0
64 stars 5 forks source link

Unable to install detectron2 #169

Closed nagoue closed 2 months ago

nagoue commented 2 months ago

Hi, I would need help to solve an issue with the installation of detectron. I use OS Ubuntu 22.04, and for the moment I wish to use LabGym with CPU only My commands are:

conda create -y -n LabGym python=3.10 setuptools==69.5.1
python3 -m pip install LabGym
python3 -m pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cpu
python3 -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

The error message is:

error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [8 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-req-build-iryp08aw/setup.py", line 11, in from torch.utils.cpp_extension import CUDA_HOME, CppExtension, CUDAExtension File "/home/ubuntu/.local/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 25, in from pkg_resources import packaging # type: ignore[attr-defined] ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/ubuntu/.local/lib/python3.10/site-packages/pkg_resources/init.py) [end of output]

I initially tried without fixing setuptools package version (so using version 70.2.0). I also tried those installations: pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.6' pip install 'git+https://github.com/facebookresearch/detectron2.git@a59f05630a8f205756064244bf5beb8661f96180' I also tried passing by pipx All my tests ended with the same error message as above.

I would appreciate any help. Thanks !

yujiahu415 commented 2 months ago

Hi,

Can you try these steps:

  1. upgrade setuptools, wheel, and pip python3 -m pip install --upgrade setuptools wheel pip

  2. upgrade PyTorch to v2.3.1 python3 -m pip install torch==2.3.1

  3. install Detectron2 python3 -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

  4. then downgrade PyTorch to v2.0.1 again python3 -m pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cpu

And let me know whether this addresses the issue. Thank you!

nagoue commented 2 months ago

Hi,

Thank you so much for your fast reply and solution. I could complete the installation to the end.

Cheers,

De: "Yujia Hu" @.> À: "umyelab/LabGym" @.> Cc: "Nadia GOUE" @.>, "Author" @.> Envoyé: Jeudi 11 Juillet 2024 17:15:52 Objet: Re: [umyelab/LabGym] Unable to install detectron2 (Issue #169)

Hi,

Can you try these steps:

1. 

upgrade setuptools, wheel, and pip python3 -m pip install --upgrade setuptools wheel pip

upgrade PyTorch to v2.3.1 python3 -m pip install torch==2.3.1

install Detectron2 python3 -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

then downgrade PyTorch to v2.0.1 again python3 -m pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cpu

And let me know whether this addresses the issue. Thank you!

— Reply to this email directly, [ https://github.com/umyelab/LabGym/issues/169#issuecomment-2223211690 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/ACE4IHQ2GVXMID7BRVFODRTZL2OSRAVCNFSM6AAAAABKXFSAE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTGIYTCNRZGA | unsubscribe ] . You are receiving this because you authored the thread. Message ID: <umyelab/LabGym/issues/169/2223211690 @ github . com>

yujiahu415 commented 2 months ago

Great! Thank you for letting me know this!