Open daniel-allington opened 7 years ago
@daniel-allington what are pip list
and pip3 list
?
Thanks for your attention to this. Here you go:
I should perhaps add that I was able to install Jupyter with no problems using conda rather than pip.
What do you get from:
python -c "from ipykernel.kernelspec import RESOURCES"
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?
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.
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!
No rush, but if you think you might look into it at some point, we'll leave this open for now.
Okay let's do that!
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)
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
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
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.
@takluyver, thank you very much. I will check these things! Truly grateful that you took the time to respond to me.
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):
I don't have any additional installs of IPython on my system.