python tensorflow windows exception - python

Many thanks for reading this.
I tried searching but could not find an answer to this.
I have been trying to install tensorflow using pip on Windows 8.1 using python 3.5.2. I get this error.
C:\Users\Default.HP>pip3 install --upgrade tensorflow
Collecting tensorflow
Using cached tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
Collecting numpy>=1.11.0 (from tensorflow)
Using cached numpy-1.12.0-cp35-none-win_amd64.whl
Collecting six>=1.10.0 (from tensorflow)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting protobuf>=3.1.0 (from tensorflow)
Using cached protobuf-3.2.0-py2.py3-none-any.whl
Collecting wheel>=0.26 (from tensorflow)
Using cached wheel-0.29.0-py2.py3-none-any.whl
Collecting setuptools (from protobuf>=3.1.0->tensorflow)
Using cached setuptools-34.3.2-py2.py3-none-any.whl
Collecting appdirs>=1.4.0 (from setuptools->protobuf>=3.1.0->tensorflow)
Using cached appdirs-1.4.3-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools->protobuf>=3.1.0->tensorflow)
Using cached packaging-16.8-py2.py3-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools->protobuf>=3.1.0->tensorf
low)
Using cached pyparsing-2.2.0-py2.py3-none-any.whl
Installing collected packages: numpy, six, appdirs, pyparsing, packaging, setupt
ools, protobuf, wheel, tensorflow
Exception:
Traceback (most recent call last):
File "c:\program files\python35\lib\site-packages\pip\basecommand.py", line 20
9, in main
status = self.run(options, args)
File "c:\program files\python35\lib\site-packages\pip\commands\install.py", li
ne 317, in run prefix=options.prefix_path,
File "c:\program files\python35\lib\site-packages\pip\req\req_set.py", line 73
2, in install
**kwargs
File "c:\program files\python35\lib\site-packages\pip\req\req_install.py", lin
e 835, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\program files\python35\lib\site-packages\pip\req\req_install.py", lin
e 1030, in move_wheel_files isolated=self.isolated,
File "c:\program files\python35\lib\site-packages\pip\wheel.py", line 344, in
move_wheel_files
clobber(source, lib_dir, True)
File "c:\program files\python35\lib\site-packages\pip\wheel.py", line 315, in
clobber
ensure_dir(destdir)
File "c:\program files\python35\lib\site-packages\pip\utils\__init__.py", line
83, in ensure_dir
os.makedirs(path)
File "c:\program files\python35\lib\os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\Li
b\\site-packages\\numpy'
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
When trying to upgrade pip, I then get this error
C:\Users\Default.HP>python -m pip install --upgrade pip
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\shutil.py", line 538, in move
os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\li
b\\site-packages\\pip-8.1.1.dist-info\\description.rst' -> 'C:\\Users\\Default.H
P\\AppData\\Local\\Temp\\pip-0fd55_is-uninstall\\program files\\python35\\lib\\s
ite-packages\\pip-8.1.1.dist-info\\description.rst'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 20
9, in main
status = self.run(options, args)
File "C:\Program Files\Python35\lib\site-packages\pip\commands\install.py", li
ne 317, in run
prefix=options.prefix_path,
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_set.py", line 72
6, in install
requirement.uninstall(auto_confirm=True)
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", lin
e 746, in uninstall
paths_to_remove.remove(auto_confirm)
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_uninstall.py", l
ine 115, in remove
renames(path, new_path)
File "C:\Program Files\Python35\lib\site-packages\pip\utils\__init__.py", line
267, in renames
shutil.move(old, new)
File "C:\Program Files\Python35\lib\shutil.py", line 553, in move
os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\li
b\\site-packages\\pip-8.1.1.dist-info\\description.rst'
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
How can this be solved?
Many thanks.

This permission error arises when pip (running as a non-Administrator user) tries to upgrade a package that was installed by an Administrator user. There are two main workarounds:
Run the upgrade command using an Administrator command prompt.
Install TensorFlow into a virtualenv owned by the non-Administrator user.

For me the issue was with my internet connection.
Had lots of slide interruptions which would stop the process and trow those Exceptions.
So summary, Run the terminal as admin and make sure you have no network interruption during the download process.

Related

upgrading Pandas - PermissionError: [Errno 13] Permission denied: '/usr/local/lib64/python3.6/site-packages/numpy'

