jupyter / help

:sparkles: Need some help or have some questions? Please visit our Discourse page.
https://discourse.jupyter.org
291 stars 97 forks source link

"WARNING | Native kernel (python2) is not available" even when installing via pip3 #115

Open daniel-allington opened 7 years ago

daniel-allington commented 7 years ago

I'm trying to install Jupyter system-wide using pip and sudo (e.g. sudo pip3 install jupyter) on 64-bit Linux (Mint 17.3) with Python 2.7.6 and Python 3.4.3 installed.

However, regardless of whether I use pip or pip3, it seems to want (and not be able to find) a Python 2 kernel (and give two error messages saying the same thing):

$ jupyter kernelspec list
[ListKernelSpecs] WARNING | Native kernel (python2) is not available
[ListKernelSpecs] WARNING | Native kernel (python2) is not available
No kernels available

I don't have any additional installs of IPython on my system.

minrk commented 7 years ago

@daniel-allington what are pip list and pip3 list?

daniel-allington commented 7 years ago

Thanks for your attention to this. Here you go:

piplist.txt pip3list.txt

I should perhaps add that I was able to install Jupyter with no problems using conda rather than pip.

takluyver commented 7 years ago

What do you get from:

python -c "from ipykernel.kernelspec import RESOURCES"
daniel-allington commented 7 years ago

I can try that but I'm not sure the result will still be relevant since I now have a fully working Jupyter setup (installed with conda - the problem above arose while installing with pip).

Would you still like me to do that?

takluyver commented 7 years ago

Only if you're still interested in debugging the issue and you still have an environment in which it occurs. Otherwise, feel free to close this issue.

daniel-allington commented 7 years ago

I may be able to recreate the error if I uninstall with conda and reinstall with pip. Please bear with me, though, as I don't have time to think about this right now!

takluyver commented 7 years ago

No rush, but if you think you might look into it at some point, we'll leave this open for now.

daniel-allington commented 7 years ago

Okay let's do that!

msk1105 commented 6 years ago

I use Python 2.7.13 and had the same problem while trying to open: jupyter notebook

I followed the instruction by @takluyver, and now what I should deal with the error below. Advice/help will be greatly appreciated.

$ python -c "from ipykernel.kernelspec import RESOURCES" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named ipykernel.kernelspec

Note: Previously, I only had anaconda and jupyter notebook worked all right until I installed a python-based analytic tool via miniconda (Eventually, I removed this tool and miniconda, and have now only anaconda).

$ anaconda --version anaconda Command line client (version 1.4.0)

takluyver commented 6 years ago

Use which python (if you're on Linux/Mac) or where python (Windows) to see what Python executable it's using. You need to make sure you're using the same Python that the packages are installed with.

My blog post here has more background info about this: http://takluyver.github.io/posts/i-cant-import-it.html

msk1105 commented 6 years ago

Thank you very much, @takluyver.

I went through your blog post ("I can't import", which is very helpful!) and understood that I should first find which Python is running my code and then install the package for the same Python I am using.

When I tried to open jupyter notebook, I had messages (see below the line), indicating that I should run Python in /Users/msk/anaconda, but the executable Python in my laptop seems to be /usr/local/opt/python/bin/python2.7 or /usr/local/bin/python (see below the double lines).

Here are my questions: Should I make the Python in /Users/msk/anaconda/ executable? OR Should I run jupyter notebook using the current executable Python (/usr/local/bin/python)? In either way, I'd appreciate the guidance about how to achieve it.

Thanks in advance!


$ jupyter notebook
[W 15:27:03.773 NotebookApp] Unrecognized JSON config file version, assuming version 1
Traceback (most recent call last):
  File "/Users/msk/anaconda/bin/jupyter-notebook", line 6, in <module>
    sys.exit(notebook.notebookapp.main())
  File "/Users/msk/anaconda/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/Users/msk/anaconda/lib/python2.7/site-packages/traitlets/config/application.py", line 595, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/Users/msk/anaconda/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/msk/anaconda/lib/python2.7/site-packages/notebook/notebookapp.py", line 1069, in initialize
    self.init_configurables()
  File "/Users/msk/anaconda/lib/python2.7/site-packages/notebook/notebookapp.py", line 837, in init_configurables
    parent=self,
  File "/Users/msk/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 19, in __init__
    specs = self.find_kernel_specs() or {}
  File "/Users/msk/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 129, in find_kernel_specs
    self.conda_info = self._conda_info()
  File "/Users/msk/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 29, in _conda_info
    p = subprocess.check_output(["conda", "info", "--json"]
  File "/Users/msk/anaconda/lib/python2.7/subprocess.py", line 567, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/Users/msk/anaconda/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/Users/msk/anaconda/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory


>>> print (sys.executable)
/usr/local/opt/python/bin/python2.7

$ which python
/usr/local/bin/python

$ which -a python
/usr/local/bin/python
/usr/local/bin/python
/usr/local/bin/python
/Users/msk/anaconda/bin/python
/usr/local/bin/python
/usr/bin/python
takluyver commented 6 years ago

The error message you show there is indicating that nb_conda_kernels is trying and failing to run conda. I don't know why that's happening; it's probably best to investigate that with the nb_conda_kernels people.

It's running Jupyter from /Users/msk/anaconda/bin/jupyter-notebook, so hopefully it should be running that with the Python in Anaconda, unless you've changed the #! line at the start of that file.

You'll also want to check the kernelspecs, which tell it how to launch the kernel, using jupyter kernelspec list and looking in the directories it shows.

msk1105 commented 6 years ago

@takluyver, thank you very much. I will check these things! Truly grateful that you took the time to respond to me.