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:usersasdappdatalocalprogramspythonpython38-32python.exe
' 'c:usersasdappdatalocalprogramspythonpython38-32libsite-packagespip
_vendorpep517_in_process.py' prepare_metadata_for_build_wheel 'C:UsersasdAp
pDataLocalTemptmpnj_hhq6y'
cwd: C:UsersasdAppDataLocalTemppip-install-_pnki5r8pywinpty
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:usersasdappdatalocalprogr
amspythonpython38-32python.exe' 'c:usersasdappdatalocalprogramspythonp
ython38-32libsite-packagespip_vendorpep517_in_process.py' prepare_metadata
_for_build_wheel 'C:UsersasdAppDataLocalTemptmpnj_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:usersasdappdatalocalprogramspytho
npython38-32python.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:usersasdappdatalocalprogramspythonpython38-32python.exe'
'c:usersasdappdatalocalprogramspythonpython38-32libsite-packagespip_v
endorpep517_in_process.py' build_wheel 'C:UsersasdAppDataLocalTemptmpaj5
u66_y'
cwd: C:UsersasdAppDataLocalTemppip-install-mep4ye8dpywinpty
Complete output (60 lines):
Running `maturin pep517 build-wheel -i c:usersasdappdatalocalprogramspyt
honpython38-32python.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 --`
dYx8d1 Building a mixed python/rust project
dY"- Found pyo3 bindings
dYx90x8d Found CPython 3.8 at c:usersasdappdatalocalprogramspythonpyt
hon38-32python.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:usersasdappdatalocalprogramspytho
npython38-32python.exe -m pip install --upgrade pip' command.
First update if using linux system:
sudo apt-get update
sudo apt-get upgrade
Restart the system and try below steps:
Installing Jupyter with pip
As an existing or experienced Python user, you may wish to install Jupyter using Python’s package manager, pip, instead of Anaconda.
If you have Python 3 installed (which is recommended):
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install jupyter
If you have Python 2 installed:
sudo python -m pip install --upgrade pip
sudo python -m pip install jupyter
Congratulations, you have installed Jupyter Notebook! To run the notebook, run the following command at the Terminal (Mac/Linux) or Command Prompt (Windows Run CMD in Admin):
jupyter notebook
Хочу скачать Jupyter Notebook через pip, ввожу в командной строке «python -m pip install notebook», вроде начинает скачиваться, а потом выдаёт ошибку.
Я только начал вливаться в Python и программирование, по-этому, если можно, подетальнее объясните, пожалуйста, что делать)))
-
Вопрос заданболее двух лет назад
-
707 просмотров
pip3 install jupyter
sudo apt install jupyter-core
sudo jupyter notebook —allow-root
i tried to download jupyter notebook directly on Ubuntu 20, but giving this following error
Traceback (most recent call last):
File «/usr/bin/jupyter», line 11, in
load_entry_point(‘jupyter-core==4.6.3’, ‘console_scripts’, ‘jupyter’)()
File «/home/ankit/.local/lib/python3.8/site-packages/jupyter_core/command.py», line 247, in main
command = _jupyter_abspath(subcommand)
File «/home/ankit/.local/lib/python3.8/site-packages/jupyter_core/command.py», line 133, in _jupyter_abspath
raise Exception(
Exception: Jupyter command jupyter-notebook
not found.
how to fixed this
First, have a look at the common problems listed below. If you can figure it out
from these notes, it will be quicker than asking for help.
Check that you have the latest version of any packages that look relevant.
Unfortunately it’s not always easy to figure out what packages are relevant,
but if there was a bug that’s already been fixed,
it’s easy to upgrade and get on with what you wanted to do.
Jupyter fails to start
-
Have you installed it?
-
If you’re using a menu shortcut or Anaconda launcher to start it, try
opening a terminal or command prompt and running the commandjupyter notebook
. -
If it can’t find
jupyter
,
you may need to configure yourPATH
environment variable.
If you don’t know what that means, and don’t want to find out,
just (re)install Anaconda with the default settings,
and it should set up PATH correctly. -
If Jupyter gives an error that it can’t find
notebook
,
check with pip or conda that thenotebook
package is installed. -
Try running
jupyter-notebook
(with a hyphen). This should normally be the
same asjupyter notebook
(with a space), but if there’s any difference,
the version with the hyphen is the ‘real’ launcher, and the other one wraps
that.
Jupyter doesn’t load or doesn’t work in the browser
-
Try in another browser (e.g. if you normally use Firefox, try with Chrome).
This helps pin down where the problem is. -
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. -
In the address bar, try changing between
localhost
and127.0.0.1
.
They should be the same, but in some cases it makes a difference.
Jupyter can’t start a kernel
Files called kernel specs tell Jupyter how to start different kinds of kernels.
To see where these are on your system, run jupyter kernelspec list
:
$ jupyter kernelspec list Available kernels: python3 /home/takluyver/.local/lib/python3.6/site-packages/ipykernel/resources bash /home/takluyver/.local/share/jupyter/kernels/bash ir /home/takluyver/.local/share/jupyter/kernels/ir
There’s a special fallback for the Python kernel:
if it doesn’t find a real kernelspec, but it can import the ipykernel
package,
it provides a kernel which will run in the same Python environment as the notebook server.
A path ending in ipykernel/resources
, like in the example above,
is this default kernel.
The default often does what you want,
so if the python3
kernelspec points somewhere else
and you can’t start a Python kernel,
try deleting or renaming that kernelspec folder to expose the default.
If your problem is with another kernel, not the Python one we maintain,
you may need to look for support about that kernel.
Python Environments
Multiple python environments, whether based on Anaconda or Python Virtual environments,
are often the source of reported issues. In many cases, these issues stem from the
Notebook server running in one environment, while the kernel and/or its resources,
derive from another environment. Indicators of this scenario include:
-
import
statements within code cells producingImportError
orModuleNotFound
exceptions. -
General kernel startup failures exhibited by nothing happening when attempting
to execute a cell.
In these situations, take a close look at your environment structure and ensure all
packages required by your notebook’s code are installed in the correct environment.
If you need to run the kernel from different environments than your Notebook
server, check out IPython’s documentation
for using kernels from different environments as this is the recommended approach.
Anaconda’s nb_conda_kernels
package might also be an option for you in these scenarios.
Another thing to check is the kernel.json
file that will be located in the
aforementioned kernel specs directory identified by running jupyter kernelspec list
.
This file will contain an argv
stanza that includes the actual command to run
when launching the kernel. Oftentimes, when reinstalling python environments, a previous
kernel.json
will reference an python executable from an old or non-existent location.
As a result, it’s always a good idea when encountering kernel startup issues to validate
the argv
stanza to ensure all file references exist and are appropriate.
Windows Systems
Although Jupyter Notebook is primarily developed on the various flavors of the Unix
operating system it also supports Microsoft
Windows — which introduces its own set of commonly encountered issues,
particularly in the areas of security, process management and lower-level libraries.
pywin32 Issues
The primary package for interacting with Windows’ primitives is pywin32
.
-
Issues surrounding the creation of the kernel’s communication file utilize
jupyter_core
’ssecure_write()
function. This function ensures a file is
created in which only the owner of the file has access. If libraries likepywin32
are not properly installed, issues can arise when it’s necessary to use the native
Windows libraries.Here’s a portion of such a traceback:
File "c:usersjovyanpythonmyenv.venvlibsite-packagesjupyter_corepaths.py", line 424, in secure_write win32_restrict_file_to_user(fname) File "c:usersjovyanpythonmyenv.venvlibsite-packagesjupyter_corepaths.py", line 359, in win32_restrict_file_to_user import win32api ImportError: DLL load failed: The specified module could not be found.
-
As noted earlier, the installation of
pywin32
can be problematic on Windows
configurations. When such an issue occurs, you may need to revisit how the environment
was setup. Pay careful attention to whether you’re running the 32 or 64 bit versions
of Windows and be sure to install appropriate packages for that environment.Here’s a portion of such a traceback:
File "C:UsersjovyanAppDataRoamingPythonPython37site-packagesjupyter_corepaths.py", line 435, in secure_write win32_restrict_file_to_user(fname) File "C:UsersjovyanAppDataRoamingPythonPython37site-packagesjupyter_corepaths.py", line 361, in win32_restrict_file_to_user import win32api ImportError: DLL load failed: %1 is not a valid Win32 application
Resolving pywin32 Issues
In this case, your
pywin32
module may not be installed correctly and the following
should be attempted:pip install --upgrade pywin32or:
conda install --force-reinstall pywin32followed by:
python.exe Scripts/pywin32_postinstall.py -installwhere
Scripts
is located in the active Python’s installation location.
-
Another common failure specific to Windows environments is the location of various
python commands. On*nix
systems, these typically reside in thebin
directory
of the active Python environment. However, on Windows, these tend to reside in the
Scripts
folder — which is a sibling tobin
. As a result, when encountering
kernel startup issues, again, check theargv
stanza and verify it’s pointing to a
valid file. You may find that it’s pointing inbin
whenScripts
is correct, or
the referenced file does not include its.exe
extension — typically resulting in
FileNotFoundError
exceptions.
This Worked An Hour Ago
The Jupyter stack is very complex and rightfully so, there’s a lot going on. On occassion
you might find the system working perfectly well, then, suddenly, you can’t get past a
certain cell due to import
failures. In these situations, it’s best to ask yourself
if any new python files were added to your notebook development area.
These issues are usually evident by carefully analyzing the traceback produced in
the notebook error or the Notebook server’s command window. In these cases, you’ll typically
find the Python kernel code (from IPython
and ipykernel
) performing its imports
and notice a file from your Notebook development error included in that traceback followed
by an AttributeError
:
File "C:Usersjovyananaconda3libsite-packagesipykernelconnect.py", line 13, in from IPython.core.profiledir import ProfileDir File "C:Usersjovyananaconda3libsite-packagesIPython_init.py", line 55, in from .core.application import Application ... File "C:Usersjovyananaconda3libsite-packagesipython_genutilspath.py", line 13, in import random File "C:UsersjovyanDesktopNotebooksrandom.py", line 4, in rand_set = random.sample(english_words_lower_set, 12) AttributeError: module 'random' has no attribute 'sample'
What has happened is that you have named a file that conflicts with an installed package
that is used by the kernel software and now introduces a conflict preventing the
kernel’s startup.
Resolution: You’ll need to rename your file. A best practice would be to prefix or
namespace your files so as not to conflict with any python package.
Asking for help
As with any problem, try searching to see if someone has already found an answer.
If you can’t find an existing answer, you can ask questions at:
-
The Jupyter Discourse Forum
-
The jupyter-notebook tag on Stackoverflow
-
Peruse the jupyter/help repository on Github (read-only)
-
Or in an issue on another repository, if it’s clear which component is
responsible. Typical repositories include:-
jupyter_core —
secure_write()
and file path issues -
jupyter_client — kernel management
issues found in Notebook server’s command window. -
IPython and
ipykernel — kernel runtime issues
typically found in Notebook server’s command window and/or Notebook cell execution.
-
Gathering Information
Should you find that your problem warrants that an issue be opened in
notebook please don’t forget to provide details
like the following:
-
What error messages do you see (within your notebook and, more importantly, in
the Notebook server’s command window)? -
What platform are you on?
-
How did you install Jupyter?
-
What have you tried already?
The jupyter troubleshoot
command collects a lot of information
about your installation, which can also be useful.
When providing textual information, it’s most helpful if you can scrape the contents
into the issue rather than providing a screenshot. This enables others to select
pieces of that content so they can search more efficiently and try to help.
Remember that it’s not anyone’s job to help you.
We want Jupyter to work for you,
but we can’t always help everyone individually.