由于无效的环境标记错误,无法构建基于 scrapy 的项目

Unable to build scrapy based project due to invalid environment marker error

我无法为我几个月前使用 Scrapy 编写的一个项目构建 docker 图像 Ubuntu 作为基础 OS。它显示以下依赖性错误 -

Downloading/unpacking cryptography>=2.1.4 (from pyOpenSSL->Scrapy==1.4.0->-r /app/requirements.txt (line 3))
  Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography
    error in cryptography setup command: Invalid environment marker: platform_python_implementation != 'PyPy'
    Complete output from command python setup.py egg_info:
    error in cryptography setup command: Invalid environment marker: platform_python_implementation != 'PyPy'

因为我无法控制 Scrapy 的依赖项,而且我一直在使用 Scrapy 1.4.0,最新版本,以及 Python 3,我不确定我现在有什么选择?

以下是我用来安装依赖的命令

pip3 install -r requirements.txt

以下是我的 requirements.txt 的样子

lxml==3.8.0
psycopg2==2.7.3.1
Scrapy==1.4.0
Twisted==17.5.0
validators==0.12.0
tweepy==3.5.0

更新:

构建在 Mac 机器上运行良好,如下所示,但在 Ubuntu 机器上无法运行。注意:即使构建成功也会警告 platform_python_implementation != "PyPy",如下所示 -

Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography>=2.1.4->pyOpenSSL->Scrapy==1.4.0->-r requirements.txt (line 3))
  Downloading cffi-1.11.2-cp35-cp35m-macosx_10_6_intel.whl (240kB)
    100% |████████████████████████████████| 245kB 623kB/s
Collecting asn1crypto>=0.21.0 (from cryptography>=2.1.4->pyOpenSSL->Scrapy==1.4.0->-r requirements.txt (line 3))
  Downloading asn1crypto-0.23.0-py2.py3-none-any.whl (99kB)
    100% |████████████████████████████████| 102kB 830kB/s
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=2.1.4->pyOpenSSL->Scrapy==1.4.0->-r requirements.txt (line 3))
Building wheels for collected packages: zope.interface, oauthlib
  Running setup.py bdist_wheel for zope.interface ... done
  Stored in directory: /Users/rahul/Library/Caches/pip/wheels/8b/39/98/0fcb72adfb12b2547273b1164d952f093f267e0324d58b6955
  Running setup.py bdist_wheel for oauthlib ... done
  Stored in directory: /Users/rahul/Library/Caches/pip/wheels/e5/46/f7/bb2fde81726295a13a71e3c6396d362ab408921c6562d6efc0
Successfully built zope.interface oauthlib

该问题与 pip3 升级有关。该软件包的贡献者之一分享了技巧 here