google-api-python-client在构建docker镜像时失败

时间:2017-09-07 11:11:04

标签: python docker google-api google-api-client

我正在尝试使用以下命令构建docker镜像:

$ docker build --tag us.gcr.io/my_project_id/useradmin-global:20170907 .

我收到此错误:

Step 22/41 : RUN pip install google-api-python-client
 ---> Running in d38993b51bc0
Downloading/unpacking google-api-python-client
Downloading/unpacking oauth2client>=1.5.0,<5.0.0dev (from google-api-python-client)
Requirement already satisfied (use --upgrade to upgrade): six>=1.6.1,<2dev in /usr/lib/python2.7/dist-packages (from google-api-python-client)
Downloading/unpacking uritemplate>=3.0.0,<4dev (from google-api-python-client)
  Downloading uritemplate-3.0.0-py2.py3-none-any.whl
Downloading/unpacking httplib2>=0.9.2,<1dev (from google-api-python-client)
  Running setup.py (path:/tmp/pip-build-g15wLp/httplib2/setup.py) egg_info for package httplib2

Downloading/unpacking pyasn1>=0.1.7 (from oauth2client>=1.5.0,<5.0.0dev->google-api-python-client)
Downloading/unpacking rsa>=3.1.4 (from oauth2client>=1.5.0,<5.0.0dev->google-api-python-client)
Downloading/unpacking pyasn1-modules>=0.0.5 (from oauth2client>=1.5.0,<5.0.0dev->google-api-python-client)
Cleaning up...
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 290, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1266, in prepare_files
    req_to_install.extras):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2401, in requires
    dm = self._dep_map
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2597, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2621, in _compute_dependencies
    parsed = next(parse_requirements(distvers))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 49, in <lambda>
    next = lambda o: o.next()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2721, in parse_requirements
    "version spec")
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2686, in scan_list
    raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', 'pyasn1 ~=0.3.4', 'at', ' ~=0.3.4')

Storing debug log for failure in /root/.pip/pip.log
The command '/bin/sh -c pip install google-api-python-client' returned a non-zero code: 2

看看错误,似乎抱怨我的pyasn1安装版本不满意,期望0.3.4。但是,你可以看到它在0.3.4,所以我不知道该怎么做。

我尝试将docker升级到最新版本:

$ docker --version
Docker version 17.06.2-ce, build cec0b72

现在是哪个。还尝试自己运行pip命令,该命令成功:

$ pip install google-api-python-client
Requirement already satisfied: google-api-python-client in /Users/mryerse001/Library/Python/2.7/lib/python/site-packages
Requirement already satisfied: six<2dev,>=1.6.1 in /Users/mryerse001/Library/Python/2.7/lib/python/site-packages (from google-api-python-client)
Requirement already satisfied: httplib2<1dev,>=0.9.2 in /Library/Python/2.7/site-packages (from google-api-python-client)
Requirement already satisfied: uritemplate<4dev,>=3.0.0 in /Library/Python/2.7/site-packages (from google-api-python-client)
Requirement already satisfied: oauth2client<5.0.0dev,>=1.5.0 in /Users/mryerse001/Library/Python/2.7/lib/python/site-packages (from google-api-python-client)
Requirement already satisfied: pyasn1>=0.1.7 in /Library/Python/2.7/site-packages (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)
Requirement already satisfied: pyasn1-modules>=0.0.5 in /Users/mryerse001/Library/Python/2.7/lib/python/site-packages (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)
Requirement already satisfied: rsa>=3.1.4 in /Library/Python/2.7/site-packages/rsa-3.4.2-py2.7.egg (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)

感谢任何帮助。

0 个答案:

没有答案