No such file or directory python jupiter

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jupyter notebook Error executing Jupyter command ‘notebook’: [Errno 2] No such file or directory #4966

jupyter notebook Error executing Jupyter command ‘notebook’: [Errno 2] No such file or directory #4966

Comments

Hi just installed Anaconda 2.1.0 (x86_64) for one of my course on MAC OS.
()Installation went OK
()PATH was updated
()ran the following commands and all seem to go OK.
>> conda update conda
>> conda update ipython
>> conda update pip
>> conda install bokeh
()version query returns
conda —version
conda 4.4.9

Читайте также:  Eval command in java

As per the instruction i should have notebook package installed.
But i get the follwing error

XXXXX@Admins-MacBook-Pro ~ $ jupyter notebook
Error executing Jupyter command ‘notebook’: [Errno 2] No such file or directory

conda list only has ipython notebook

gsandhu@Admins-MacBook-Pro ~ $ conda list | grep notebook
ipython-notebook 2.2.0 py27_0

Previously i tried updating jupyter using «pip install jupyter» and i was able to start the notebook but then there were issues in kernal . So i uninstalled everything and started from fresh.

Can anyone please guide me through this? Thanks in Advance

The text was updated successfully, but these errors were encountered:

can you please help me in this?

Does jupyter-notebook work? I.e. try with a — instead of a space. The jupyter command is looking for other commands like that.

Thanks! jupyter-notebook does not work either. «ipython notebook» also does not work.

Here is the OP to jupyter-notebook:
-bash: /usr/local/bin/jupyter-notebook: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

On trying to update conda for jupyter i see the following.

(root) (root)gsandhu@Admins-MacBook-Pro bin $ conda update jupyter

PackageNotInstalledError: Package is not installed in prefix.
prefix: /Users/gsandhu/anaconda
package name: jupyter

Should i just reinstall everything and try again?

to clean everything will these commands give me a clean slate?
rm -rf ~/anaconda
m -rf ~/.condarc ~/.conda ~/.continuum

Only 1 env.
(root) (root)gsandhu@Admins-MacBook-Pro bin $ conda info —envs

conda environments:

pip install jupyter and then i can load the notebook. But kernal stops with the following error

WARNING:root:kernel 188c9238-287e-4a8a-a861-2e698cb86e28 restarted
Traceback (most recent call last):
File «/Users/gsandhu/anaconda/lib/python2.7/runpy.py», line 174, in _run_module_as_main
«main«, fname, loader, pkg_name)
File «/Users/gsandhu/anaconda/lib/python2.7/runpy.py», line 72, in _run_code
exec code in run_globals
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/ipykernel_launcher.py», line 16, in
app.launch_new_instance()
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/traitlets/config/application.py», line 657, in launch_instance
app.initialize(argv)
File «», line 2, in initialize
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/traitlets/config/application.py», line 87, in catch_config_error
return method(app, *args, **kwargs)
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/ipykernel/kernelapp.py», line 448, in initialize
self.init_sockets()
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/ipykernel/kernelapp.py», line 251, in init_sockets
self.init_iopub(context)
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/ipykernel/kernelapp.py», line 259, in init_iopub
self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True)
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/ipykernel/iostream.py», line 66, in init
self.io_loop = IOLoop(make_current=False)
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/tornado/util.py», line 208, in new
instance.initialize(**args)
File «/Users/gsandhu/anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py», line 133, in initialize
super(ZMQIOLoop, self).initialize(impl=impl, **kwargs)
TypeError: initialize() got an unexpected keyword argument ‘make_current’
[W 13:33:34.827 NotebookApp] KernelRestarter: restart failed

Update the ipykernel package — it should be fixed by 4.7 or newer. ipython/ipykernel#278

Same issue fixed for me by updating conda and reinstalling jupyter:

conda update -n base conda conda install jupyter 

I faced similar issue. This is what I did to fix the issue (on Ubuntu) :

  • sudo apt-get remove ipython
  • sudo apt-get purge ipython
  • sudo apt-get autoremove
  • pip install jupyter

ipython seemed to be the problem, hence removing it fixed the issue.

@akashshah26595 Thanks! That works and helps me a lot!

pip install jupyter for some reason switched my conda environment to Python 3.7, disabling Tensorflow which was installed on Python 3.6.

The error means that an executable called jupyter-notebook is not on your PATH. Since you are doing —user installs on macOS, scripts are going in $HOME/Library/Python/2.7/bin, which needs to be on your PATH and isn’t by default. If that’s the case, you can add it with:

(In mac os x , open .bash_profile file in nano and paste this command to it.)

same to me: macos, updated to 3.7 and then rolled back to 3.6.5 python, but seems I have some link to python3.7:

mcbk:machine-learning todor$ jupyter notebook Error executing Jupyter command 'notebook': [Errno 2] No such file or directory mcbk:machine-learning todor$ jupyter-notebook -bash: /usr/local/bin/jupyter-notebook: /usr/local/opt/python/bin/python3.7: bad interpreter: No such file or directory 

I have done already pip3 uninstall jupyter && pip3 install jupyter
could you please help me?

Dunno how is it possible. the following command was running smoothly: python -m IPython notebook
why does it happen?

sudo apt-get remove ipython sudo apt-get purge ipython sudo apt-get autoremove pip install jupyter 

. did not solve the issue. I’m using Ubuntu 18.04.

