Running Jupyter via command line on Windows - python

I have installed Jupyter on Windows 10, Python 3.x via
$ pip install jupyter
The installation works fine, even though I did restart the terminal.
But trying to run
$ jupyter notebook
gives the following error
'jupyter' is not recognized as an internal or external command, operable program or batch file.
How and where do I find the executable for Jupyter?

If you are absolutely sure that your Python library path is in your system variables (and you can find that path when you pip install Jupyter, you just have to read a bit) and you still experience "command not found or recognized" errors in Windows, you can try:
python -m notebook
For my Windows at least (Windows 10 Pro), having the python -m is the only way I can run my Python packages from command line without running into some sort of error
Fatal error in launcher: Unable to create process using ' "
or
Errno 'THIS_PROGRAM' not found

Please try either of these commands first;
$ py -m notebook
$ python -m notebook
for jupyterlab users
py -m jupyterlab
Otherwise
$ python -m pip install jupyter --user
$ jupyter notebook
If this does not work.
pip does not add jupyter directly to path for local.
The output from
$ which python
/c/Users/<username>/AppData/Local/Programs/Python/Python35-32/python
After some digging I found a executable for jupyter in the folder:
C:\Users\<username>\AppData\Roaming\Python\Python35\Scripts\jupyter.exe
Difference between local and roaming folder
So if you want to be able to execute a program via command line, you need to add it into the %PATH variable. Here is a powershell script to do it. BE SURE TO ADD THE ";" before adding the new path.
$ [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Users\<username>\AppData\Roaming\Python\Python35\Scripts", [EnvironmentVariableTarget]::User)
Update:
if you are using python3, switch out python with python3
but I encourage you to use pyenv instead :)

