Install tensorflow in Docker (LINUX) (memo)

Environment Windows10 Pro 64bit Docker for Windows DockerToolbox Virtual environment Ubuntu Anaconda3 Python3

tensorflow installation

I installed tensorflow on Ubuntu. However, the following error occurred during installation.

qiita.dos


ERROR: Exception:
Traceback (most recent call last):
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher
    yield
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 519, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "/root/anaconda3/lib/python3.7/http/client.py", line 447, in read
    n = self.readinto(b)
  File "/root/anaconda3/lib/python3.7/http/client.py", line 491, in readinto
    n = self.fp.readinto(b)
  File "/root/anaconda3/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/root/anaconda3/lib/python3.7/ssl.py", line 1052, in recv_into
    return self.read(nbytes, buffer)
  File "/root/anaconda3/lib/python3.7/ssl.py", line 911, 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 "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 224, in _main
    status = self.run(options, args)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 321, in run
    reqs, check_supported_wheels=not options.target_dir
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
    requirements, max_rounds=try_to_avoid_resolution_too_deep,
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 445, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 339, in resolve
    failure_causes = self._attempt_to_pin_criterion(name, criterion)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 207, in _attempt_to_pin_criterion
    criteria = self._get_criteria_to_update(candidate)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 198, in _get_criteria_to_update
    for r in self._p.get_dependencies(candidate):
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 102, in get_dependencies
    for r in candidate.iter_dependencies(with_requires)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 101, in <listcomp>
    r
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 252, in iter_dependencies
    requires = self.dist.requires() if with_requires else ()
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 234, in dist
    self._prepare()
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 221, in _prepare
    dist = self._prepare_distribution()
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 314, in _prepare_distribution
    self._ireq, parallel_builds=True,
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 480, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 505, in _prepare_linked_requirement
    self.download_dir, hashes,
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 257, in unpack_url
    hashes=hashes,
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 130, in get_http_url
    from_path, content_type = download(link, temp_dir.path)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/network/download.py", line 163, in __call__
    for chunk in chunks:
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/progress_bars.py", line 168, in iter
    for x in it:
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_internal/network/utils.py", line 88, in response_chunks
    decode_content=False,
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 576, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 541, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/root/anaconda3/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/root/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 443, 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.

I did a lot of research and tried upgrading pip. Install tensorflow again referring to the following site TensoFlow

qiita.dos


oot@c0029038ef6f:/# pip install --upgrade pip
Requirement already satisfied: pip in /root/anaconda3/lib/python3.7/site-packages (20.3.1)
root@c0029038ef6f:/# pip -V
pip 20.3.1 from /root/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
root@c0029038ef6f:/# pip install --upgrade tensorflow
Collecting tensorflow
  Downloading tensorflow-2.3.1-cp37-cp37m-manylinux2010_x86_64.whl (320.4 MB)
     |████████████████████████████████| 320.4 MB 10 kB/s
Requirement already satisfied: wheel>=0.26 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (0.33.1)
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Requirement already satisfied: wrapt>=1.11.1 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.11.1)
Requirement already satisfied: numpy<1.19.0,>=1.16.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.16.2)
Collecting absl-py>=0.7.0
  Downloading absl_py-0.11.0-py3-none-any.whl (127 kB)
     |████████████████████████████████| 127 kB 3.0 MB/s
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Collecting astunparse==1.6.3
  Downloading astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Requirement already satisfied: wheel>=0.26 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (0.33.1)
Collecting gast==0.3.3
  Downloading gast-0.3.3-py2.py3-none-any.whl (9.7 kB)
Collecting google-pasta>=0.1.8
  Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 5.2 MB/s
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Collecting grpcio>=1.8.6
  Downloading grpcio-1.34.0-cp37-cp37m-manylinux2014_x86_64.whl (3.9 MB)
     |████████████████████████████████| 3.9 MB 2.9 MB/s
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Collecting h5py<2.11.0,>=2.10.0
  Downloading h5py-2.10.0-cp37-cp37m-manylinux1_x86_64.whl (2.9 MB)
     |████████████████████████████████| 2.9 MB 5.9 MB/s
