After Installing using pip, “jupyter: command not found”

Jupyter is the latest, open-source, and widely used web-based development environment that enables the user to share documents having live codes, virtualization, and interactive data. It supports different programming languages like  Haskell, Python and Julia.

However, the user can face the error “jupyter: command not found” when dealing with the Jupyter Notebook even after installing the “jupyter” command.

This guide will provide the reason and solution for the “jupyter: command not found” error in Linux.

  • Reason: System Path is Not Set
  • Solution: Set the System Path

Reason: System Path is Not Set

The reason for the error “jupyter: command not found” is that the system path is not set for the jupyter command to use. By default, Linux installs it in the “~/.local/bin” directory, which is not on the path as per the instruction of Linux specified while installing the Jupyter command. The user can check the following image in which the statement is written during the installation Jupyter command:

So even after installing the Jupyter command using pip, it will still not work in the system. As in the following command, the user is trying to open the Jupyter Notebook:

$ jupyter notebook

Solution: Set the System Path

The solution is pretty simple, the user just needs to add the “~/.local/bin” path in the “.bashrc” file so that it will work. Let’s have a quick look at a 2 step guide to apply this solution.  

Step 1: Configure the “.bashrc” File

Open the “.bashrc” file with the nano editor and export the “~/.local/bin” path as shown:

export PATH=$PATH:~/.local/bin

Save the file by pressing “Ctrl+O” and exit from the editor using “Ctrl+X”.

Step 2: Execute the “.bashrc” File

Now, execute the “.bashrc” file through the source command to see the applied changes in the current bash session:

$ source .bashrc

The “.bashrc” file is executed.

Verify the Results

Once the above operations are performed, the user is now able to run the “jupyter” command in the terminal. Let’s open the Jupyter Notebook:

$ jupyter notebook

The Jupyter Notebook is opened.

Conclusion

The reason for the error “jupyter: command not found” after installing the jupyter command is that the system path is not set for the jupyter. To fix this error, open the “.bashrc” file and export the “~/.local/bin” path in it then apply the source command to execute the file. 

This write-up has illuminated the reason and the solution for the “jupyter: command not found” error in Linux.