错误:无法为使用PEP 517的pendulum构建轮子,因此无法直接安装

6

请帮忙。我已经尝试了大部分能在网上找到的解决方案,并且作为最后的办法,将其发布到stackoverflow上。

我在尝试安装Pendulum软件包时遇到的错误如下:

C:\WINDOWS\system32>pip install pendulum Collecting pendulum   Using cached pendulum-2.1.0.tar.gz (80 kB)   Installing build dependencies ... done   Getting requirements to build wheel ... done
    Preparing wheel metadata ... done Collecting pytzdata>=2018.3   Using cached pytzdata-2019.3-py2.py3-none-any.whl (489 kB) Requirement already satisfied: python-dateutil<3.0,>=2.6 in c:\python\python38-32\lib\site-packages (from pendulum) (2.8.1) Requirement already satisfied: six>=1.5 in c:\users\cuser\appdata\roaming\python\python38\site-packages (from python-dateutil<3.0,>=2.6->pendulum) (1.14.0) Building wheels for collected packages: pendulum   Building wheel for pendulum (PEP 517) ... error   ERROR: Command errored out with exit status 1:    command: 'c:\python\python38-32\python.exe' 'c:\python\python38-32\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\cuser\AppData\Local\Temp\tmpkbrn91g9'
       cwd: C:\Users\cuser\AppData\Local\Temp\pip-install-q2vfs50o\pendulum   Complete output (24 lines):   Traceback (most recent call last):
    File "setup.py", line 2, in <module>
      from setuptools import setup   ModuleNotFoundError: No module named 'setuptools'   Traceback (most recent call last):
    File "c:\python\python38-32\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 257, in <module>
      main()
    File "c:\python\python38-32\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 240, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "c:\python\python38-32\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 181, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "C:\Users\cuser\AppData\Local\Temp\pip-build-env-nvwxlarh\overlay\Lib\site-packages\poetry\core\masonry\api.py", line 57, in build_wheel
      return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory)))
    File "C:\Users\cuser\AppData\Local\Temp\pip-build-env-nvwxlarh\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 56, in make_in
      wb.build()
    File "C:\Users\cuser\AppData\Local\Temp\pip-build-env-nvwxlarh\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 82, in build
      self._build(zip_file)
    File "C:\Users\cuser\AppData\Local\Temp\pip-build-env-nvwxlarh\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 102, in _build
      self._run_build_command(setup)
    File "C:\Users\cuser\AppData\Local\Temp\pip-build-env-nvwxlarh\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 130, in _run_build_command
      subprocess.check_call(
    File "c:\python\python38-32\lib\subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)   subprocess.CalledProcessError: Command '['c:\\python\\python38-32\\python.exe', 'setup.py', 'build', '-b', 'build']' returned non-zero exit status 1.  
----------------------------------------   ERROR: Failed building wheel for pendulum Failed to build pendulum ERROR: Could not build wheels for pendulum which use PEP 517 and cannot be installed directly

The current python version and package versions are as below:

    Python 3.8.2

    Package           Version
    ----------------- -------
    astroid           2.3.3
    colorama          0.4.3
    cx-Oracle         7.3.0
    ez-setup          0.9
    isort             4.3.21
    lazy-object-proxy 1.4.3
    mccabe            0.6.1
    numpy             1.18.2
    pandas            1.0.3
    pip               20.0.2
    pylint            2.4.4
    python-dateutil   2.8.1
    pytz              2019.3
    setuptools        46.1.3
    six               1.14.0
    SQLAlchemy        1.3.15
    wheel             0.34.2
    wrapt             1.11.2


OS version:

    OS Name:                   Microsoft Windows 10 Enterprise
    OS Version:                10.0.17763 N/A Build 17763

1
我在这里发布了一个解决方法,可能适用于你的情况。https://github.com/sdispater/pendulum/issues/454 - Wes
3个回答

11

这似乎是 Pendulum 配置错误的两个结果。

第一个错误是 Windows wheels 的名称错误。请参见 https://github.com/sdispater/pendulum/issues/456

因此,Pip 试图回退到从源代码构建。我不确定到底出了什么问题,但是 Pendulum 中有些配置错误,使得安装无法与现代版本的 Pip 正常工作。请参见 https://github.com/sdispater/pendulum/issues/454

有两种解决方法:

  1. 降级 Pip 到 18.1 版本。对我来说有效。
  2. 将 Poetry 安装到项目环境中,然后使用 --no-build-isolation 选项安装 Pendulum,如 @Wes 在此处所述:https://github.com/sdispater/pendulum/issues/454#issuecomment-605519477

在这被修复之前,我更喜欢暂时降级 Pip,而不是搞乱我的项目环境。所以我选择了第一个选项。在这个问题被修复之前,请选择适合您工作流程的解决方案。


2
我在我的虚拟环境中将pip降级到18.1,并确认它可以正常工作。 - Adrien H
1
对我来说,降级会影响到其他库,所以我必须采用第二个不太好看的解决方案,但它运行良好。 - Max Ng
使用降级解决方案,在我的Windows 10上运行良好:python -m pip install --force-reinstall pip==18.1,然后:python -m pip install "pendulum<3.0,>=2.0.4"。感谢@shadowtalker。 - kn0t

2

目前,您可以尝试以下操作:

pip install pendulum==2.0.5

1
降级pip版本至18.1,然后安装pendulum。
pip install pip==18.1 && pip install pendulum

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接