-
Notifications
You must be signed in to change notification settings - Fork 4
Description
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
cv2module 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.