【问题标题】:Unable to build scrapy based project due to invalid environment marker error由于无效的环境标记错误,无法构建基于 scrapy 的项目
【发布时间】:2017-12-12 06:33:59
【问题描述】:

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

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

【问题讨论】:

  • 它在错误消息中显示PyPy - 也许你必须安装pypy?
  • 也许吧,但我不确定过去几个月发生了什么变化,因为我没有改变任何东西。如果之前没有显式安装 pypy,它是如何工作的?
  • 它显示它试图下载cryptography。也许有使用pypy的新版本。
  • @furas 我刚刚在我的 mac 机器上在一个全新的 virtualenv 中进行了本地构建,虽然它确实显示了两次消息 platform_python_implementation != pypy,但一切正常。
  • 您是否将其安装在 virtualenv 中?

标签: python-3.x scrapy python-cryptography


【解决方案1】:

问题与pip3 升级有关。该包的一位贡献者分享了提示here

【讨论】:

    猜你喜欢
    • 2014-06-25
    • 1970-01-01
    • 2019-08-12
    • 2021-02-09
    • 2019-11-19
    • 2022-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多