han zhong
han zhong

Reputation: 21

Install tensorflow via pip but failed just as follows

Traceback  (most recent call last):<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main<br>
    status = self.run(options, args)<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run<br>
    wb.build(autobuilding=True)<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build<br>
    self.requirement_set.prepare_files(self.finder)<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 821, in unpack_url
    hashes=hashes<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 659, in unpack_http_url
    hashes)<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/utils/hashes.py", line 46, in check_against_chunks<br>
    for chunk in chunks:<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 571, in written_chunks
    for chunk in chunks:<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/utils/ui.py", line 139, in iter<br>
    for x in it:<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 560, in resp_read
    decode_content=False):<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream<br>
    data = self.read(amt=amt, decode_content=decode_content)<br>
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 324, in read<br>
    flush_decoder = True<br>
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)<br>
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 246, in _error_catcher<br>
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')<br>
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

The image description of the problem

Upvotes: 2

Views: 12729

Answers (2)

ggtx
ggtx

Reputation: 51

I solved it by modifying the command like this:

pip --default-timeout=100 install THEPACKAGENAME    

Upvotes: 5

Ayushi Agarwal
Ayushi Agarwal

Reputation: 460

You can also try installing using wheel packages. The Wheel packages depend on the kind of operating system you have, the python version and whether you want to install with CPU/GPU support. Also upgrade you protobuf before installing Tensorflow.

Please find a list of packages here: https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package

You can then issue this command :

$ sudo pip  install --upgrade <TF wheel package URL>   - For Python 2.7
$ sudo pip3 install --upgrade <TF wheel package URL>   - For Python 3.x 

Tensorflow site has some details on some common installation problems. You can look at those as well, just in case.

https://www.tensorflow.org/install/install_linux#common_installation_problems

Upvotes: 0

Related Questions