Requirement already satisfied: numpy<1.19.0,>=1.16.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.16.2)
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Collecting keras-preprocessing<1.2,>=1.1.1
  Downloading Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
     |████████████████████████████████| 42 kB 1.9 MB/s
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Requirement already satisfied: numpy<1.19.0,>=1.16.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.16.2)
Collecting opt-einsum>=2.3.2
  Downloading opt_einsum-3.3.0-py3-none-any.whl (65 kB)
     |████████████████████████████████| 65 kB 4.3 MB/s
Requirement already satisfied: numpy<1.19.0,>=1.16.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.16.2)
Collecting protobuf>=3.9.2
  Downloading protobuf-3.14.0-cp37-cp37m-manylinux1_x86_64.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 6.8 MB/s
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Collecting tensorboard<3,>=2.3.0
  Downloading tensorboard-2.4.0-py3-none-any.whl (10.6 MB)
     |████████████████████████████████| 10.6 MB 6.7 MB/s
Requirement already satisfied: requests<3,>=2.21.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorboard<3,>=2.3.0->tensorflow) (2.21.0)
Requirement already satisfied: werkzeug>=0.11.15 in /root/anaconda3/lib/python3.7/site-packages (from tensorboard<3,>=2.3.0->tensorflow) (0.14.1)
Requirement already satisfied: numpy<1.19.0,>=1.16.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.16.2)
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Requirement already satisfied: wheel>=0.26 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (0.33.1)
Collecting google-auth<2,>=1.6.3
  Downloading google_auth-1.24.0-py2.py3-none-any.whl (114 kB)
     |████████████████████████████████| 114 kB 7.2 MB/s
Requirement already satisfied: six>=1.12.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorflow) (1.12.0)
Collecting cachetools<5.0,>=2.0.0
  Downloading cachetools-4.2.0-py3-none-any.whl (12 kB)
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Downloading google_auth_oauthlib-0.4.2-py2.py3-none-any.whl (18 kB)
Collecting markdown>=2.6.8
  Downloading Markdown-3.3.3-py3-none-any.whl (96 kB)
     |████████████████████████████████| 96 kB 5.6 MB/s
Requirement already satisfied: importlib-metadata in /root/anaconda3/lib/python3.7/site-packages (from markdown>=2.6.8->tensorboard<3,>=2.3.0->tensorflow) (0.0.0)
Requirement already satisfied: zipp>=0.3.2 in /root/anaconda3/lib/python3.7/site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<3,>=2.3.0->tensorflow) (0.3.3)
Collecting pyasn1-modules>=0.2.1
  Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
     |████████████████████████████████| 155 kB 3.4 MB/s
Collecting pyasn1<0.5.0,>=0.4.6
  Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
     |████████████████████████████████| 77 kB 5.5 MB/s
Requirement already satisfied: certifi>=2017.4.17 in /root/anaconda3/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (2019.3.9)
Requirement already satisfied: idna<2.9,>=2.5 in /root/anaconda3/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /root/anaconda3/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (3.0.4)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /root/anaconda3/lib/python3.7/site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (1.24.1)
Collecting requests-oauthlib>=0.7.0
  Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Requirement already satisfied: requests<3,>=2.21.0 in /root/anaconda3/lib/python3.7/site-packages (from tensorboard<3,>=2.3.0->tensorflow) (2.21.0)
Collecting oauthlib>=3.0.0
  Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 4.2 MB/s
Collecting rsa<5,>=3.1.4
  Downloading rsa-4.6-py3-none-any.whl (47 kB)
     |████████████████████████████████| 47 kB 4.8 MB/s
Collecting setuptools>=41.0.0
  Downloading setuptools-51.0.0-py3-none-any.whl (785 kB)
     |████████████████████████████████| 785 kB 8.0 MB/s
Collecting tensorboard-plugin-wit>=1.6.0
  Downloading tensorboard_plugin_wit-1.7.0-py3-none-any.whl (779 kB)
     |████████████████████████████████| 779 kB 2.4 MB/s