I had the exact same problem and it was driving me crazy. Other answers provide a solution, but they don't explain why you and I are having this problem.
I will try to explain why this is happening and then provide some solutions.
You can go to the end to see the TL;DR.
1)What's going on? Why is this error happening?
I'll try to make a step-by-step answer so everything is explained clearly.
If you think it's too basic at the beginning, go to the end of this "article".
I'll first start with common things like running the python shell from the terminal or running pip. You'll see why you can do that from the terminal and we'll end up on why and how you can run the jupyter notebook from the terminal as well.
Ready? Let's start!
Have you ever wondered why you can type python in the terminal (command prompt) and suddenly start the Python interpreter?
Microsoft Windows [Version 10.0.18363.1440]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\YOUR-USERNAME>python
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
You probably already know (but maybe don't) that this is because Python was added to the Windows PATH environment variable. You probably did it at installation time or afterwards.
But, what is this PATH environment variable?
It basically allows you to run any executables, that are located inside
the paths specified in the variable, at the command prompt without
having to give the full path to the executable.
You can check the content of that PATH variable with:
>>> import sys
>>> for path in sys.path:
print(path)
C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\python39.zip
C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\DLLs
C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\lib
C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39
C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\lib\site-packages
... (some other paths were taken out for clarity)
You can see this folder: C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39. This is the place where Python version 3.9 is installed. Let's check its content:
<DIR> DLLs
<DIR> Doc
<DIR> etc
<DIR> include
<DIR> Lib
<DIR> libs
<DIR> Scripts
<DIR> share
<DIR> tcl
<DIR> Tools
LICENSE.txt
NEWS.txt
python.exe
python3.dll
python39.dll
pythonw.exe
vcruntime140.dll
vcruntime140_1.dll
Voilà! We have the python.exe file (an executable). We have a Python executable file in the PATH, that's why you can start the Python interpreter from the terminal with just typing python. If this wasn't the case you would have to type the full path to the executable file in the terminal:
C:\Users\YOUR-USERNAME> C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\python)
Instead of just:
C:\Users\YOUR-USERNAME> python
And what about when you use pip?
It's the same principle. You can run pip from the terminal because there is a pip executable file in the PATH variable.
If you go to C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\Scripts\ (which is in the PATH showed above) you'll see many executables files. One of them is pip. Actually I have three versions: pip, pip3.9 and pip3.
The Scripts folder allows exectuable files to be run from the terminal. Like pip or other libraries that you intend to run directly from the terminal. The Scripts folder:
...is not intended for you, it's for scripts that are installed as
components of modules that you install. For example, pip is a module,
but it also has a wrapper script by the same name, pip, which will be
installed in that directory.
If you put something there and it is properly in your PATH, then it
should be executable
That wrapper script would be the pip executable file. When this executable file is run, it locates the pip folder in the Python installation folder and runs pip.
But you could also run pip directly from the installation folder (C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\Lib\site-packages), without needing the executable pip file.
But, how can you do it?
I'm glad you ask. There is a Python way to run modules as the main module (without the need to import it).
python -m pip
When you run a module directly its name becomes __main__. What -m does is:
Search sys.path for the named module and execute its contents as the __main__ module.
What is __main__?
'__main__' is the name of the scope in which top-level code executes.
A module’s __name__ is set equal to '__main__' when read from standard
input, a script, or from an interactive prompt.
...
I guess that the pip executable does something similar, or at least, has the same effect: to start pip.
2)What does this have to do with the Jupyter Notebook?!
Think of the Jupyter Notebook as the same as pip. If you want to run jupyter in the terminal, you need an executable that it's on the PATH.
We have already seen that the executables of modules like pip or jupyter are located here C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\Scripts\.
If I check the content of the folder I see this:
easy_install-3.9.exe
easy_install.exe
f2py.exe
jsonschema.exe
jupyter-bundlerextension.exe
jupyter-console.exe
jupyter-nbconvert.exe
jupyter-nbextension.exe
jupyter-notebook.exe
jupyter-qtconsole.exe
jupyter-serverextension.exe
jupyter-trust.exe
pip.exe
pip3.9.exe
pip3.exe
I see the already mentioned pip, pip3.9 and pip3. But I don't see jupyter (the word "jupyter" alone).
If I type jupyter in the terminal I get the error that started all:
'jupyter' is not recognized as an internal or external command, operable program or batch file.
Finally we've reached an answer to your question!!!
'jupyter' is not recognized as a command because there is no executable file in the Scripts folder called jupyter.
So, let's try a different executable. What about jupyter-notebook?
BINGO! The notebook is running!
Serving notebooks from local directory:
C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\Scripts
Jupyter Notebook 6.3.0 is running at:
http://localhost:8888/?token=... (edited)
or http://127.0.0.1:8888/?token=... (edited)
Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
I don't know why I don't have a jupyter executable called 'jupyter'. The official documentation says to use jupyter notebook on the terminal, but it seems that in some cases it doesn't work. And I think it has to do with what I mentioned above: there is no jupyter exectuable in the Scripts folder.
If you remember, I told you that you can run pip as the main module using python -m pip.
It happens that you can do the same with jupyter.We just need to know how to call it. As in with pip, we have to check the folder where 3rd party libraries are installed: C:\Users\YOUR-USERNAME\AppData\Local\Programs\Python\Python39\Lib\site-packages.
You'll see jupyter_console, but this just creates an interactive notebook in the terminal, not exactly what you were looking for. You're also going to find folders ending with .dist.info, like jupyter_console-6.4.0.dist-info. This is just metadata of the Wheel Binary Package builder. You'll also see a folder like jupyterlab_pygments, but that's for JupyterLab. We want to use the classic Jupyter notebook.
What we want is to run notebook. How do we know this?
You'll see in the folder site-packages the folder (package) notebook. Inside there is a file called __main__.py:
#__main__.py
if __name__ == '__main__':
from notebook import notebookapp as app
app.launch_new_instance()
It's calling notebookapp.py which is a "A tornado based Jupyter notebook server." Yes, this is what we need.
We can see that launch_new_instance in the notebookapp calls launch_instance(), which "launches an instance of a Jupyter Application".
Perfect! We are in the correct folder. To run the jupyter notebook from the Python interactive shell we have to run the notebook package with:
python -m notebook
3)*** SUMMARY: SOLUTION ***
tl;dr:
I have explained and showed why this error is happening.
Now let's summarize the solutions:
To know the name of the jupyter executable (in the Scripts folder), so you can run directly from the terminal (Command Prompt) as:
jupyter notebook
or as:
jupyter-notebook
Or whatever name you have.
Run the notebook as the main module from Python:
python -m notebook
I hope this helps you as much as it helped me. I'm open to your comments and suggestions.

