收到错误消息“获取构建轮的要求未成功运行。”当尝试安装 rpy2 时

问题描述 投票:0回答:3

运行命令

pip install rpy2
会产生以下输出和错误消息:

Collecting rpy2
Using cached rpy2-3.5.12.tar.gz (217 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
    Traceback (most recent call last):
      File "c:\users\97254\working_project\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
        main()
      File "c:\users\97254\working_project\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
      File "c:\users\97254\working_project\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
        return hook(config_settings)
      File "C:\Users\97254\AppData\Local\Temp\pip-build-env-b21o8iu5\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
        return self._get_build_requires(config_settings, requirements=['wheel'])
      File "C:\Users\97254\AppData\Local\Temp\pip-build-env-b21o8iu5\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
      self.run_setup()
      File "C:\Users\97254\AppData\Local\Temp\pip-build-env-b21o8iu5\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
      exec(code, locals())
      File "<string>", line 124, in <module>
      File "<string>", line 110, in get_r_c_extension_status
      File "./rpy2/situation.py", line 295, in get_r_flags
      _get_r_cmd_config(r_home, flags,
      File "./rpy2/situation.py", line 255, in _get_r_cmd_config
      output = subprocess.check_output(
      File "C:\Users\97254\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 420, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "C:\Users\97254\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 501, in run
      with Popen(*popenargs, **kwargs) as process:
      File "C:\Users\97254\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 947, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
      File "C:\Users\97254\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1416, in _execute_child
      hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

我根据另一篇 Stackoverflow 帖子上的说明卸载并重新安装了 R 和关联的目录,并得到了相同的错误。我也尝试安装以前版本的 rpy2 并得到相同的错误。

如果有人知道如何解决此错误,我会很高兴得到它。
谢谢。

python r rpy2
3个回答
1
投票

尝试

pip install wheel

或者从 github repo 安装 rpy2 而不是 PIP


0
投票

最终我从 rpy2 的 GitHub 页面下载了 rpy2 的 zip 文件,解压并将其放入 python 项目的站点包中,从而启用了该包。


0
投票

我按照上面有人说的做了这个.. pip3 安装wheel setuptools pip --upgrade

然后它告诉我我必须按特定用途安装,例如.. pip3 安装 azure-identity 因为 pip install azure 已被弃用。

参见https://azure.github.io/azure-sdk/releases/latest/all/python.html

© www.soinside.com 2019 - 2024. All rights reserved.