Collecting tensorflow-estimator<2.4.0,>=2.3.0
  Downloading tensorflow_estimator-2.3.0-py2.py3-none-any.whl (459 kB)
     |████████████████████████████████| 459 kB 4.4 MB/s
Collecting termcolor>=1.1.0
  Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Building wheels for collected packages: termcolor
  Building wheel for termcolor (setup.py) ... done
  Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4830 sha256=6ebb96f324b7c2165b08dde3837886dbbf3a7bd3869d1afe28a97fb55df1c119
  Stored in directory: /root/.cache/pip/wheels/3f/e3/ec/8a8336ff196023622fbcb36de0c5a5c218cbb24111d1d4c7f2
Successfully built termcolor
Installing collected packages: pyasn1, setuptools, rsa, pyasn1-modules, oauthlib, cachetools, requests-oauthlib, google-auth, tensorboard-plugin-wit, protobuf, markdown, grpcio, google-auth-oauthlib, absl-py, termcolor, tensorflow-estimator, tensorboard, opt-einsum, keras-preprocessing, h5py, google-pasta, gast, astunparse, tensorflow
  Attempting uninstall: setuptools
    Found existing installation: setuptools 40.8.0
    Uninstalling setuptools-40.8.0:
      Successfully uninstalled setuptools-40.8.0
  Attempting uninstall: h5py
    Found existing installation: h5py 2.9.0
    Uninstalling h5py-2.9.0:
      Successfully uninstalled h5py-2.9.0
Successfully installed absl-py-0.11.0 astunparse-1.6.3 cachetools-4.2.0 gast-0.3.3 google-auth-1.24.0 google-auth-oauthlib-0.4.2 google-pasta-0.2.0 grpcio-1.34.0 h5py-2.10.0 keras-preprocessing-1.1.2 markdown-3.3.3 oauthlib-3.1.0 opt-einsum-3.3.0 protobuf-3.14.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-oauthlib-1.3.0 rsa-4.6 setuptools-51.0.0 tensorboard-2.4.0 tensorboard-plugin-wit-1.7.0 tensorflow-2.3.1 tensorflow-estimator-2.3.0 termcolor-1.1.0
root@c0029038ef6f:/#

The installation was successful.

Recommended Posts

Install tensorflow in Docker (LINUX) (memo)
Install Memo
install tensorflow in anaconda + python3.5 environment
Linux command (basic in basic) personal memo
Dockerfile: Install Docker on your Linux server
Install rJava on Linux in R3.6 environment.
Linux x memo
Linux # Command Memo 1
Install tensorflow. (Only!)
TensorFlow API memo
Put Python3 in Docker container of Amazon Linux2
Install Tensorflow on Mac
Linux permissions in Java
install diagrams in wsl
Linux standard textbook memo 1
Linux standard textbook memo 3
Install docker on Fedora31
[For memo] Linux Part 2
Procedure to install TensorFlow in fish shell environment (Anaconda 4.0.0)
Install Docker (Ubuntu 18.04 LTS)
Install Docker on Arch Linux and run it remotely
Seurat in Linux (installation)
Install Docker on AWS
TensorFlow API memo (Python)
Image normalization in TensorFlow
Install Python 3.6 on Docker
NTP configuration memo on Linux
Install Minecraft on Arch Linux
Install numpy in Visual Studio 2019
Clipping and normalization in TensorFlow
SSH restrictions in Linux environment
Linux standard textbook memo 1 part 2
Install the JDK on Linux
Pip install in proxy environment
[Linux] [Initial Settings] Install & Uninstall
Random seeds fixed in TensorFlow
Install tomcat 5.5 on Amazon Linux.
Linux tar xz command memo
Image addition memo in reportlab
Install Homebrew on Amazon Linux 2
Install Docker on WSL Ubuntu 18.04
Linux: DNS replacement in systemd.
Install strongSwan 5.9.1 on Amazon Linux 2
Run Amazon Linux 2 in VirtualBox
Python install in 2 lines @Windows
Install TensorFlow 1.15.0 on Raspberry Pi
Linux standard textbook memo part 6
[Work memo] Until matplotlib and numpy are installed in Amazon Linux