I had the same problem, but
py -m notebook
worked for me.

I got Jupyter notebook running in Windows 10. I found the easiest way to accomplish this task without relying upon a distro like Anaconda was to use Cygwin.
In Cygwin install python2, python2-devel, python2-numpy, python2-pip, tcl, tcl-devel, (I have included a image below of all packages I installed) and any other python packages you want that are available. This is by far the easiest option.
Then run this command to just install jupyter notebook:
python -m pip install jupyter
Below is the actual commands I ran to add more libraries just in case others need this list too:
python -m pip install scipy
python -m pip install scikit-learn
python -m pip install sklearn
python -m pip install pandas
python -m pip install matplotlib
python -m pip install jupyter
If any of the above commands fail do not worry the solution is pretty simple most of the time. What you do is look at the build failure for whatever missing package / library.
Say it is showing a missing pyzmq then close Cygwin, re-open the installer, get to the package list screen, show "full" for all, then search for the name like zmq and install those libraries and re-try the above commands.
Using this approach it was fairly simple to eventually work through all the missing dependencies successfully.
Cygwin package list
Once everything is installed then run in Cygwin goto the folder you want to be the "root" for the notebook ui tree and type:
jupyter notebook
This will start up the notebook and show some output like below:
$ jupyter notebook
[I 19:05:30.459 NotebookApp] Serving notebooks from local directory:
[I 19:05:30.459 NotebookApp] 0 active kernels
[I 19:05:30.459 NotebookApp] The Jupyter Notebook is running at:
[I 19:05:30.459 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Copy/paste this URL into your browser when you connect for the first time, to login with a token:
http://localhost:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In Python 3.7.6 for Windows 10. After installation, I use these commands.
1. pip install notebook
2. python -m notebook
OR
C:\Users\Hamza\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts
.
For my pc python-scripts are located in the above path. You can add this path in environment variables. Then run command.
1. jupyter notebook

You can add the following to your path
C:\[Python Installation path]\Scripts
e.g. C:\Python27\Scripts
It will start working for jupyter and every other pip install you will do here on.

Check whether you have given python PATH in environmental variables properly.
If not, then set python path. Then use:
$ python -m notebook

If you are using the Anaconda distribution, make sure when installing it that you check the "Change PATH" option.

first you should make sure that you are put your python path in your system variables ..
Then try run this
python -m pip install jupyter --user
and then
run this
py -m notebook or jupyter notebook

In Windows 10 you can use ipython notebook. It works for me.

I added
c:\users\[user]\appdata\roaming\python\python37\site-packages
to the path and it worked.

## windows CMD
for default install (just check "add path" and "next" when installing)
python -m notebook
for custom install in C:\
jupyter notebook

Problem for me was that I was running the jupyter command from the wrong directory.
Once I navigated to the path containing the script, everything worked.
Path-
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts

I have two python version installed:
1. Python 3.8.2: This was installed independently
2. Python 3.7.6: This was installed along with Anaconda 3
Multiple versions caused conflict even after setting the path variables correctly.
I have uninstalled the Python 3.8.2 and after restart, the command
jupyter notebook
Worked perfectly :)

