Shamso Osman
Shamso Osman

Reputation: 1

Error when installing ipywidgets jupyterlab extension on windows 10. I get this error message generated. Any way to go about it?

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.

My pip version is 22.0.3, python version 3.8.0 the error persists even though i installed (abd followed the instructions)from the link in the error message provided.

this is my cargo version

PS C:\Users\Shamsa> cargo -V
cargo 1.59.0 (49d8809dc 2022-02-10)

and installed rustup

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)

UPDATE ON THE ERROR

i haven't changed anything, just ran the command pip install ipywidgets again and it generated this error

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.

Upvotes: 0

Views: 2830

Answers (1)

Sakura
Sakura

Reputation: 21

Have you checked that cargo is on your PATH as stated by the error message?

Add to the PATH environment variable like so:

  1. On the Start menu, right-click Computer.
  2. On the context menu, click Properties.
  3. In the System dialogue box, click Advanced system settings.
  4. On the Advanced tab of the System Properties dialogue box, click Environment Variables.
  5. In the System Variables box of the Environment Variables dialogue box, scroll to Path and select it.
  6. Click the lower of the two Edit buttons in the dialogue box.
  7. In the Edit System Variable dialogue box, scroll to the end of the string in the Variable value box and add a semicolon (;).
  8. Add the path to your cargo installation after the semicolon.
  9. Click OK in three successive dialogue boxes, and then close the System dialogue box.

If not, make sure it is installed from here as stated in the message. The link contains instructions for doing so.

If the issue persists, try upgrading pip via,

pip install --upgrade pip

Then run the command,

pip install ipywidgets

As suggested by these answers to a similar question.

If the error message persists, or changes, please update your answer.

It would also be useful if you provided your Python and pip versions.

Upvotes: 1

Related Questions