6
votes

I keep failing to run pip install on the tensorflow package. First it downloads the .whl file, then goes through a bunch of already satisfied requirements until it gets to installing collected packages: tensorflow, at which point here's the error I get:

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\Borik\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\tensorflow\\include\\external\\com_github_grpc_grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\client_load_reporting_filter.h'

I've never seen anything like this before and can't seem to find anything on the net. I'm using Windows 10 and the latest versions of Pyhton and pip.

2
I would ask if you installed Python separately, or if that is the default Python installation that comes with Windows? I would advise a fresh Python installation outside of AppData\Local. You also don't say if you are using pip from the command line, or from within an IDE. If you could add a fresh venv to go with it all the better... - bad_coder
I suspect the path is too long (291 characters). Try re-installing Python closer to the root of the filesystem. - phd
@phd is that safe? where would you re-install it to if you had to? - chocojunkie
@chocojunkie I almost never in my life use Windows but when I do (in a VirtualBox) I always install into the root. If I don't have write-access I'd try C:\Users\phd\Python38 - phd
@phd iwould it be possible to rename some of the folders instead? for instance, there's the AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0, maybe I could somehow change that last one to just Python - chocojunkie

2 Answers

23
votes

I hit the same issue on Win10. Rather than renaming my filesystem, I found a good solution in this Python documentation https://docs.python.org/3/using/windows.html. Follow the instructions to update your registry for MAX_PATH, changing it from 0 to 1. This extends path from char(256) to char(32000). After this change, my 'pip install tensorflow' succeeded.

0
votes