you can create a batch file and search for Jupiter in your windows search and ooen its properties and you will get this string.
D:\anaconda3\python.exe D:\anaconda3\cwp.py D:\anaconda3 D:\anaconda3\python.exe D:\anaconda3\Scripts\jupyter-notebook-script.py "%USERPROFILE%/"
after getting this you can create a jupitor.bat file with this content it that
and you can save that file in a script folder in d or any drive and add the path of your script file in your environmental path
and then you can easly call this by typing jupitor in cmd.

To install I used
"pip install notebook" in windows command line
To run python -m notebook did not work for me, but python3 -m notebook worked

First run this command
pip install jupyter
then add system variable path , this path is where jupyter and other scripts are located
PATH = C:\Users<userName>\AppData\Roaming\Python\Python38\Scripts
e.g PATH=C:\Users\HP\AppData\Roaming\Python\Python38\Scripts
After that we can run jupyter from any folder/directory
jupyter notebook

I just found that error when I first intalled and run the jupyter notebook. Then I found the executable (.exe) file from
C:\Users\<user-name>\AppData\Local\Programs\Python\Python39\Scripts.
The actual file name was "jupyter-notebook".
The installation guide says it as "jupyter notebook" to run the server. You have to run the command "jupyter-notebook" in the command line and it will be run. Thanks!

My problem was my user's folder had a space in folder name.
After creating a new user and switching to that windows user, windows shortcuts and links from within' Anaconda worked fine.
Windows 8.1 64 Bit. Latest Anaconda.
Note: I ended up uninstalling an reinstalling Anaconda but my sense is the problem was really just the space in the windows user username/user folder.

Using python 3.6.3. Here after installing Jupyter through command 'python -m pip install jupyter', 'jupyter notebook' command didn't work for me using windows command prompt.
But, finally 'python -m notebook' did work and made jupyter notebook to run on local.
http://localhost:8888/tree

Here is how I resolved stated issue, hope it helps:
install python 3.7 using official website for python, while installing include installing PATH by checking it's box
after that open cmd (be sure to open it after step 1) and write: pip install jupyter ENTER
now you should be able to open jupyter notebook by using command: jupyter notebook
Seems simple, but it may as well help.

