21

I am new to Python and try to install Jupyter Notebook from within a Windows command prompt window using:

pip install jupyter

But after a couple of minutes of downloading, an error message is displayed as shown below:

  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\asd\appdata\local\programs\python\python38-32\python.exe
' 'c:\users\asd\appdata\local\programs\python\python38-32\lib\site-packages\pip\
_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\asd\Ap
pData\Local\Temp\tmpnj_hhq6y'
         cwd: C:\Users\asd\AppData\Local\Temp\pip-install-_pnki5r8\pywinpty
    Complete output (6 lines):

    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....
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\asd\appdata\local\progr
ams\python\python38-32\python.exe' 'c:\users\asd\appdata\local\programs\python\p
ython38-32\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata
_for_build_wheel 'C:\Users\asd\AppData\Local\Temp\tmpnj_hhq6y' Check the logs for
full command output.
WARNING: You are using pip version 20.2.1; however, version 21.1 is available.
You should consider upgrading via the 'c:\users\asd\appdata\local\programs\pytho
n\python38-32\python.exe -m pip install --upgrade pip' command.

I have attached here just the last part of the error output.

How to fix this error for a successful installation of Jupyter Notebook?


EDIT1: I installed the Rust package from the link in the error message. After that I tried installing Jupyter Notebook once again, and this time after proceeding a few steps further than before, it output another error:

Building wheels for collected packages: pywinpty
  Building wheel for pywinpty (PEP 517) ... -  WARNING: Subprocess output does
not appear to be encoded as cp1252
  WARNING: Subprocess output does not appear to be encoded as cp1252
error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\asd\appdata\local\programs\python\python38-32\python.exe'
'c:\users\asd\appdata\local\programs\python\python38-32\lib\site-packages\pip\_v
endor\pep517\_in_process.py' build_wheel 'C:\Users\asd\AppData\Local\Temp\tmpaj5
u66_y'
       cwd: C:\Users\asd\AppData\Local\Temp\pip-install-mep4ye8d\pywinpty
  Complete output (60 lines):
  Running `maturin pep517 build-wheel -i c:\users\asd\appdata\local\programs\pyt
hon\python38-32\python.exe`
     Compiling proc-macro2 v1.0.26
     Compiling unicode-xid v0.2.2
     Compiling syn v1.0.71
     Compiling winapi v0.3.9
     Compiling jobserver v0.1.22
  error: could not compile `proc-macro2`

  To learn more, run the command again with --verbose.
  warning: build failed, waiting for other jobs to finish...
  error: build failed
  dY'¥ maturin failed
    Caused by: Failed to build a native library through cargo
    Caused by: Cargo build finished with "exit code: 101": `cargo rustc --messag
e-format json --manifest-path Cargo.toml --release --lib --`
  dY\x8d1 Building a mixed python/rust project
  dY"- Found pyo3 bindings
  dY\x90\x8d Found CPython 3.8 at c:\users\asd\appdata\local\programs\python\pyt
hon38-32\python.exe
  error: linker `link.exe` not found
    |
    = note: The system cannot find the file specified. (os error 2)


  note: the msvc targets depend on the msvc linker but `link.exe` was not found


  note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option


  error: aborting due to previous error


  error: linker `link.exe` not found
    |
    = note: The system cannot find the file specified. (os error 2)


  note: the msvc targets depend on the msvc linker but `link.exe` was not found


  note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option


  error: aborting due to previous error


  error: linker `link.exe` not found
    |
    = note: The system cannot find the file specified. (os error 2)


  note: the msvc targets depend on the msvc linker but `link.exe` was not found


  note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option


  error: aborting due to previous error


  Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'c:\\users\\asd\\app
data\\local\\programs\\python\\python38-32\\python.exe'] returned non-zero exit
status 1
  ----------------------------------------
  ERROR: Failed building wheel for pywinpty