It seems to me as though the installation has messed up somehow. Try running:

For Python 2

pip install —upgrade —force-reinstall —no-cache-dir jupyter

For Python 3

pip3 install —upgrade —force-reinstall —no-cache-dir jupyter
This should reinstall everything from PyPi. This should solve the problem as I think running pip install «ipython[notebook]» messed things up.

Источник

No such file or directory python jupiter

Last updated: Feb 25, 2023
Reading time · 4 min

banner

# Error executing Jupyter command ‘notebook’: [Errno 2] No such file or directory

The «Error executing Jupyter command ‘notebook’: [Errno 2] No such file or directory» most commonly occurs on Linux distributions, e.g. Ubuntu or Arch.

The error occurs for multiple reasons:

  1. Having a corrupted installation of Jupyter notebook.
  2. Your installation of Jupyter notebook clashing with another module, e.g. IPython.
  3. Using an incorrect alias of the jupyter notebook command.

# Jupyter clashes with IPython

The jupyter notebook command sometimes clashes with the IPython module.

The first thing you should try is to uninstall IPython.

Copied!
# 👇️ uninstall the IPython module sudo apt remove ipython sudo apt purge ipython sudo apt autoremove # 👇️ install the Jupyter module pip install jupyter # 👇️ or with pip3 pip install jupyter

uninstall ipython module

Try to issue the jupyter notebook command after uninstalling IPython.

# Reinstall the Jupyter module on your machine

Make sure you have the python-dev package installed if you are on Linux.

Copied!
# 👇️ for Debian (Ubuntu) sudo apt install python3-pip python3-dev # 👇️ for Redhat / CentOS sudo yum install python3-devel # 👇️ for Alpine Linux sudo apk add python3-dev # 👇️ for openSUSE sudo zypper in python3-devel # 👇️ for Cygwin apt-cyg install python3-devel

install python3 dev and pip

Now, reinstall the jupyter module using the —force-reinstall option.

Copied!
# for python 2 pip install --upgrade --force-reinstall --no-cache-dir jupyter # for python 3 pip3 install --upgrade --force-reinstall --no-cache-dir jupyter

pip reinstall jupyter

The can read more about pip’s —no-cache-dir option in the following article.

If you get a permissions error when running the command, add the —user option.

Copied!
# for python 2 pip install --user --upgrade --force-reinstall --no-cache-dir jupyter # for python 3 pip3 install --user --upgrade --force-reinstall --no-cache-dir jupyter

If you still get a permissions error, try prefixing the command with sudo .

Copied!
# for python 2 sudo pip install --upgrade --force-reinstall --no-cache-dir jupyter # for python 3 sudo pip3 install --upgrade --force-reinstall --no-cache-dir jupyter

Try to issue the jupyter notebook command after uninstalling IPython.

After you issue the command, the server should start and you should see the Notebook app in your browser.

jupyter start development server

# Try the other variations of the jupyter notebook command

The jupyter notebook command sometimes changes to a different alias after installation.

Try running the following command instead.

using jupyter notebook alias command

Notice that the words are separated by a hyphen.

If the command doesn’t start the server, try using the python -m notebook command instead.

Copied!
python -m notebook # or python3 python3 -m notebook

using python m notebook command

If the python -m notebook command words, use the export command to update your PATH environment variable.

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

update path environment variable

Make sure to restart your terminal after using the export command for the changes to take effect.

After you’ve restarted your terminal, try issuing the jupyter notebook command.

# Install Jupyter using the apt packaging tool

If the error persists, try installing jupyter using apt .

Copied!
# Update packages sudo apt update # Install pip and Python sudo apt install python3-pip python3-dev # Upgrade pip sudo -H pip3 install --upgrade pip # install jupyter-notebook sudo apt install jupyter-notebook

install jupyter notebook using apt

After running the sudo apt install jupyter-notebook , try issuing the jupyter notebook command.

# Install the Jupyter module using the correct pip version

If the error persists, get your Python version and make sure you are installing the package using the correct Python version.

get python version

For example, my Python version is 3.11.2 , so I would install the GitPython package with pip3.10 install jupyter .

Copied!
pip3.11 install --upgrade --force-reinstall --no-cache-dir jupyter

install jupyter notebook using correct pip version

Notice that the version number corresponds to the version of pip I’m using.

If you get a permissions error when running the command, add the —user option.

Copied!
pip3.11 install --user --upgrade --force-reinstall --no-cache-dir jupyter

If you still get a permissions error, try prefixing the command with sudo .

Copied!
sudo pip3 install --upgrade --force-reinstall --no-cache-dir jupyter

Try to issue the jupyter notebook command after installing the module with a specific pip version.

If the error persists, try using one of the aliases of the jupyter notebook command.

using jupyter notebook alias command

Notice that the words are separated by a hyphen.

If the command doesn’t start the server, try using the python -m notebook command instead.

Copied!
python -m notebook # or python3 python3 -m notebook

using python m notebook command

If the python -m notebook command words, use the export command to update your PATH environment variable.

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

update path environment variable

Make sure to restart your terminal after using the export command for the changes to take effect.

After you’ve restarted your terminal, try issuing the jupyter notebook command.

# Conclusion

To solve the «error executing Jupyter command ‘notebook’: [Errno 2] No such file or directory», reinstall your jupyter module using pip or apt and make sure the IPython module is not installed as it often clashes with jupyter .

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.

Источник

Оцените статью