I have windows 10. I have completed installing Tensorflow. It works. It says "Hello Tensorflow!". But it has all of this before it:
2018-08-18 18:16:01.500579: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-08-18 18:16:01.769002: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1405] Found device 0 with properties: name: GeForce GTX 950 major: 5 minor: 2 memoryClockRate(GHz): 1.3545 pciBusID: 0000:01:00.0 totalMemory: 2.00GiB freeMemory: 1.64GiB
2018-08-18 18:16:01.774030: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1484] Adding visible gpu devices: 0
2018-08-18 18:16:02.095489: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-08-18 18:16:02.099093: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0
2018-08-18 18:16:02.100631: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 0: N
2018-08-18 18:16:02.102156: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1401 MB memory) -> physical GPU (device: 0, name: GeForce GTX 950, pci bus id: 0000:01:00.0, compute capability: 5.2) Hello Tensorflow!
Process returned 0 (0x0) execution time : 2.327 s Press any key to continue
When I type pip3 install --upgrade tensorflow-gpu
in cmb, both administrative and normal I get this:
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\users\\dylan\\appdata\\local\\programs\\python\\python35\\Lib\\site-packages\\numpy\\.libs\\libopenblas.BNVRK7633HSX7YVO2TADGR4A5KEKXJAW.gfortran-win_amd64.dll'
Consider using the `--user` option or check the permissions.
Please help me out. Not a computer Scientist or an Engineer. But I code for fun.
This question is related to
tensorflow
Upgrading pip in windows with -
python -m pip install --upgrade pip
and then running pip install with --user option -
pip install --user package_name
solved my problem.
I needed to install from a requirements file and was getting this error, but did not want to use the --user
option because I didn't want to install it the location described by @not2qubit. So I ran CMD as administrator and then enabled sharing of the following directory (right click > properties > Sharing > Share...):
C:\Users\<my user name>\AppData\Local\Temp
After doing this, I was able to install from my requirements file into the application directory (where I wanted it) instead of the crazy ..\AppData
dir without the error.
When all of the mentioned methods failed, I was able to install scikit-learn
by following the instructions from the official site https://scikit-learn.org/stable/install.html.
It can happen that pip fails to install packages when reaching the default path size limit of Windows if Python is installed in a nested location such as the AppData folder structure under the user home directory, for instance:
Collecting scikit-learn
...
Installing collected packages: scikit-learn
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\\sklearn\\datasets\\tests\\data\\openml\\292\\api-v1-json-data-list-data_name-australian-limit-2-data_version-1-status-deactivated.json.gz'
In this case it is possible to lift that limit in the Windows registry by using the regedit tool:
Type “regedit” in the Windows start menu to launch regedit.
Go to the Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
key.
Edit the value of the LongPathsEnabled
property of that key and set it to 1.
Reinstall scikit-learn (ignoring the previous broken installation):
pip install --exists-action=i scikit-learn
This should work.
pip install --user <package_name>
For me (in windows), I had to restart the terminal and run it as Administrator (if you are using pycharm terminal, simply close pycharm, and reopen it as administrator then try again), That's solved the problem and installation succeed.
Good luck
I had the same issue while adding Flask. So used one of the above command.
pip install --ignore-installed --upgrade --user flask
Got only a small warning and it worked!!
Installing collected packages: click, MarkupSafe, Jinja2, itsdangerous, Werkzeug, flask WARNING: The script flask.exe is installed in 'C:\Users\Admin\AppData\Roaming\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 Werkzeug-1.0.1 click-7.1.2 flask-1.1.2 itsdangerous-1.1.0 WARNING: You are using pip version 20.1.1; however, version 20.2 is available. You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.
I used this command and it worked:
python -m pip install --user --upgrade pip
You should run the Command Prompt as Administrator.
As it is mentioned in the error that there is no --user so you have to follow these steps
I solved this by reopening cmd in administration mode, activating virtual env, and installing again.
This was with Tensorflow 2.3.0 in a virtual environment.
run the same command using '--user'
This should work
pip install --user requests
try this in windows:
pip install -U <Package_Name>
This is worked in my case:
pip install --user --upgrade pip
Otherwise open command prompt with Run as administrator and do the same thing.
In my case, I disabled McAfee and then successfully installed tensorflow2.0 RC
Worked with this command
python -m pip install --user --upgrade pip
Just type the command you want execute with the user permission, if you don't want to change the permission:
pip3 install --upgrade tensorflow-gpu --user
Try this if nothing works incase of permission error, this will solve it.
sudo chown user -R env
as an example for my case
sudo chown ubuntu -R venv
Using an elevated command prompt worked wonders. All you have to do is run
pip install <package-name>
With an administrative privilege.
I experienced the same issue when trying to install tensorflow from a jupyter notebook using Anaconda. --user did not work.
conda install tensorflow
worked for me, and I didn't have to change any security settings.
just change the access permission, where the particular package is going to install.
In my case windows10:
TYPE CMD in search and when the command prompt appears in the BEST MATCH search result right-click on it and select 'Run as Administrator' when the user control window appears select 'Yes'. The command prompt window will appear and you should see "C:/WINDOWS/system32>"
at this point just type what you want, should work!
Running pip install
command with --user
argument resolved the issue
python -m pip install --upgrade pip --user
pip install --ignore-installed --upgrade --user tensorflow==2.0.1
Here 2.0.1 is the version of tensorflow.
I was upgrading tensorflow to 1.4.0 & was hitting my head on wall as this error was not solving, but finally solved it. Guess what?
One of my python script was running, and it was using tensorflow . Package installed successfully after closing it.
I found that if I run CMD as Administrator and run the command, I can install it without a problem. Try it and give me some feedback.
This is how I solved this issue.
downgrade to python 3.6.x 64bit. I installed3.6.8 64bit.
install virtualenv by pip install virtualenv
upgrade pip to the latest version, for me it’s 19.3
go to the folder you want to create a virtual environment and type virtualenv ENV after created the virtual environment, go to the subfolder \PATH\ENV\Script and execute activate.bat. Now you will be in the virtual environment.
pip install rasa The problem is tensorflow 15 requires 64 bit python with no more than 3.6
Oh my. There are so many bad answers here. Well meaning but misleading. I am usually fine with dealing with permissions on Mac/Linux. Windows is new to me these days. This is the problem I had.
activate
my virtualenv - failed. Needs Scope to run powershell. Windows is helpful and tell you exactly the command you need to run to allow .ps to run. Sort of like chmod
but with execution scope
which I think is good....site-packages/
In my case I suspect it's OneDrive or some permission inheritence.The ideal way forward is to check permissions. This is hard but you are a Python developer are you not! First check your own user.
whoami
e.g. mycomputer\vangelGet-Acl <path which is an issue>
whoami
user explicity with full permissions. then applied to all objects.Dont do these without verifying the below steps. Read the message carefully.
By no means it is the solution for all permissions issues that may affect you. I can only provide guidance on how to troubleshoot and hopefully you resolve.
setting --user
flag is not necessary anywhere, if it works good for you. But you still do not know what went wrong.
More steps:
Try removing a package and installing it.
pip uninstall requests
pip install requests
This works, yet I get permission issue for a specific package.
Turns out, Windows gives permission error when the file is locked by a process. Python reports it as [Winerror 5]
and I could not easily find that documentation reference anyway. lets test this theory.
I find the exact file that gets permission error. Hit delete. Sure enough Windows window
prompt that its open in python
Of course it is.
I hit end task
on all python It has worked since 1996. But I waited a few seconds just in case some process is launching python. Checked Task manager
all good.
Having failed 20 times in getting pip to install the specific azureml package I was feeling pretty sure this resolved it.
I ran my pip install and it installed perfectly fine.
Moral of the story: Understand what you are doing before copy pasting from Stackoverflow. All the best.
p.s. Please stop installing Python or its packages as administrator. We are past that since 2006
Step 1 - Open anaconda prompt with administrator privileges.
Step 2 - check pip version pip --version
Step 3 - enter this command
**python -m pip install --upgrade pip**
Source: Stackoverflow.com