MiDaS
MiDaS copied to clipboard
ModuleNotFoundError: No module named 'torch'
Hi!
In a separate environment, the following packages are installed: pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch timm-0.5.4.tar.gz
After running commands : cd C:\Users\user\MiDaS python run.py --model_type dpt_hybrid
I receive a message:
raceback (most recent call last):
File "run.py", line 5, in
pytorch was not installed correctly in your environment, or your not in the desired environment.
Search something like check if pytorch is installed
On Sat., Feb. 5, 2022, 8:20 a.m. lednevandrey04, @.***> wrote:
Hi!
In a separate environment, the following packages are installed: pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch timm-0.5.4.tar.gz
After running commands : cd C:\Users\user\MiDaS python run.py --model_type dpt_hybrid
I receive a message: raceback (most recent call last): File "run.py", line 5, in import torch ModuleNotFoundError: No module named 'torch'
— Reply to this email directly, view it on GitHub https://github.com/isl-org/MiDaS/issues/156, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTZOGF6NDCFZMU5XJXZQ7TUZU52VANCNFSM5NUCKW5A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Now I'm in desired environment.
(firstenv) PS C:\Users\user\MiDaS> python run.py --model_type dpt_hybrid
And I get a message:
Traceback (most recent call last):
File "C:\Users\user\MiDaS\run.py", line 6, in
import utils
File "C:\Users\user\MiDaS\utils.py", line 6, in
import cv2
ModuleNotFoundError: No module named 'cv2'
Cv2 is opencv, opencv-python is the package to install through pip
On Sat., Feb. 5, 2022, 11:45 a.m. lednevandrey04, @.***> wrote:
Now I'm in desired environment.
(firstenv) PS C:\Users\user\MiDaS> python run.py --model_type dpt_hybrid And I get a message: Traceback (most recent call last): File "C:\Users\user\MiDaS\run.py", line 6, in import utils File "C:\Users\user\MiDaS\utils.py", line 6, in import cv2 ModuleNotFoundError: No module named 'cv2'
— Reply to this email directly, view it on GitHub https://github.com/isl-org/MiDaS/issues/156#issuecomment-1030678423, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTZOGCOH7EAAECRRYGA3CTUZVV4ZANCNFSM5NUCKW5A . You are receiving this because you commented.Message ID: @.***>
(firstenv) C:\Users\user\MiDaS>python run.py --model_type dpt_hybrid
And I get a message:
Traceback (most recent call last):
File "C:\Users\user\MiDaS\run.py", line 11, in
What directory are you running it from? You should be in the same directory as the run.py file.
On Sat., Feb. 5, 2022, 12:49 p.m. lednevandrey04, @.***> wrote:
(firstenv) C:\Users\user\MiDaS>python run.py --model_type dpt_hybrid
And I get a message:
Traceback (most recent call last): File "C:\Users\user\MiDaS\run.py", line 11, in from midas.dpt_depth import DPTDepthModel ModuleNotFoundError: No module named 'midas'
— Reply to this email directly, view it on GitHub https://github.com/isl-org/MiDaS/issues/156#issuecomment-1030688192, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTZOGE2T7RD3L5ULCFEBSTUZV5LBANCNFSM5NUCKW5A . You are receiving this because you commented.Message ID: @.***>
(base) PS C:\Users\user> conda activate firstenv (firstenv) PS C:\Users\user> cd .\midas (firstenv) PS C:\Users\user\midas> dir
Каталог: C:\Users\user\midas
Mode LastWriteTime Length Name
d----- 04.02.2022 1:00 input d----- 04.02.2022 1:00 mobile d----- 04.02.2022 1:00 output d----- 04.02.2022 1:00 ros d----- 04.02.2022 1:00 tf d----- 04.02.2022 1:00 weights d----- 06.02.2022 0:38 pycache -a---- 09.06.2021 15:38 1233 .gitignore -a---- 09.06.2021 15:38 367 base_model.py -a---- 09.06.2021 15:38 9242 blocks.py -a---- 09.06.2021 15:38 901 Dockerfile -a---- 09.06.2021 15:38 3154 dpt_depth.py -a---- 09.06.2021 15:38 4929 hubconf.py -a---- 09.06.2021 15:38 1098 LICENSE -a---- 09.06.2021 15:38 2709 midas_net.py -a---- 09.06.2021 15:38 5207 midas_net_custom.py -a---- 24.09.2021 10:01 422509849 model-f6b98070.pt -a---- 24.09.2021 10:13 85761505 model-small-70d6b9c8.pt -a---- 09.06.2021 15:38 6625 README.md -a---- 09.06.2021 15:38 5865 run.py -a---- 09.06.2021 15:38 7869 transforms.py -a---- 09.06.2021 15:38 4583 utils.py -a---- 09.06.2021 15:38 14625 vit.py
(firstenv) PS C:\Users\user\midas> python run.py --model_type dpt_hybrid
Traceback (most recent call last):
File "C:\Users\user\midas\run.py", line 11, in
(firstenv) PS C:\Users\user\MiDaS\weights> dir
Каталог: C:\Users\user\MiDaS\weights
Mode LastWriteTime Length Name
------ 09.06.2021 15:38 0 .placeholder ------ 24.09.2021 23:16 492757791 dpt_hybrid-midas-501f0c75.pt ------ 24.09.2021 23:12 85761505 midas_v21_small-70d6b9c8.pt
(firstenv) PS C:\Users\user\MiDaS\weights>
(base) PS C:\Users\user> conda activate firstenv (firstenv) PS C:\Users\user> conda info
active environment : firstenv
active env location : C:\Users\user\miniconda3\envs\firstenv
shell level : 2
user config file : C:\Users\user\.condarc
populated config files : C:\Users\user.condarc conda version : 4.10.3 conda-build version : not installed python version : 3.7.10.final.0 virtual packages : __cuda=11.6=0 __win=0=0 __archspec=1=x86_64 base environment : C:\Users\user\miniconda3 (writable) conda av data dir : C:\Users\user\miniconda3\etc\conda conda av metadata url : None channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\user\miniconda3\pkgs C:\Users\user.conda\pkgs C:\Users\user\AppData\Local\conda\conda\pkgs envs directories : C:\Users\user\miniconda3\envs C:\Users\user.conda\envs C:\Users\user\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.10.3 requests/2.25.1 CPython/3.7.10 Windows/10 Windows/10.0.19041 administrator : False netrc file : None offline mode : False
(firstenv) PS C:\Users\user> conda list
packages in environment at C:\Users\user\miniconda3\envs\firstenv:
Name Version Build Channel
blas 1.0 mkl ca-certificates 2021.10.8 h5b45459_0 conda-forge certifi 2021.10.8 py39hcbf5309_1 conda-forge cudatoolkit 11.3.1 h59b6b97_2 freeglut 3.2.1 h0e60522_2 conda-forge freetype 2.10.4 hd328e21_0 icu 68.2 h0e60522_0 conda-forge intel-openmp 2021.4.0 haa95532_3556 jasper 2.0.33 h77af90b_0 conda-forge jbig 2.1 h8d14728_2003 conda-forge jpeg 9d h2bbff1b_0 lerc 3.0 h0e60522_0 conda-forge libblas 3.9.0 1_h8933c1f_netlib conda-forge libcblas 3.9.0 5_hd5c7e75_netlib conda-forge libclang 11.1.0 default_h5c34c98_1 conda-forge libdeflate 1.8 h8ffe710_0 conda-forge liblapack 3.9.0 5_hd5c7e75_netlib conda-forge liblapacke 3.9.0 5_hd5c7e75_netlib conda-forge libopencv 4.5.5 py39h606fa8f_0 conda-forge libpng 1.6.37 h2a8f88b_0 libprotobuf 3.19.4 h7755175_0 conda-forge libtiff 4.3.0 hd413186_2 conda-forge libuv 1.40.0 he774522_0 libwebp 1.2.2 h57928b3_0 conda-forge libwebp-base 1.2.2 h8ffe710_1 conda-forge libzlib 1.2.11 h8ffe710_1013 conda-forge lz4-c 1.9.3 h2bbff1b_1 m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge mkl 2021.4.0 haa95532_640 mkl-service 2.4.0 py39h2bbff1b_0 mkl_fft 1.3.1 py39h277e83a_0 mkl_random 1.2.2 py39hf11a4ad_0 msys2-conda-epoch 20160418 1 conda-forge numpy 1.21.2 py39hfca59bb_0 numpy-base 1.21.2 py39h0829f74_0 olefile 0.46 pyhd3eb1b0_0 opencv 4.5.5 py39hcbf5309_0 conda-forge openssl 1.1.1l h8ffe710_0 conda-forge pillow 8.4.0 py39hd45dc43_0 pip 21.2.4 py39haa95532_0 py-opencv 4.5.5 py39h832f523_0 conda-forge python 3.9.7 h6244533_1 python_abi 3.9 2_cp39 conda-forge pytorch 1.10.2 py3.9_cuda11.3_cudnn8_0 pytorch pytorch-mutex 1.0 cuda pytorch qt 5.12.9 h5909a2a_4 conda-forge setuptools 58.0.4 py39haa95532_0 six 1.16.0 pyhd3eb1b0_0 sqlite 3.37.0 h2bbff1b_0 timm 0.5.4 pypi_0 pypi tk 8.6.11 h2bbff1b_0 torchaudio 0.10.2 py39_cu113 pytorch torchvision 0.11.3 py39_cu113 pytorch typing_extensions 3.10.0.2 pyh06a4308_0 tzdata 2021e hda174b7_0 vc 14.2 h21ff451_1 vs2015_runtime 14.27.29016 h5e58377_2 wheel 0.37.1 pyhd3eb1b0_0 wincertstore 0.2 py39haa95532_2 xz 5.2.5 h62dcd97_0 zlib 1.2.11 h8ffe710_1013 conda-forge zstd 1.5.2 h6255e5f_0 conda-forge (firstenv) PS C:\Users\user>
apparently the version of python installed in the environment, does not match the version of the python package
python version : 3.7.10.final.0
python 3.9.7 h6244533_1
???
You are missing a folder in your /users/user/midas
directory
d----- 04.02.2022 1:00 input d----- 04.02.2022 1:00 mobile d----- 04.02.2022 1:00 output d----- 04.02.2022 1:00 ros d----- 04.02.2022 1:00 tf d----- 04.02.2022 1:00 weights d----- 06.02.2022 0:38 pycache
There should be a folder called midas
where it wants to load a function from a file called dpt_depth
.py
If I'm reading this right, your system version of python is 3.7 and your environment version is 3.9. In the environment, if you go python --version
it should respond with:
Python 3.9.7
There is nothing wrong with having a newer python version in anaconda (unless too new for MiDaS, which is not the case currently). You could specify a specific version in anaconda; I sometimes specify 3.7 as I figure it is more compatible for older code repos.
Thank you for help !!!