Tensor Flow Install Notes

Active today
Viewed 27 times

Help I’m new to this and I cannot install Tensorflow on Raspberry Pi 4 4GB. Current Python version: Python 3.7.3 Pip version : pip 19.2.3

I tried typing

pip install --upgrade tensorflow


pip3 install --user --upgrade tensorflow 


pip install tensorflow

All of them cannot work and return similar error.

ERROR: Exception:
Traceback (most recent call last):
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 345, in run
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/legacy_resolve.py", line 307, in _get_abstract_dist_for
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 199, in prepare_linked_requirement
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 1064, in unpack_url
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 924, in unpack_http_url
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 1152, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 861, in _download_url
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/utils/hashes.py", line 75, in check_against_chunks
    for chunk in chunks:
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 829, in written_chunks
    for chunk in chunks:
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/utils/ui.py", line 156, in iter
    for x in it:
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_internal/download.py", line 818, in resp_read
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 531, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 496, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/pi/.local/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 402, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='www.piwheels.org', port=443): Read timed out.

Sorry if I did not show my problems correctly because this is the first time I’m posting here.

 New contributor
  • Ah, let me see. There are many versions of TensorFlow, with different NN models. Please give me the web link to the tutorial or instruction. I can try to reproduce your situation and problem. PS – the error message indicate Python 2.7. So your python env might be corrupted, or you forget to use pip3 (your last pip!) and messed up python 2.7 and 3.7.3 stuff. – tlfong01 yesterday   
  • You might like to try these (third is out of date), and see if there is any problem. I can try to reproduce your situation.(1) Installing Machine Learning Software TensorFlow on Raspberry Pi – Rishabh Jain 2019may10 circuitdigest.com/microcontroller-projects/… (3) Detect ANY Object with Raspberry Pi and TensorFlow Youtube – 2018dec21 youtube.com/watch?v=zqIBce4LKx8 (2) How to install TensorFlow 1.9 On Rpi – Magpi 2018 raspberrypi.org/magpi/tensorflow-ai-raspberry-pi – tlfong01 yesterday   
  • I thought your tutorial is out of date, therefore I suggest some more updated references. But the tutorial you provide in your answer is actually from the TF official site, and is more date than mine. So forget what I suggested. I will try to see if I can repeat your situation. Sorry for confusing you. – tlfong01 23 hours ago   


Bad news. I tried but got “memory error“. (My Rpi4B is 2GB version.)

tensor-error 1

Update 2019sep26hkt1743

My Rpi4B is 2GB version, free -m shows Total 1939, used 131, free 1525, …

  • Please don’t post pictures of text. Instead paste the text direct into the answer. – Ingo 1 hour ago
  • @Ingo, Thanks for your suggestion. Actually I used to cut and paste text here, to make it easy for others to copy and google. From time to time I copy to my penzu journal, and make highlights for easy reading. However this time I captured screen for the following reasons: To let others know that there is no chance for me to make any careless copy/paste errors. I once made newbie mistakes by leaving a space between the “=” in statements, and found it syntax error. The other reason is that I used to copy pasted text to usb stick or ftd server and then pass it to Chinese Win10, … – tlfong01 1 hour ago   
  • And Chinese Window from time to time unintentionally switch to Chinese character mode and write Chinese characters which become “big” English or funny character in Rpi.SE. Often I need to reboot Windows to get rid of the funny character mode. That is another reason to paste my text files to Penzu. Anyway, for the next versions of my answer to this question, I will try all three methods as I find appropriate. I know other users just use their camera to copy the image, because they don’t know how to use scrot to do screen capture. I also sometimes use this quick and dirty, when in a hurry. – tlfong01 1 hour ago   
  • And when I was a nano newbie, I wrongly thought that nano editing could not cut and past, because ctrl-C, ctrl-V won’t work. If is after some time I found that I can use mouse to select cut and paste operation. If nano did accept ctrl-c, ctrl-v, that would save much newbie’s trouble, … – tlfong01 1 hour ago   

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

<span>%d</span> bloggers like this: