Win7下用pip安装JupyterLab等工具遇Rust相关错误的求助
Windows 7 64位 + Python 3.8.10安装Jupyter系列工具失败问题
在Windows 7 64位系统使用Python 3.8.10时,执行pip install jupyterlab、pip install notebook或pip install jupyter命令安装Jupyter相关工具均失败。已更新pip,且安装了Rust环境,但问题仍未解决,终端报错如下:
C:\Users\Mher>pip install jupyterlab Collecting jupyterlab Using cached jupyterlab-4.3.5-py3-none-any.whl.metadata (16 kB) Collecting async-lru>=1.0.0 (from jupyterlab) Using cached async_lru-2.0.4-py3-none-any.whl.metadata (4.5 kB) Collecting httpx>=0.25.0 (from jupyterlab) Using cached httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB) Collecting importlib-metadata>=4.8.3 (from jupyterlab) Using cached importlib_metadata-8.5.0-py3-none-any.whl.metadata (4.8 kB) Requirement already satisfied: importlib-resources>=1.4 in c:\users\mher\appdata\local\programs\python\python38\lib\site-packages (from jupyterlab) (6.4.5) Collecting ipykernel>=6.5.0 (from jupyterlab) Using cached ipykernel-6.29.5-py3-none-any.whl.metadata (6.3 kB) Collecting jinja2>=3.0.3 (from jupyterlab) Using cached jinja2-3.1.5-py3-none-any.whl.metadata (2.6 kB) Collecting jupyter-core (from jupyterlab) Using cached jupyter_core-5.7.2-py3-none-any.whl.metadata (3.4 kB) Collecting jupyter-lsp>=2.0.0 (from jupyterlab) Using cached jupyter_lsp-2.2.5-py3-none-any.whl.metadata (1.8 kB) Collecting jupyter-server<3,>=2.4.0 (from jupyterlab) Using cached jupyter_server-2.14.2-py3-none-any.whl.metadata (8.4 kB) Collecting jupyterlab-server<3,>=2.27.1 (from jupyterlab) Using cached jupyterlab_server-2.27.3-py3-none-any.whl.metadata (5.9 kB) Collecting notebook-shim>=0.2 (from jupyterlab) Using cached notebook_shim-0.2.4-py3-none-any.whl.metadata (4.0 kB) Requirement already satisfied: packaging in c:\users\mher\appdata\local\programs\python\python38\lib\site-packages (from jupyterlab) (24.2) Requirement already satisfied: setuptools>=40.8.0 in c:\users\mher\appdata\local\programs\python\python38\lib\site-packages (from jupyterlab) (56.0.0) Collecting tomli>=1.2.2 (from jupyterlab) Using cached tomli-2.2.1-py3-none-any.whl.metadata (10 kB) Collecting tornado>=6.2.0 (from jupyterlab) Using cached tornado-6.4.2-cp38-abi3-win_amd64.whl.metadata (2.6 kB) Collecting traitlets (from jupyterlab) Using cached traitlets-5.14.3-py3-none-any.whl.metadata (10 kB) Collecting typing-extensions>=4.0.0 (from async-lru>=1.0.0->jupyterlab) Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB) Collecting anyio (from httpx>=0.25.0->jupyterlab) Using cached anyio-4.5.2-py3-none-any.whl.metadata (4.7 kB) Requirement already satisfied: certifi in c:\users\mher\appdata\local\programs\python\python38\lib\site-packages (from httpx>=0.25.0->jupyterlab) (2025.1.31) Collecting httpcore==1.* (from httpx>=0.25.0->jupyterlab) Using cached httpcore-1.0.7-py3-none-any.whl.metadata (21 kB) Requirement already satisfied: idna in c:\users\mher\appdata\local\programs\python\python38\lib\site-packages (from httpx>=0.25.0->jupyterlab) (3.10) Collecting h11<0.15,>=0.13 (from httpcore==1.*->httpx>=0.25.0->jupyterlab) Using cached h11-0.14.0-py3-none-any.whl.metadata (8.2 kB) Requirement already satisfied: zipp>=3.20 in c:\users\mher\appdata\local\programs\python\python38\lib\site-packages (from importlib-metadata>=4.8.3->jupyterlab) (3.20.2) Collecting comm>=0.1.1 (from ipykernel>=6.5.0->jupyterlab) Using cached comm-0.2.2-py3-none-any.whl.metadata (3.7 kB) Collecting debugpy>=1.6.5 (from ipykernel>=6.5.0->jupyterlab) Using cached debugpy-1.8.12-cp38-cp38-win_amd64.whl.metadata (1.1 kB) Collecting ipython>=7.23.1 (from ipykernel>=6.5.0->jupyterlab) Using cached ipython-8.12.3-py3-none-any.whl.metadata (5.7 kB) Collecting jupyter-client>=6.1.12 (from ipykernel>=6.5.0->jupyterlab) Using cached jupyter_client-8.6.3-py3-none-any.whl.metadata (8.3 kB) Collecting matplotlib-inline>=0.1 (from ipykernel>=6.5.0->jupyterlab) Using cached matplotlib_inline-0.1.7-py3-none-any.whl.metadata (3.9 kB) Collecting nest-asyncio (from ipykernel>=6.5.0->jupyterlab) Using cached nest_asyncio-1.6.0-py3-none-any.whl.metadata (2.8 kB) Collecting psutil (from ipykernel>=6.5.0->jupyterlab) Using cached psutil-6.1.1-cp37-abi3-win_amd64.whl.metadata (23 kB) Collecting pyzmq>=24 (from ipykernel>=6.5.0->jupyterlab) Using cached pyzmq-26.2.1-cp38-cp38-win_amd64.whl.metadata (6.2 kB) Collecting MarkupSafe>=2.0 (from jinja2>=3.0.3->jupyterlab) Using cached MarkupSafe-2.1.5-cp38-cp38-win_amd64.whl.metadata (3.1 kB) Collecting platformdirs>=2.5 (from jupyter-core->jupyterlab) Using cached platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB) Collecting pywin32>=300 (from jupyter-core->jupyterlab) Using cached pywin32-308-cp38-cp38-win_amd64.whl.metadata (8.3 kB) Collecting argon2-cffi>=21.1 (from jupyter-server<3,>=2.4.0->jupyterlab) Using cached argon2_cffi-23.1.0-py3-none-any.whl.metadata (5.2 kB) Collecting jupyter-events>=0.9.0 (from jupyter-server<3,>=2.4.0->jupyterlab) Using cached jupyter_events-0.10.0-py3-none-any.whl.metadata (5.9 kB) Collecting jupyter-server-terminals>=0.4.4 (from jupyter-server<3,>=2.4.0->jupyterlab) Using cached jupyter_server_terminals-0.5.3-py3-none-any.whl.metadata (5.6 kB) Collecting nbconvert>=6.4.4 (from jupyter-server<3,>=2.4.0->jupyterlab) Using cached nbconvert-7.16.6-py3-none-any.whl.metadata (8.5 kB) Collecting nbformat>=5.3.0 (from jupyter-server<3,>=2.4.0->jupyterlab) Using cached nbformat-5.10.4-py3-none-any.whl.metadata (3.6 kB) Collecting overrides>=5.0 (from jupyter-server<3,>=2.4.0->jupyterlab) Using cached overrides-7.7.0-py3-none-any.whl.metadata (5.8 kB) Collecting prometheus-client>=0.9 (from jupyter-server<3,>=2.4.0->jupyterlab) Using cached prometheus_client-0.21.1-py3-none-any.whl.metadata (1.8 kB) Collecting pywinpty>=2.0.1 (from jupyter-server<3,>=2.4.0->jupyterlab) Using cached pywinpty-2.0.14.tar.gz (27 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 ╰─> [3 lines of output] Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', 'C:\\Users\\Mher\\AppData\\Local\\Temp\\pip-modern-metadata-erawveg3', '--interpreter', 'c:\\users\\mher\\appdata\\local\\programs\\python\\python38\\python.exe']' returned non-zero exit status 3221225477. Checking for Rust toolchain.... Running `maturin pep517 write-dist-info --metadata-directory C:\Users\Mher\AppData\Local\Temp\pip-modern-metadata-erawveg3 --interpreter c:\users\mher\appdata\local\programs\python\python38\python.exe` [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.
解决方法
从报错来看,问题出在pywinpty包的编译环节,Windows 7对最新版本的pywinpty兼容性不佳,可尝试以下方案:
指定兼容Windows 7的pywinpty版本安装
先安装旧版本的pywinpty,再安装Jupyter工具:pip install pywinpty==2.0.10 pip install jupyterlab强制使用预编译二进制包,避免本地编译
直接告诉pip只使用预编译的wheel文件,跳过编译步骤:pip install jupyterlab --only-binary :all:检查Rust环境配置
确保Rust的环境变量已生效,可重启终端后再尝试安装;或指定Rust工具链为稳定版:rustup default stable-x86_64-pc-windows-msvc
内容的提问来源于stack exchange,提问作者Mher
相关产品推荐
相关产品推荐