In windows 10:
If you used anaconda3 for Jupyter notebook installation and forgot to check the box to add the environment variables to the system during installation, you need to add the following environment variables to the "Path" variable manually:
(search windows settings for Edit environment variables")
Environment variables for Anaconda3

If you have installed jupyter with
"python -m pip install jupyter" command
instead of
"$ pip install jupyter" command
then follow these steps:
Create a notepad
Change its extension from ".txt" to ".ipynb"
Right click it and click "open with"
In the pop up, go to - C:\Users\<"windows_user_name">\AppData\Roaming\Python\Python38\Scripts
Click on "jupyter-lab.exe"

100% working solution:
Follow these steps:
Open the folder where you downloaded "python-3.8.2-amd64.exe" setup or any other version of python package
Double click on "python-3.8.2-amd64.exe'
Click "Modify"
You will see "Optional features"
Click "next"
Select "Add python to environment variables"
Click "install"
Then u can run jupyter in any desired folder u desire
E.g open "cmd" command prompt
Type :
E:
E:\>jupyter notebook
It will get started without showing
'Jupyter' is not recognized
Thanks

I was facing the same issue in windows7, as i just recoverd my computer with the help of recovery point and after that notebook just stopped working. I tried to change the path setting but nothing was working so I just simply uninstalled the python with the application from which it was installed and after that I installed it again. After that I installed jupyter notebook again and then it worked fine.
Thanks

I just installed JupyterLab on top of my Python 3.8/pip enabled Win10 machine, so I ran into these startup problem with windows.
If everything is ok (check that you have PATH for Python, eg. C:\Users[Username]\AppData\Local\Programs\Python\Python38-32\Scripts) you simply run:
jupyter-lab.exe
and that's it.
Cheers

Add system variable path, this path is where jupyter and other scripts are located
PATH -->
`C:\Users\<userName>\AppData\Roaming\Python\Python39\Scripts`
Like in my laptop PATH is:
"C:\Users\developer\AppData\Roaming\Python\Python39\Scripts"
After that, You will be able to run jupyter from any folder & any directory by running the below command
jupyter notebook

Had the same issue. Finally searched where jupyter.exe directory was located on my computer. For some reason it was under
C:\VTRoot\HarddiskVolume4\Users[user]\AppData\Local\Programs\Python
Whereas the Python is
C:\Users[user]\AppData\Local\Programs\Python
So I copied full Python39 folder from VTRoot to main Python39 python folder in AppData. And the issue is solved.

First check where your python is installed by heading over to
C:\Users\**username**\AppData\Local\Programs\Python\Python39\Scripts
this is the path usually you will find python installed. After this type in
cd.. to get one step out of the Scripts folder
After this install jupyter in here using:
$ pip install jupyter
The installation was fine and when I tried to open the jupyter notebook, it gave me the following error.
'jupiter is not recognized as an internal or external command, operable program or batch file.
I checked a lot of resources but still, I faced the same problem. After doing a lot of stuff from the internet, I myself figured out that maybe due to some updates(for some users) it won't open by typing the command
jupyter notebook
Instead, you have to type
jupyter-notebook
The only thing I was missing was this Hyphen-minus. Hope this works for you too.

Related

How do you open Jupyter Notebook without Anaconda and from any directory?

I need help opening Python using the command line from other folders. Currently, I can only open Jupyter Notebook via the command line in the directory that Python was installed in. The following commands worked:
python -m jupyter notebook
or
python -m notebook
Excluding python -m or -m results in an error.
When trying to access python from any other folders using the same commands, I get the following error:
'python' is not recognized as an internal or external command,
operable program or batch file.
A similar error is thrown when I use jupyter notebook or notebook.
I have downloaded Python and have used it using IDLE. I also installed Jupyter Notebook using pip; I did this by accessing Windows Powershell in the folder where Python is located.
Would appreciate it also if someone could explain what was happening and what I could do in the future to avoid this. Thank you for the help!
Python is not recognised outside its own folder (as you mention). To 'expose' the Python command to the console, you can add it to your Windows environment variables, as per the Python documentation.
To permanently modify the default environment variables, click Start and search for ‘edit environment variables’, or open System properties, Advanced system settings and click the Environment Variables button. In this dialog, you can add or modify User and System variables. To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
Concretely, in the environment variables of your system, edit the 'PATH' variable and add the folder with your Python executable to the path. After restarting your command prompt you should now be able to execute python commands.
While installing the Python, you can choose to add Python to PATH, if you check this while installing, you will have environment PATH variable in the machine.
Then you can just install notebook as you install any other packages/libraries in python.
pip install notebook
Once you do that, you should be able to start notebook from any folder/directory in your machine.
the command is pretty simple.
jupyter notebook

Can't launch Jupyter Notebook from the command line in Windows 7

On a Windows 7 machine, I installed Python 3.8.5, pip using the get-pip.py installation script from here, and Jupypter Lab + Jupyter Notebook following the instructions here. When trying to launch Jupyter Notebook, I get the following error message:
C:\jupyter notebook
'jupyter' is not recognized as an internal or external command,
operable program or batch file.
What is the problem? I verified that both Python and pip was successfully installed by launching the Python console and doing pip -V.
https://jupyter.org/install is general installation instructions, but assume some familiarity with Python, pip, and system execution path searching.
You need to add the location where pip installed jupyter to you system PATH environment variable.
To test this theory, try seeing if you have jupyter.exe in a folder similar to C:\Program Files\Python38\Scripts.
Answers to questions like this one, explain ways to edit the PATH variable.
Screenshot example of editing user's PATH:
I don't know the exact condition but try this..
"jupyter notebook"
and if it doesn't work then you might want to add installation location to your environment variables.

'pip' is not recognized as an internal or external command (i tried adding pip to my path) [duplicate]

I'm running into a weird error when trying to install Django on my computer.
This is the sequence that I typed into my command line:
C:\Python34> python get-pip.py
Requirement already up-to-date: pip in c:\python34\lib\site-packages
Cleaning up...
C:\Python34> pip install Django
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Python34> lib\site-packages\pip install Django
'lib\site-packages\pip' is not recognized as an internal or external command,
operable program or batch file.
What could be causing this?
This is what I get when I type in echo %PATH%:
C:\Python34>echo %PATH%
C:\Program Files\ImageMagick-6.8.8-Q16;C:\Program Files (x86)\Intel\iCLS Client\
;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\S
ystem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\
Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Progr
am Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Mana
gement Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine C
omponents\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components
\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\P
rogram Files (x86)\nodejs\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x
86)\git\cmd;C:\RailsInstaller\Ruby2.0.0\bin;C:\RailsInstaller\Git\cmd;C:\RailsIn
staller\Ruby1.9.3\bin;C:\Users\Javi\AppData\Roaming\npm
You need to add the path of your pip installation to your PATH system variable. By default, pip is installed to C:\Python34\Scripts\pip (pip now comes bundled with new versions of python), so the path "C:\Python34\Scripts" needs to be added to your PATH variable.
To check if it is already in your PATH variable, type echo %PATH% at the CMD prompt
To add the path of your pip installation to your PATH variable, you can use the Control Panel or the setx command. For example:
setx PATH "%PATH%;C:\Python34\Scripts"
Note:
According to the official documentation, "[v]ariables set with setx variables are available in future command windows only, not in the current command window". In particular, you will need to start a new cmd.exe instance after entering the above command in order to utilize the new environment variable.
Thanks to Scott Bartell for pointing this out.
For Windows, when you install a package, you type:
python -m pip install [packagename]
As of now, version 3.7.3 I had a little bit of an issue with getting the right system variable.
Try this:
Type start %appdata% in cmd.
After that file explorer should pop up in ../AppData/Roaming.
Go back one directory and navigate to Local/Programs/Python/Python37-32/Scripts.
NOTE: The version number may be different so if you copy and paste the above file path it could not work.
After you do this you now have the correct location of your downloaded Python. Copy your file path by selecting the whole directory in the address bar.
Once you do that click the start icon and navigate to the Control Panel → System and Security → System. Then click "Advanced System Settings" on the left side of the panel.
Once there, click Environment Variables on the bottom right and there will be two boxes, an upper and a lower box. In the upper box: Click on the 'Path' Variable and click Edit located on the right. Click New and paste your directory Path. It should look something like this:
Click OK three times, open a new window of cmd and type: pip. See if it works.
For me the command:
set PATH=%PATH%;C:\Python34\Scripts
worked immediately (try after echo %PATH% and you will see that your path has the value C:\Python34\Scripts).
Thanks to: Adding a directory to the PATH environment variable in Windows
Alternate way.
If you don't want to add the PATH as the previous well written answers pointed out,
but you want to execute pip as your command then you can do that with py -m as prefix.
Given that you have to do it again and again.
eg.
py -m <command>
as in
py -m pip install --upgrade pip setuptools
Also make sure to have pip and py installed
The only way that worked on my Windows 10 machine was as follows:
py -3 -m pip install xxxxx
Also, the long method - it was a last resort after trying all previous answers:
C:\python27\scripts\pip.exe install [package].whl
This after cd in directory where the wheel is located.
As per Python 3.6 Documentation
It is possible that pip does not get installed by default. One
potential fix is:
python -m ensurepip --default-pip
Control Panel -> add/remove programs -> Python -> Modify -> optional Features (you can click everything) then press next -> Check "Add python to environment variables" -> Install
And that should solve your path issues, so jump to command prompt and you can use pip now.
Go to control Panel >> Uninstall or change Program and double click on Python XXX to modify install. Make sure PIP component is checked and install.
I was having the same problem just now.
After adding the proper folder (C:\Python33\Scripts) to the path, I still could not get pip to run. All it took was running
pip.exe install -package- instead of
pip install -package-.
Try going to Windows PowerShell or cmd prompt and typing:
python -m pip install openpyxl
In latest version Python 3.6.2 and above, is available in
C:\Program Files (x86)\Python36-32\Scripts
You can add the path to our environment variable path as below
Make sure you close your command prompt or Git after setting up your path. Also should you open your command prompt in administrator mode. This is example for Windows 10.
Use
set Path = `%PATH%;C:\Python34\;C:\Python27\Scripts`
Source
Or if you are using PyCharm (2017-03-03) like me, just change directory in terminal and install:
cd C:\Users\{user}\PycharmProjects\test\venv\Scripts
pip install ..
Most frequently it is:
in cmd.exe write
python -m pip install --user [name of your module here without brackets]
Even I'm new to this, but pip install django worked for me.
The path should be set as where the script folder of the Python installation is, i.e.C:\Python34\Scripts.
I suppose it's because Django is a framework which is based on Python, and that's why this directory structure has to be maintained while installing.
I have just installed Python 3.6.2.
I got the path as
C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\Scripts
In Windows, open cmd and find the location of PYTHON_HOME using where python. Now add this location to your environment variable PATH using:
set PATH=%PATH%;<PYTHON_HOME>\Scripts
Or refer to this.
In Linux, open a terminal and find the location of PYTHON_HOME using which python. Now add the PYTHON_HOME/Scripts to the PATH variable using:
PATH=$PATH:<PYTHON_HOME>\Scripts
export PATH
You can try pip3. Something like:
pip3 install pandas
I was facing the same issue. Run Windows PowerShell as Administrator. It resolved my issue.
None of these actually worked for me, but running
python -m pip install -U pip
and then adding the specified directory to the PATH as suggested got it working
In your Python folder path in Terminal, just type
py -m pip
in order to check the current version of your pip.
You will also see a list of commands, you can use...
I think from Python 2.7.9 and higher pip comes pre installed and it will be in your scripts folder.
So you have to add the "scripts" folder to the path. Mine is installed in C:\Python27\Scripts. Check yours to see what your path is so that you can alter the below accordingly. Then go to PowerShell, paste the below code in PowerShell and hit Enter key. After that, reboot and your issue will be resolved.
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\Scripts", "User")
In a Windows environment, just execute the below commands in a DOS shell.
path=%path%;D:\Program Files\python3.6.4\Scripts;
(new path=current path;path of the Python script folder)
I deleted the older version using the control panel and then installed the new version however the newer version was not reflecting pip even after adding the right paths in the environment variables. However, the thing that worked for me was deleting the folders of old python that were there in the local App folder even after uninstall. For me, the path was like below. Deleting this folder solved my issue
C:\Users\username\AppData\Local\Programs\Python38
'pip' is not recognized as an internal or external command
pip is a python module used to install packages. For your problem, there can be many reasons;
Restart CMD/Terminal
Environment variable is not set. pip is installed but environment variable is not set. Environment variable is a windows variable where pip path is saved, so it can be run at run time.
pip is not installed.
Restart CMD/Terminal
It is sometimes possible that you opened your command prompt or terminal before installing pip and now it just needs a restart to pick up the latest environment variables. It is worth trying just restarting your command prompt or terminal.
Environment Variable is Not Set
Open CMD and run this command to see the values set in the PATH environment variable.
echo %PATH%
This will echo the PATH environment variable like this;
You should check if your path exist in the echoed PATH list. For example, in my case, the path for pip.exe files is C:\Python310\Scripts. You can check this path yourself like this;
If you can find pip path and it does not exist the echoed PATH variable, then we need to add it. Copy the path like C:\Python310\Scripts.
Go to Start > This PC > Properties > Advance system settings >
Advanced > Environment Variables
As shown in the image above, Select Path, click Edit button and add the copied path. Restart the CMD and test pip command again.
pip is Not Installed
If pip is not installed, you can install it again by downloading latest python.exe setup from python.org website. Make sure you check mark the pip option as shown in the image below.
In the next step, check mark "Add Python to environment variables"
I had this same issue. You just need to go to your
C:\Python27\Scripts
and add it to environment variables. After path setting just run pip.exe file on C:\Python27\Scripts and then try pip in cmd. But if nothing happens try running all pip applications like pip2.7 and pip2.exe. And pip will work like a charm.
Small clarification: in "Windows 7 64 bit PC", after adding ...Python34\Scripts to the path variable, pip install pygame didn't work for me.
So I checked the "...Python34\Scripts" folder, it didn't have pip, but it had pip3 and pip3.4. So I ran pip3.4 install pygame .... .whl. It worked.
(Further open a command window in the same folder where you have the downloaded pygame...whl file.)
When installing SQL 2019 Python, there are known issues for PIP which require a fix (step 7)
https://learn.microsoft.com/en-us/sql/advanced-analytics/known-issues-for-sql-server-machine-learning-services?view=sql-server-ver15
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Workaround
Copy the following files:
libssl-1_1-x64.dll
libcrypto-1_1-x64.dll
from the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\Library\bin
to the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\DLLs
Then open a new DOS command shell prompt.