Failed to build pywinpty
ERROR: Could not build wheels for pywinpty which use PEP 517 and cannot be insta
lled directly
WARNING: You are using pip version 20.2.1; however, version 21.1 is available.
You should consider upgrading via the 'c:\users\asd\appdata\local\programs\pytho
n\python38-32\python.exe -m pip install --upgrade pip' command.
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Jazz
  • 211
  • 1
  • 2
  • 5
  • You can install [Anaconda](https://docs.anaconda.com/anaconda/install/windows/), Jupyter comes with it. – nobleknight May 01 '21 at 06:21
  • Which pages have you read from [Jupyter Documentation](https://jupyter.readthedocs.io/en/latest/)? Have you clicked on [Project-wide Documentation](https://jupyter.readthedocs.io/en/latest/)? Have you clicked on [Get started with Jupyter Notebook](https://jupyter.readthedocs.io/en/latest/content-quickstart.html)? Have you clicked on [Are You Ready to Install Jupyter?](https://jupyter.readthedocs.io/en/latest/tryjupyter.html#are-you-ready-to-install-jupyter) Have you clicked on [Installation Guide](https://jupyter.readthedocs.io/en/latest/install.html#install)? – Mofi May 01 '21 at 09:22
  • Or have you read at least the page [Installing the Jupyter Software](https://jupyter.org/install)? Do you know how environment variables are managed on Windows as described extensively by my answer on [What is the reason for "X is not recognized as an internal or external command, operable program or batch file"?](https://stackoverflow.com/a/41461002/3074564) It often fails to install multiple Python packages within __one__ command prompt window in series. – Mofi May 01 '21 at 09:29
  • 1
    We shouldn't need rust (cargo) for python packages .. seems wrong. – kev Feb 15 '23 at 04:24
  • @kev I've got the same thing now suddenly, after using Jupyter for years. Where is this coming from? Do I really need to install Rust now (where how why, how do I maintain it) in order to use Jupyter? Will this now start failing in all my CI and Binder installs? – orome Feb 20 '23 at 14:14

7 Answers7

5

Upgrade your pip first:

pip install --upgrade pip

Then:

pip install jupyter
Nayeem
  • 53
  • 1
  • 5
5

I'reached this post after failing to install notebook on a 32-bit python 3.8.3 execution. And as far as I found, pywinpty, which is a dependence, does not support 32-bit executions (see sources below).

I solved the problem by installing python on its 64-bit version.

Sources:

Abel
  • 56,041
  • 24
  • 146
  • 247
vperezb
  • 373
  • 4
  • 7
3

Do

pip install wheel

and try again. It worked for me.

Tolun Tosun
  • 191
  • 1
  • 2
  • 4
1

What to do:

  1. Check if your python is 64-bit version. If no, go to python site (for example, here is the link to download 3.7.9. Just click at the version that has label "for AMD64/EM64T/x64", do it with any version you wish, just I don't like to use the newest version). Remove yours (with the uninstall file) and download this. Don't forget to put the checkmark near "Add PATH" below;
  2. Download Rust (the description is inside) - you need some files. Check the PATHs - if you want to change them, do it (the names of the variables and where they are - both are written, you can search in the Internet how to change PATH var's (for example));
  3. Go to Windows Shell with admin mode (Win+X and you get the field) - here is the most comfortable place to work;
  4. Go to your python.exe (for example, my way is C:\Users\user\AppData\Local\Programs\Python\Python37) - just for sure;
  5. python.exe python -m pip install --upgrade pip;
  6. python.exe pip install jupyter;
  7. If an error was returned that contains the missing of wheel, try to download it: python.exe pip install wheel.

Donwload any library you miss during installation and continue since the step you stopped at.

Beholder
  • 111
  • 8
-1

Try using Anaconda. link to install conda https://www.anaconda.com/products/individual then cmd : conda install numpy cmd: conda install jupyter cmd : jupyter notebook

-2

The error message looks quite clear, you needs to install Cargo via https://rustup.rs/

  • 3
    I installed following the link, but still I got other errors as I have attached in the edit – Jazz May 01 '21 at 07:01
-2

I have faced the same issue when I'm using vscode. The simplest solution is to use conda instead of pip

conda install jupyterlab

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32374699) – Trenton McKinney Aug 05 '22 at 22:55
  • This is not helpful. If they have the Anaconda distribution, `jupyterlab` is already installed, and `conda install jupyterlab` is not required. It's clear from the path in the OP, that Anaconda is not being used. As such, this does not answer the question that was asked. Additionally, there is already a downvoted [answer](https://stackoverflow.com/a/67343436/7758804) to use Anaconda, and more appropriately, a [comment](https://stackoverflow.com/questions/67343397/how-to-fix-errors-occurring-on-installation-of-jupyter-notebook/73182010#comment119033197_67343397) doing the same. – Trenton McKinney Aug 05 '22 at 23:46