I have Pandas version 0.24.1 on Python2 :
Python version:
[user#localhost ~]$ python -V
Python 2.7.13
Pandas version:
>>> import pandas
>>> pandas.__version__
u'0.24.1'
but need to upgrade Pandas for Python3. I have tried to update Pandas using on the Linux terminal using:
pip3 install --upgrade pandas
However the following error was returned:
[user#localhost ~]$ pip3 install --upgrade pandas
Collecting pandas
Using cached https://files.pythonhosted.org/packages/e6/de/a0d3defd8f338eaf53ef716e40ef6d6c277c35d50e09b586e170169cdf0d/pandas-0.24.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting python-dateutil>=2.5.0 (from pandas)
Using cached https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl
Collecting pytz>=2011k (from pandas)
Using cached https://files.pythonhosted.org/packages/61/28/1d3920e4d1d50b19bc5d24398a7cd85cc7b9a75a490570d5a30c57622d34/pytz-2018.9-py2.py3-none-any.whl
Collecting numpy>=1.12.0 (from pandas)
Using cached https://files.pythonhosted.org/packages/f5/bf/4981bcbee43934f0adb8f764a1e70ab0ee5a448f6505bd04a87a2fda2a8b/numpy-1.16.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting six>=1.5 (from python-dateutil>=2.5.0->pandas)
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, pytz, numpy, pandas
Found existing installation: six 1.11.0
Uninstalling six-1.11.0:
Exception:
Traceback (most recent call last):
File "/usr/lib64/python3.6/shutil.py", line 544, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/usr/lib/python3.6/site-packages/__pycache__/six.cpython-36.pyc' -> '/tmp/pip-mq4rdaea-uninstall/usr/lib/python3.6/site-packages/__pycache__/six.cpython-36.pyc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
strip_file_prefix=options.strip_file_prefix,
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/usr/lib64/python3.6/shutil.py", line 559, in move
os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages/__pycache__/six.cpython-36.pyc'
I then tried : python3 -m pip install pandas
and received the same type of error:
[user#localhost ~]$ python3 -m pip install pandas
Collecting pandas
Using cached https://files.pythonhosted.org/packages/e6/de/a0d3defd8f338eaf53ef716e40ef6d6c277c35d50e09b586e170169cdf0d/pandas-0.24.1-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied: pytz>=2011k in /usr/lib/python3.6/site-packages (from pandas)
Collecting numpy>=1.12.0 (from pandas)
Using cached https://files.pythonhosted.org/packages/f5/bf/4981bcbee43934f0adb8f764a1e70ab0ee5a448f6505bd04a87a2fda2a8b/numpy-1.16.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting python-dateutil>=2.5.0 (from pandas)
Using cached https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl
Requirement already satisfied: six>=1.5 in /usr/lib/python3.6/site-packages (from python-dateutil>=2.5.0->pandas)
Installing collected packages: numpy, python-dateutil, pandas
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
strip_file_prefix=options.strip_file_prefix,
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install
strip_file_prefix=strip_file_prefix
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
strip_file_prefix=strip_file_prefix,
File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib64/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib64/python3.6/site-packages/numpy'
How can I upgrade pandas?

Unable to install NLTK on MacOS High Sierra

This text is to add some extra text to escape the error and has nothing to do with the question. Please excuse!
Install:
sudo pip install -U nltk
I am getting the following error while installing NLTK on my laptop.
Please help!
Error
Collecting nltk
Downloading nltk-3.2.5.tar.gz (1.2MB)
100% |████████████████████████████████| 1.2MB 201kB/s
Collecting six (from nltk)
Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: six, nltk
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-0HVpKZ uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
I tried this command but didn't work
python -m pip install --upgrade pip setuptools wheel (Even this does not install)
It's best practice to create a virtual environment before installing packages, see http://docs.python-guide.org/en/latest/dev/virtualenvs/
Nevertheless, TL;DR:
pip install --user --upgrade nltk

Failed to import the TensorFlow module

I have problems with my installation of tensorflow.
I got a mrry/tensorflow_self_check.py script and made some adjustment MurDoDePar / tensorflow_self_check.py
I get this result:
- Python version is 3.6.
- TensorFlow is installed at: C:\Users\domin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow
*** Failed to import the TensorFlow module.
- Find msvcp140.dll
- Find cudart64_91.dll
- Find nvcuda.dll
- Find cuDNN 7 cudnn64_7.dll.
*** ERROR Liste
- Failed to import the TensorFlow module.
If I make the order pip3 install --ignore-installed --upgrade tensorflow I have errors :
C:\Users\domin>pip3 install --ignore-installed --upgrade tensorflow-gpu
Collecting tensorflow-gpu
Using cached tensorflow_gpu-1.5.0-cp36-cp36m-win_amd64.whl
Collecting tensorflow-tensorboard<1.6.0,>=1.5.0 (from tensorflow-gpu)
Using cached tensorflow_tensorboard-1.5.0-py3-none-any.whl
...OK
Using cached setuptools-38.4.0-py2.py3-none-any.whl
Installing collected packages: six, html5lib, numpy, markdown, wheel, werkzeug, setuptools, protobuf, bleach, futures, tensorflow-tensorboard, absl-py, tensorflow-gpu
Exception:
Traceback (most recent call last):
File "c:\users\domin\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\domin\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\users\domin\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\users\domin\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\users\domin\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "c:\users\domin\appdata\local\programs\python\python36\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "c:\users\domin\appdata\local\programs\python\python36\lib\site-packages\pip\wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "c:\users\domin\appdata\local\programs\python\python36\lib\shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'c:\\users\\domin\\appdata\\local\\programs\\python\\python36\\Lib\\site-packages\\numpy\\.libs\\libopenblas.BNVRK7633HSX7YVO2TADGR4A5KEKXJAW.gfortran-win_amd64.dll'
I'm stuck can you help me?
It looks like you do not have permission to install it.
You could try to run it using the python executable, as explained in pip install access denied on Windows
Or you could try to run CMD as Administrator, then try installing again.

error in installing request module in python 3.6

I am facing some errors and exceptions while installing requests module in python 3.6 version.
I am attaching screenshot of the errors that i am facing.click here for error screenshot
here is the error that i got on cmd windows
C:\Program Files (x86)\Python36-32\Scripts>pip3 install requests
Collecting requests
Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests)
Using cached certifi-2017.7.27.1-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests)
Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests)
Using cached idna-2.6-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests)
Using cached chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: certifi, urllib3, idna, chardet, requests
Exception:
Traceback (most recent call last):
File "c:\program files (x86)\python36-32\lib\site-packages\pip\basecommand.py"
, line 215, in main
status = self.run(options, args)
File "c:\program files (x86)\python36-32\lib\site-packages\pip\commands\instal
l.py", line 342, in run
prefix=options.prefix_path,
File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_set.py"
, line 784, in install
**kwargs
File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install
.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install
.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line
345, in move_wheel_files
clobber(source, lib_dir, True)
File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line
316, in clobber
ensure_dir(destdir)
File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__.
py", line 83, in ensure_dir
os.makedirs(path)
File "c:\program files (x86)\python36-32\lib\os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python
36-32\\Lib\\site-packages\\certifi'
Thanks in advance
The issue that you are facing is because of a permission error. This is likely because you have not run the command line prompt as an administrator. So, the best thing to do is right click on the command line icon, and run as administrator. Once you've done that, continue normally and install requests using pip install requests. Normally, when you try to install python packages in the main python installation, this error occurs, because you need admin privileges in order to write to anything in Program Files.
That should solve the problem. However, what would be a better option would be to install the virtualenv package, and then have localized installation of packages, so that you can avoid these messy installations that require special rights.