Just installed Jupyter using Anaconda but can't run it using terminal. Says command not found

I just bought my very first Mac after using Windows my entire life and have been trying to install things. I am also still kind of a beginner at programming.
I installed Anaconda for Python 2.7 version, and then I installed the 3.7 version right after.
I tried going to terminal and typing jupyter notebook but it says:
zsh: command not found: jupyter
I am able to launch a jupyter notebook (I think) when I search for jupyter notebook in spotlight and executing the top hit.
I've been reading a lot on forums about this issue and see a lot of people talking about PATH which I am not really sure about.
I've seen people also post their which python information and theirs seem very different from mine:
which python3
usr/bin/python3
which python
usr/bin/python
Any help would be appreciated! Still learning how to set up this Mac. Thank you.
You might want to refer to this link https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html
3.1.2. Change Jupyter Notebook startup folder (Mac OS)
To launch Jupyter Notebook App:
Click on spotlight, type terminal to open a terminal window.
Enter the startup folder by typing cd /some_folder_name.
Type jupyter notebook to launch the Jupyter Notebook App The notebook interface will appear in a new browser window or tab.
From what I can understand you are not changing to the startup directory of Jupyter.
You need to add jupyter to your path.
In your terminal, type in the following command:
export PATH="/PUT JUPYTER PATH HERE:$PATH"
Then try jupyter notebook
Reasoning: If installing using pip install --user, you must add the user-level bin directory to your PATH environment variable in order to launch jupyter lab

'jt' is not recognized as an internal or external command

Trying to change theme of Jupyter notebook but running into difficulty after successful install.
I run:
jt-t chesterish
'jt' is not recognized as an internal or external command, operable
program or batch file.
I know its related to not setting the environmental path somehow. But I have tried using SETX PATH but still didn't work and found not other solution thus far. I have before set up python so I can directly type "python" to get it on the command line but doesn't work for anything else like "jupyter".
Even if ı have installed the jupyterthemes and upgrade it, ı have the same issue when ı write down the command (!jt -t [themename]) into one of the jupyter notebook's cells. The solution that ı have found is open up the Anaconda prompt and after installing the jupyterthemes, write the command (jt -t exampletheme) and restart the jupyter notebook.
I had the same problem. I was using a conda environment with Python 3.7 installed. After I switched the kernel to the original standard "Python 3" kernel with Python 3.9 install, then the jt commands worked for me. Not sure if it was an environment issue or a python version issue.

Categories