首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在windows 10上安装ipywidget jupyterlab扩展时出错。我将生成此错误消息。有什么办法吗?

在windows 10上安装ipywidget jupyterlab扩展时出错。我将生成此错误消息。有什么办法吗?
EN

Stack Overflow用户
提问于 2022-02-28 21:07:55
回答 1查看 1.7K关注 0票数 0
代码语言:javascript
复制
c:\users\shamsa\appdata\local\programs\python\python38-32\lib\site-packages (from stack-data->ipython>=4.0.0->ipywidgets) (2.0.5)   
Requirement already satisfied: pure-eval in c:\users\shamsa\appdata\local\programs\python\python38-32\lib\site-packages (from stack-data->ipython>=4.0.0->ipywidgets) (0.2.2)   
Collecting zipp>=3.1.0
  Using cached zipp-3.7.0-py3-none-any.whl (5.3 kB)
Requirement already satisfied: six>=1.5 in c:\users\shamsa\appdata\local\programs\python\python38-32\lib\site-packages (from python-dateutil>=2.1->jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets) (1.16.0)
Collecting pywinpty>=1.1.0
  Using cached pywinpty-2.0.2.tar.gz (22 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      
      Cargo, the Rust package manager, is not installed or is not on PATH.
      This package requires Rust and Cargo to compile extensions. Install it through
      the system's package manager or via https://rustup.rs/
      
      Checking for Rust toolchain....
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

我的pip版本为22.0.3,python版本为3.8.0,尽管我从提供的错误消息中的链接安装了错误(abd遵循说明),但错误仍然存在。

这是我的货版

代码语言:javascript
复制
PS C:\Users\Shamsa> cargo -V
cargo 1.59.0 (49d8809dc 2022-02-10)

并安装了锈蚀

代码语言:javascript
复制
PS C:\Users\Shamsa> rustup show
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\Shamsa\.rustup

stable-x86_64-pc-windows-msvc (default)
rustc 1.59.0 (9d1b2106e 2022-02-23)

对错误的更新

我没有做任何更改,只是再次运行命令pip install ipywidgets,它生成了这个错误

代码语言:javascript
复制
Collecting pywinpty>=1.1.0
  Using cached pywinpty-2.0.2.tar.gz (22 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      💥 maturin failed
        Caused by: Cargo metadata failed. Does your crate 
compile with `cargo build`?
        Caused by: `cargo metadata` exited with an error: 
    Updating crates.io index
      warning: spurious network error (2 tries remaining): failed to read data: The server returned an invalid or unrecognized response
      ; class=Os (2)
      warning: spurious network error (1 tries remaining): failed to read data: The server returned an invalid or unrecognized response
      ; class=Os (2)
      error: failed to get `pyo3` as a dependency of package `pywinpty v2.0.2 (C:\Users\Shamsa\AppData\Local\Temp\pip-install-mrl995n0\pywinpty_2079790bb492449abb31454ef2581cb6)`
     
      Caused by:
        failed to load source for dependency `pyo3`
     
      Caused by:
        Unable to update registry `crates-io`
     
      Caused by:
        failed to fetch `https://github.com/rust-lang/crates.io-index`
     
      Caused by:
        failed to read data: The server returned an invalid or unrecognized response
        ; class=Os (2)
      Error running maturin: Command '['maturin', 'pep517'hamsa\\AppData\\Local\\Temp\\pip-modern-metadata-_naf8t69'hamsa\\AppData\\Local\\Temp\\pip-modern-metadata-_naf8t69', '--interpreter', 'c:\\users\\shamsa\\agrams\\python\\python38-32\\python.exe']' returned non-zerocal\\programs\\python\\python38-32\\python.exe']o exit status 1.
      Checking for Rust toolchain....                                                                      odern-metadata-_naf8t69 --interpreter c:\users\sh
      Running `maturin pep517 write-dist-info --metadata-directory C:\Users\Shamsa\AppData\Local\Temp\pip-mirectory C:\Users\Shamsa\AppData\Local\Temp\pip-modern-metata\local\programs\python\python38-32\python.exe`\programs\python\python38-32\python.exe`
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.kely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.    
╰─> See above for output.
EN

回答 1

Stack Overflow用户

发布于 2022-02-28 21:48:50

您是否检查过cargo是否在您的路径上,如错误消息所述?

添加到路径环境变量中,如下所示:

  1. Start菜单上,右击Computer.
  2. 在“上下文”菜单上,单击“属性”。
  3. 在“系统”对话框中,单击“高级系统设置”
  4. 在“系统属性”对话框的“高级”选项卡上,单击“环境变量”。
  5. 在“环境变量”对话框的“系统变量”框中,滚动到Path并选中它。
  6. 单击对话框中两个编辑按钮的下方。
  7. 编辑系统变量对话框中,滚动到变量值框中字符串的末尾,并添加分号(;)。
  8. 在分号之后添加cargo安装的路径。
  9. 在三个连续对话框中单击OK,然后关闭System对话框。

如果没有,请按照消息中的说明,确保它是从这里安装的。该链接包含这样做的说明。

如果问题仍然存在,请尝试通过

代码语言:javascript
复制
pip install --upgrade pip

然后运行命令,

代码语言:javascript
复制
pip install ipywidgets

正如这些答案对类似问题的建议。

如果错误消息仍然存在,或更改,请更新您的答案。

如果您提供了Pythonandpip版本,也会很有用。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71301060

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档