1

I am trying to install TensorFlow. I am using this command:

python3.7 -m pip install tensorflow

But every time I get this error:

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

It gets to the part where it says this:

Running setup.py install for termcolor ... done
Running setup.py install for wrapt ... done

Does anybody know how to fix this? In File Explorer, I looked up the directory. It said it didn't exist. But if you only use one / instead of two(//), it finds it. Any way I can have it use the correct directory?

JulienD
  • 7,102
  • 9
  • 50
  • 84
  • Make sure you are using Python 64-bit edition and you are running your command prompt as administrator/superuser. – Landon Aug 16 '20 at 02:20
  • Try this https://stackoverflow.com/questions/57727782/environmental-error-occurs-while-installing-tensorflow – hedy Aug 16 '20 at 02:21
  • And this https://github.com/tensorflow/tensorflow/issues/24835 – hedy Aug 16 '20 at 02:22

1 Answers1

3

This is likely due to path length limits on Windows.

Hit the Windows key, type gpedit.msc and press Enter.
Navigate to Local Computer Policy > Computer Configuration > Administrative 
Templates >    System > Filesystem.
Double click the Enable Win32 long paths option and enable it.

reference : longpathenable

Gautamrk
  • 1,144
  • 9
  • 12