Installation problem (OSError: [Errno 2])


I am having trouble installing torch. Here is the error:

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\h_bas\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages\\caffe2\\python\\serialized_test\\data\\operator_test\\'

OS: Windows 10 21H1 (build 19043.1202)
pip version: 21.2.3
Python version: 3.9.7

I’ve been looking for fixes, but I couldn’t find anything.
Would anyone have a solution? (Sorry if this as already been posted somewhere here)
If anyone has more questions on my setup I’ll be happy to provide more info.

Thank you.

PS: This is what I am running to install

pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio===0.9.0 -f

NVIDIA-SMI: 471.96
CUDA Version: 11.4


Hi, this usually happens because the file path is too big. You can try the following link to increase the acceptable length of file path.

1 Like

Thanks a lot that fixed it!