Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytorch cannot be installed under Windows 10 if Python 3.7 was installed from Microsoft Store #23823

JonasHeidelberg opened this issue Aug 5, 2019 · 2 comments


Copy link

commented Aug 5, 2019

Issue description

pytorch 1.1.0 cannot be installed under Windows 10 if Python 3.7 was installed from Microsoft Store.

The reason is a combination of
a) long Python installation path used by Microsoft Store installer
b) long filename path used within pytorch for
c) by default, Windows 10 still refuses paths longer than 256 characters

Code example

pip3 install
fails with an error message:

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

The error is caused by the 256 character limit on Windows paths. With a file and pathname so long, no matter how short is the path is 257 characters or longer.

System Info

PyTorch version: 1.1.0
OS: Microsoft Windows 10 Pro, Version 1903
Python version: 3.7

Versions of relevant libraries:
[pip3] numpy==1.17.0
[pip3] torch==1.1.0
[pip3] torchvision==0.3.0


This comment has been minimized.

Copy link

commented Aug 5, 2019

I am not the first or only one to have this problem, see .
A workaround is to tell Windows to accept long paths, see here. However, this requires people to search for the error message online and find this. A more convenient solution implementable in pytorch could be to simply rename the file to something shorter? I know this only reduces the problem a little, since users with long usernames can still run into such a problem.

A more clean solution would be to have whichever tool fails to unpack that file throw a more meaningful error. Just some thoughts...

@ailzhang ailzhang added the triaged label Aug 7, 2019


This comment has been minimized.

Copy link

commented Sep 2, 2019

This problem also occurs in my Windows OS 18965.1005.

And I fix this bug refers to upper link

The problem is caused by the Long Path Name of

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.