0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Docker内(LINUX)内でのtensorflowインストール(メモ)

Posted at

環境 Windows10 Pro 64bit
Docker for Windows
DockerToolbox
仮想環境 Ubuntu
Anaconda3
Python3
#tensorflowインストール
Ubuntu上でtensorflowをインストールした。
しかし、インストールで以下のエラーが発生した。

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.

いろいろ調べたり、pipをアップグレードしてみたりした。
以下のサイトを参考にして再度tensorflowインストール
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:/#

インストールが成功した。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?