I’d been trying to install Tensorflow on my Windows 10 machine for a couple days. It’s quite frustrating when it doesn’t work. All of the stackoverflow answers were the same: uninstall tensorflow and reinstall. Not helpful and didn’t work. I should point out I’m running PowerShell as well. I wanted my code for my project to work across platforms. So regular command line is out.
First I had to download the whl from https://www.tensorflow.org/install/pip – then I ran pip3 install the name of the downloaded whl. Select your platform (Windows, Linux, Mac, etc).
Next when running the install I would get this error:
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: ‘C:\Users\<user>\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’
This error is caused by the path being too long. So you can either change the path so it’s installed elsewhere or simply do windows+r to open the run command then type ‘regedit’ to open the Registry Editor. Then go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem - then set the key LongPathsEnabled to 1 and save that's it. Run the pip3 install tensorflow... and it should install correctly without errors.