Can't install packages in Windows 10

I just reinstalled Python 3.6, but when I try to install packages, Windows returns errors. First I tried installing package BeautifulSoup from the Windows command prompt:
python -m pip install BeautifulSoup
but this returns the following error:
Collecting BeautifulSoup
Using cached BeautifulSoup-3.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Robert\AppData\Local\Temp\pip-build-iiyyxs2o\BeautifulSoup\setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Robert\AppData\Local\Temp\pip-build-iiyyxs2o\BeautifulSoup\
Then I tried installing package requests:
python -m pip install requests
but this returns
C:\Program Files\Python36>python -m pip install requests
Collecting requests
Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests)
Using cached certifi-2017.7.27.1-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests)
Using cached idna-2.6-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests)
Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests)
Using cached urllib3-1.22-py2.py3-none-any.whl
Installing collected packages: certifi, idna, chardet, urllib3, requests
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Program Files\Python36\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "C:\Program Files\Python36\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "C:\Program Files\Python36\lib\site-packages\pip\wheel.py", line 316, in clobber
ensure_dir(destdir)
File "C:\Program Files\Python36\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "C:\Program Files\Python36\lib\os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'C:\\Program Files\\Python36\\Lib\\site-packages\\certifi'
What do I need to do so that pip successfully installs packages?
BeautifulSoup is for Python 2 only. For Python 3 install beautifulsoup4:
pip install beautifulsoup4
The second problem seems obvious: you don't have write-access to C:\\Program Files\\Python36\\Lib\\site-packages and subdirectories.

Categories