You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a few problems during the installation steps, specifically:
⏳ First conda command hangs indefinitely due to impossibility to solve CUDA Toolkit references.
🥥 It's not possible to import cv2 module due to version mismatching. This prevents to run the demo.
I've solved each issue as following.
Hope this helps. Cheers!
⏳ CUDA Toolkit installation hangs indefinitely
The command conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge does hang indefinitely.
Fix 1 (naive solution)
I removed the cudatoolkit=11.1 -c conda-forge part to let Pytorch install the requirements by itself.
Fix 2 (edit, as suggested here)
Avoid a direct reference to cudatoolkit by using a combined Pytorch+CUDA versioning: pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
🥥 OpenCV broken version
I wasn't able to run the demo, due to a broken cv2 import. This is the error:
Error processing line 1 of /home/marco/anaconda3/envs/poco/lib/python3.8/site-packages/distutils-precedence.pth:
Traceback (most recent call last):
File "/home/marco/anaconda3/envs/poco/lib/python3.8/site.py", line 177, in addpackage
exec(line)
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named '_distutils_hack'
Remainder of file ignored
Traceback (most recent call last):
File "demo.py", line 21, in <module>
import cv2
File "/home/marco/anaconda3/envs/poco/lib/python3.8/site-packages/cv2/__init__.py", line 190, in <module>
bootstrap()
File "/home/marco/anaconda3/envs/poco/lib/python3.8/site-packages/cv2/__init__.py", line 184, in bootstrap
if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
File "/home/marco/anaconda3/envs/poco/lib/python3.8/site-packages/cv2/__init__.py", line 37, in __load_extra_py_code_for_module
py_module = importlib.import_module(module_name)
File "/home/marco/anaconda3/envs/poco/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/marco/anaconda3/envs/poco/lib/python3.8/site-packages/cv2/typing/__init__.py", line 171, in <module>
LayerId = cv2.dnn.DictValue
AttributeError: module 'cv2.dnn' has no attribute 'DictValue'
Fix
As mentioned in this issue, changing opencv-python version to opencv-python==4.8.0.74 fixed the problem.
The text was updated successfully, but these errors were encountered:
If for some reason, conda indefinitely hangs for you, I would not recommend removing cudatoolkit=11.1 -c conda-forge, since it might install pytorch for different CUDA version. Instead, I would run this:
First of all, thanks for the hint on Pytorch+CUDA 👍🏼
I tried creating the enviroment a second time, however the process needs a little help because of the following issues:
The installation of the required modules via requirements.txt updates Pytorch to 2.4.0+cu121. To fix this and keep 1.8.0+cu111, I need to re-run the updated conda command you mentioned, that is after pip. To me, this issue suggests untracked incompatibilities among the packages.
Regarding opencv-python, I succesfully installed the correct module via the requirements file, and I confirm the version is the one written in the file, that is 4.5.5.64. This is the output of pip freeze | grep opencv:
Error processing line 1 of /home/marco/anaconda3/envs/poco2/lib/python3.8/site-packages/distutils-precedence.pth:
Traceback (most recent call last):
File "/home/marco/anaconda3/envs/poco2/lib/python3.8/site.py", line 177, in addpackage
exec(line)
File "<string>", line 1, in<module>
ModuleNotFoundError: No module named '_distutils_hack'
Remainder of file ignored
opencv-python==4.5.5.64
opencv-python-headless==4.10.0.84
As you can read, there is something weird happening when accessing the environment.
The above error related to distutils appears every time I open a Python terminal in this "fixed" environment.
Despite the right version of the modules, the error mentioned in my initial message is still there and I'm not able to run your code, even after following your Pytorch+CUDA fix and (1) forcing the version of Pytorch 🤷🏼
As of now, updating Pytorch and CUDA to 2.4.0+cu121 and OpenCV to 4.8.0.74 solved the installation, at least for the demo script.
I had a few problems during the installation steps, specifically:
cv2
module due to version mismatching. This prevents to run the demo.I've solved each issue as following.
Hope this helps. Cheers!
⏳ CUDA Toolkit installation hangs indefinitely
The command
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
does hang indefinitely.Fix 1 (naive solution)
I removed the
cudatoolkit=11.1 -c conda-forge
part to let Pytorch install the requirements by itself.Fix 2 (edit, as suggested here)
Avoid a direct reference to cudatoolkit by using a combined Pytorch+CUDA versioning:
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
🥥 OpenCV broken version
I wasn't able to run the demo, due to a broken
cv2
import. This is the error:Fix
As mentioned in this issue, changing
opencv-python
version toopencv-python==4.8.0.74
fixed the problem.The text was updated successfully, but these errors were encountered: