Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix errors occurring on installation of Jupyter Notebook?

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.
like image 911
Jazz Avatar asked May 01 '21 06:05

Jazz


People also ask

How do I fix the Jupyter error on my laptop?

Try disabling any browser extensions and/or any Jupyter extensions you have installed. Some internet security software can interfere with Jupyter. If you have security software, try turning it off temporarily, and look in the settings for a more long-term solution.

What is the correct command to install in Jupyter notebook?

Code: 'pip install jupyter. ' Then it will start downloading the Jupyter, and it will install the Jupyter notebook.

How do you fix a name error in Jupyter notebook?

To solve this issue you have to just run the cell first that has import pandas as pd statement. Then run the other cell. It will clearly remove the nameerror name pd is not defined error. You can see you are now not getting any error.

Why Jupyter can’t Find my Notebook?

If Jupyter gives an error that it can’t find notebook, check with pip or conda that the notebook package is installed.,In this case, your pywin32 module may not be installed correctly and the following should be attempted:,Configuring the notebook frontend,Security in the Jupyter notebook server

How to install Jupyter in Python?

Temporarily, until standard way does not work for Python 3.7, you can install pywinpty manually by using the prebuilt wheel from Gohlke's collection and then install jupyter with pip. To install manually (from cmd or Powershell) use: pip install drive:\path o he\wheel\pywinpty-0.5.4-cp37-cp37m-win_amd64.whl

How do I add a Jupyter Notebook as an app?

Click " Allow an app through Controlled folder access ". Click on " Add an allowed app " and select your python.exe, jupyter.exe, and jupyter-notebook.exe files. You can find python.exe in your main Python installation directory and the other two in the " Scripts " subdirectory of your main Python installation directory.

What is a kernel error in Jupyter?

A kernel error occurs basically when you try opening a python 3 file in the wrong directory. The truth is Jupyter and Python are two different software entirely. So, a kernel error occurs when Jupyter fails to connect with a specific version of Python.


Video Answer


3 Answers

Do

pip install wheel

and try again. It worked for me.

like image 86
Tolun Tosun Avatar answered Oct 17 '22 02:10

Tolun Tosun


Upgrade your pip first:

pip install --upgrade pip

Then:

pip install jupyter
like image 42
Nayeem Avatar answered Oct 17 '22 01:10

Nayeem


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:

  • How do I determine if my python shell is executing in 32bit or 64bit?
  • pip install fails on Python 3.8 32-bit, prevents Jupyter install #129 which simply says that wheels cannot be installed with 32 bit Python and that you should use 64 bit Python instead.
  • We can't generate 32 bit wheels, sorry. Please use a 64bit build of Python.. Was not my case but might be useful this similar issue when using python 3.8 64-bit
  • Error installing Jupyter & pywinpty (Python)
  • https://github.com/spyder-ide/pywinpty/issues/123
like image 3
vperezb Avatar answered Oct 17 '22 01:10

vperezb