I am having some difficulties in installing TensorFlow on my computer.
My OS: Windows 8
My Python version: 3.7 (64-bit)
I used pip install Tensorflow
https://www.tensorflow.org/install/pip
Should I copy its commands to cmd? Or I should change some details of them accordingly?
For example:
I tried running code:
pip3 install -U pip virtualenv
Here is what I get:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\A>virtualenv --system-site-packages -p python3 ./venv
The path python3 (from --python=python3) does not exist
What does it mean by "the path does not exist"? I tried changing "python3 ." to "python3.7 .", but it doesn't work out.
Even tho the first command didn't work out, it seems the pip, python, and virtualenv are installed on my PC.
Here is the issue I have when I try to download Tensorflow:
I tried running code:
pip install --upgrade tensorflow
This is the error:
C:\Users\A>.\venv\Scripts\activate
The system cannot find the path specified.
C:\Users\A>pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\a\appdata\local\programs\python\
python37\lib\site-packages (20.0.2)
C:\Users\A>
C:\Users\A>pip list # show packages installed within the virtual environment
Package Version
---------- -------
pip 20.0.2
setuptools 45.1.0
virtualenv 16.7.9
wheel 0.34.2
C:\Users\A>pip install --upgrade tensorflow
Collecting tensorflow
Downloading tensorflow-2.1.0-cp37-cp37m-win_amd64.whl (355.8 MB)
| | 788 kB 3.2 kB/s eta 1 day, 6:26:40ERROR:
Exception:
Traceback (most recent call last):
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 425, in _error_catcher
yield
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 507, in read
data = self._fp.read(amt) if not fp_closed else b""
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\cachecontrol\filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "c:\users\a\appdata\local\programs\python\python37\lib\http\client.py", l
ine 457, in read
n = self.readinto(b)
File "c:\users\a\appdata\local\programs\python\python37\lib\http\client.py", l
ine 501, in readinto
n = self.fp.readinto(b)
File "c:\users\a\appdata\local\programs\python\python37\lib\socket.py", line 5
89, in readinto
return self._sock.recv_into(b)
File "c:\users\a\appdata\local\programs\python\python37\lib\ssl.py", line 1071
, in recv_into
return self.read(nbytes, buffer)
File "c:\users\a\appdata\local\programs\python\python37\lib\ssl.py", line 929,
in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\commands\install.py", line 331, in run
resolver.resolve(requirement_set)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\legacy_resolve.py", line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\legacy_resolve.py", line 282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\operations\prepare.py", line 482, in prepare_linked_requirement
hashes=hashes,
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\operations\prepare.py", line 287, in unpack_url
hashes=hashes,
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\operations\prepare.py", line 159, in unpack_http_url
link, downloader, temp_dir.path, hashes
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\operations\prepare.py", line 303, in _download_http_url
for chunk in download.chunks:
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\utils\ui.py", line 160, in iter
for x in it:
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_internal\network\utils.py", line 39, in response_chunks
decode_content=False,
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 564, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 529, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "c:\users\a\appdata\local\programs\python\python37\lib\contextlib.py", li
ne 130, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\a\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\urllib3\response.py", line 430, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files
.pythonhosted.org', port=443): Read timed out.
C:\Users\A>https://github.com/tensorflow/tensorflow/issues/5949
How can I install Tensorflow? Thank you!
Update 1:
When I change 'python 3' to 'python', and 'pip3' to 'pip', the first few command lines work out.
However, I still can't download Tensorflow.
A bit more has been downloaded this time:
(venv) C:\Users\A> pip install --upgrade tensorflow
Collecting tensorflow
Downloading tensorflow-2.1.0-cp37-cp37m-win_amd64.whl (355.8 MB)
|█ | 8.4 MB 10.0 kB/s eta 9:40:28ERROR: Exce
ption:
Traceback (most recent call last):
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
425, in _error_catcher
yield
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
507, in read
data = self._fp.read(amt) if not fp_closed else b""
File "c:\users\a\venv\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.p
y", line 62, in read
data = self.__fp.read(amt)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\http\client.py", l
ine 457, in read
n = self.readinto(b)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\http\client.py", l
ine 501, in readinto
n = self.fp.readinto(b)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\socket.py", line 5
89, in readinto
return self._sock.recv_into(b)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\ssl.py", line 1071
, in recv_into
return self.read(nbytes, buffer)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\ssl.py", line 929,
in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\a\venv\lib\site-packages\pip\_internal\cli\base_command.py", li
ne 186, in _main
status = self.run(options, args)
File "c:\users\a\venv\lib\site-packages\pip\_internal\commands\install.py", li
ne 331, in run
resolver.resolve(requirement_set)
File "c:\users\a\venv\lib\site-packages\pip\_internal\legacy_resolve.py", line
177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "c:\users\a\venv\lib\site-packages\pip\_internal\legacy_resolve.py", line
333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\a\venv\lib\site-packages\pip\_internal\legacy_resolve.py", line
282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "c:\users\a\venv\lib\site-packages\pip\_internal\operations\prepare.py",
line 482, in prepare_linked_requirement
hashes=hashes,
File "c:\users\a\venv\lib\site-packages\pip\_internal\operations\prepare.py",
line 287, in unpack_url
hashes=hashes,
File "c:\users\a\venv\lib\site-packages\pip\_internal\operations\prepare.py",
line 159, in unpack_http_url
link, downloader, temp_dir.path, hashes
File "c:\users\a\venv\lib\site-packages\pip\_internal\operations\prepare.py",
line 303, in _download_http_url
for chunk in download.chunks:
File "c:\users\a\venv\lib\site-packages\pip\_internal\utils\ui.py", line 160,
in iter
for x in it:
File "c:\users\a\venv\lib\site-packages\pip\_internal\network\utils.py", line
39, in response_chunks
decode_content=False,
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
564, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
529, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "C:\Users\A\AppData\Local\Programs\Python\Python37\Lib\contextlib.py", li
ne 130, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\a\venv\lib\site-packages\pip\_vendor\urllib3\response.py", line
430, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files
.pythonhosted.org', port=443): Read timed out.
(venv) C:\Users\A>
Update 2:
I used the following command line:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
Much more was downloaded.
Here is the new error:
ERROR: Could not find a version that satisfies the requirement tensorboard<2.2.0
,>=2.1.0 (from tensorflow) (from versions: 1.6.0rc0, 1.6.0, 1.7.0, 1.8.0, 1.9.0,
1.10.0, 1.11.0, 1.12.0, 1.12.1, 1.12.2, 1.13.0, 1.13.1, 1.14.0, 1.15.0, 2.0.0,
2.0.1, 2.0.2)
ERROR: No matching distribution found for tensorboard<2.2.0,>=2.1.0 (from tensor
flow)
C:\Users\A>
Do I need a different version of Tensorflow?
Use below commands to install TensorFlow inside virtual environment.
1) upgrade pip3:
python3 -m pip install --upgrade pip
2) Install virtual env
pip3 install virtualenv
3) You can then create a virtualenv using the full path of python3 like this:
virtualenv -p /home/example_username/opt/python-3.6.2/bin/python3 venv
4) Activate virtual env
source venv/bin/activate
5) install tensorflow
pip3 install tensorflow
please note this error message.
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files
.pythonhosted.org', port=443): Read timed out.
It seems that you can't connect to files.pythonhosted.org. You can visit this url: https://pypi.org/project/tensorflow/#files to down tensorflow-2.1.0-cp37-cp37m-win_amd64.whl first. And then use pip install <name>.whl to install it.
More:
If you are in China, you can use bellow command to install tensorflow from tsinghua University.
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
I'm trying to install the pyperclip module for the Mu editor and running into this pile of errors when I run it through the command line:
C:\Users\Torthew>pip install pyperclip --target C:\Users\Torthew\AppData\Local\Mu\pkgs
Collecting pyperclip
Using cached pyperclip-1.7.0.tar.gz (15 kB)
Installing collected packages: pyperclip
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\Torthew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "C:\Users\Torthew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\commands\install.py", line 395, in run
installed = install_given_reqs(
File "C:\Users\Torthew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\req\__init__.py", line 67, in install_given_reqs
requirement.install(
File "C:\Users\Torthew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\req\req_install.py", line 781, in install
scheme = get_scheme(
File "C:\Users\Torthew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\locations.py", line 185, in get_scheme
scheme = distutils_scheme(
File "C:\Users\Torthew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\locations.py", line 125, in distutils_scheme
i.finalize_options()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.496.0_x64__qbz5n2kfra8p0\lib\distutils\command\install.py", line 252, in finalize_options
raise DistutilsOptionError("can't combine user with prefix, "
distutils.errors.DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base
How can I fix this?
When installing tensorflow-gpu 1.4.0 using pip in Windows 10 (Python 3.5), I get the following strange error. Very interestingly, each time I run
pip.exe install tensorflow-gpu
it downloads a small but seemingly random part of the package, then raises the following exception:
(C:\Users\carth\Anaconda3\envs\py35) E:\Data\ownCloud\Work\CoronaryML>pip.exe install tensorflow-gpu
Collecting tensorflow-gpu
Downloading tensorflow_gpu-1.4.0-cp35-cp35m-win_amd64.whl (67.6MB)
Exception: | 266kB 797kB/s eta 0:01:25
Traceback (most recent call last):
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 821, in unpack_url
hashes=hashes
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 659, in unpack_http_url
hashes)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\download.py", line 571, in written_chunks
for chunk in chunks:
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\utils\ui.py", line 141, in iter
self.next(n)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\progress\__init__.py", line 73, in next
self.update()
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\progress\bar.py", line 41, in update
self.writeln(line)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\progress\helpers.py", line 67, in writeln
self.clearln()
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\progress\helpers.py", line 63, in clearln
print('\r\x1b[K', end='', file=self.file)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 141, in write
self.write_and_convert(text)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 166, in write_and_convert
self.write_plain_text(text, cursor, start)
File "C:\Users\carth\Anaconda3\envs\py35\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 174, in write_plain_text
self.wrapped.write(text[start:end])
OSError: raw write() returned invalid length 2 (should have been between 0 and 1)
I tried turning off my antivirus, in case that was killing it, but it didn't help.
In the end, I managed to install it by downloading the .whl from PyPI manually, then running pip.exe install path/to/.whl, but I'd like to understand what caused the original failure.
Any ideas?
This issue has been documented here, you can update to python 3.6 or install and enable the win_unicode_console package to solve it
https://bugs.python.org/issue32245
Switch to cmd with administrator rights to run the command:
pip3 install --ignore-installed --upgrade tensorflow-gpu -i https://pypi.tuna.
tsinghua.edu.cn/simple
I am trying to install graphite carbon (version 0.9.15) requirements by running the following command:
pip --proxy http://<proxy-host>:<proxy-port> install -r requirements.txt
The requirements.txt has the following contents:
Twisted>=13.2.0
git+git://github.com/graphite-project/whisper.git#0.9.13#egg=whisper
mocker==1.1.1
mock
However when I run the above command I get:
Collecting Twisted>=13.2.0 (from -r requirements.txt (line 1))
Using cached Twisted-16.6.0.tar.bz2
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/incremental/: [Errno 101] Network is unreachable -- Some packages may not be found!
Couldn't find index page for 'incremental' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [Errno 101] Network is unreachable -- Some packages may not be found!
No local packages or download links found for incremental>=16.10.1
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-6klpfA/Twisted/setup.py", line 21, in <module>
setuptools.setup(**_setup["getSetupArgs"]())
File "/usr/lib64/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/opt/graphite/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/opt/graphite/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
replace_conflicting=True,
File "/opt/graphite/lib/python2.7/site-packages/pkg_resources/__init__.py", line 827, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/opt/graphite/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1072, in best_match
return self.obtain(req, installer)
File "/opt/graphite/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1084, in obtain
return installer(requirement)
File "/opt/graphite/lib/python2.7/site-packages/setuptools/dist.py", line 380, in fetch_build_egg
return cmd.easy_install(req)
File "/opt/graphite/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 634, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('incremental>=16.10.1')
The strange thing is that when accessing the https://pypi.python.org/simple/incremental/ index page through the proxy I can see there is an incremental-16.10.1.tar.gz package.
What could be the issue here? Is this something network-related problem or a pip-related one?
I am trying to create requirement.txt for my Django project. I went through https://pip.readthedocs.org/en/1.1/requirements.html and accordingly trying to my requirement.txt
Django==1.8.4
django-autocomplete-light
django-cors-headers
django-watson
django-filter
django-import-export
MySQL-python
Pillow
jsonpickle
mysql-connector-python --allow-external mysql-connector-python
python-amazon-product-api
lxml
similarityPy
coverage
django-redis-cache
redis
django-debreach
Error which I am getting is:
------------------------------------------------------------
/usr/bin/pip run on Mon Dec 7 20:36:32 2015
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 262, in run
for req in parse_requirements(filename, finder=finder, options=options, session=session):
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1632, in parse_requirements
req = InstallRequirement.from_line(line, comes_from, prereleases=getattr(options, "pre", None))
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 173, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 71, in __init__
req = pkg_resources.Requirement.parse(req)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2667, in parse
reqs = list(parse_requirements(s))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2605, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2573, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'mysql-connector-python --allow-external mysql-connector-python', 'at', ' --allow-external mysql-connector-python')
What am I missing here ?
This line is not valid in a requirements.txt file:
mysql-connector-python --allow-external mysql-connector-python
I think the format for doing this would be:
--allow-external mysql-connector-python
mysql-connector-python
i.e. something like --allow-external mysql-connector-python, which would be a command-line arg to pip itself, should appear on its own line
https://pip.readthedocs.org/en/stable/reference/pip_install/#requirements-file-format
This is also invalid (!) in a pip requirements file:
apt-get install redis-server