Skip to content

docker compose up, pip install -r requirements failed, 可能是由scrapy依赖的cryptography版本问题导致 #134

Description

@teadrinker2015
#0 8.342 Collecting cryptography<40,>=38.0.0 (from pyOpenSSL->Scrapy==1.5.0->-r requirements.txt (line 1))
#0 8.857   Downloading https://pypi.doubanio.com/packages/6a/f5/a729774d087e50fffd1438b3877a91e9281294f985bda0fd15bf99016c78/cryptography-39.0.1.tar.gz (603kB)
#0 9.189     Complete output from command python setup.py egg_info:
#0 9.189     Traceback (most recent call last):
#0 9.189       File "<string>", line 1, in <module>
#0 9.189       File "/tmp/pip-build-gvp9q56u/cryptography/setup.py", line 93
#0 9.189         print(f"    Python: {'.'.join(str(v) for v in sys.version_info[:3])}")
#0 9.189                                                                             ^
#0 9.189     SyntaxError: invalid syntax
#0 9.189
#0 9.189     ----------------------------------------
#0 9.259 Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-gvp9q56u/cryptography/
#0 11.38 You are using pip version 8.1.1, however version 23.0.1 is available.
#0 11.38 You should consider upgrading via the 'pip install --upgrade pip' command.
------
failed to solve: executor failed running [/bin/sh -c pip install -i https://pypi.douban.com/simple/ -r requirements.txt]: exit code: 1

具体可能是因为dockerfile中的python是3.5(ubuntu16.04默认,无法升级至3.6),而依赖的cryptography版本过高,导致在python3.6版本引入的f-string那里出现了语法错误。

建议将dockerfile中的unbuntu:16.04改为ubuntu:18.04,并添加RUN python -m pip install --upgrade pip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions