Skip to content
New issue

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

Can't Run Jupyter (aka IPython) with Coconut #97

Closed
moigagoo opened this issue Jun 21, 2016 · 9 comments
Closed

Can't Run Jupyter (aka IPython) with Coconut #97

moigagoo opened this issue Jun 21, 2016 · 9 comments

Comments

@moigagoo
Copy link
Contributor

Running Jupyter with coconut fails:

$ coconut --jupyter console
Coconut 1.0.0 [Albatross]
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/kernelspec.py", line 173, in get_kernel_spec
    resource_dir = d[kernel_name.lower()]
KeyError: 'icoconut'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-console", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 595, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-115>", line 2, in initialize
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/jupyter_console/app.py", line 138, in initialize
    self.init_shell()
  File "/usr/local/lib/python3.5/site-packages/jupyter_console/app.py", line 105, in init_shell
    JupyterConsoleApp.initialize(self)
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/consoleapp.py", line 334, in initialize
    self.init_kernel_manager()
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/consoleapp.py", line 288, in init_kernel_manager
    self.kernel_manager.start_kernel(**kwargs)
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/manager.py", line 230, in start_kernel
    kernel_cmd = self.format_kernel_cmd(extra_arguments=extra_arguments)
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/manager.py", line 170, in format_kernel_cmd
    cmd = self.kernel_spec.argv + extra_arguments
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/manager.py", line 82, in kernel_spec
    self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name)
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/kernelspec.py", line 175, in get_kernel_spec
    raise NoSuchKernel(kernel_name)
jupyter_client.kernelspec.NoSuchKernel: No such kernel named icoconut

Running coconut --jupyter notebook produces the same output.

Adding the kernel seems to work:

$ coconut --jupyter
4.1.0
[InstallKernelSpec] Removing existing kernelspec in /usr/local/share/jupyter/kernels/icoconut
[InstallKernelSpec] Installed kernelspec icoconut in /usr/local/share/jupyter/kernels/icoconut

However, coconut is still not available as an option for new notebooks in Jupyter (note that another alternative kernel—xonsh—does work, so it's not a Jupyter issue): https://monosnap.com/file/FYsMPbAPYHHjdYXCzX0Iy14ZWNcRiY

Output of python3 -m coconut.icoconut:

$ python3 -m coconut.icoconut
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049


To connect another client to this kernel, use:
    --existing kernel-20885.json

I'm on Mac OS El Capitan, using Python 3.5.1 and the latest versions of coconut and Jupyter installed for it. Note that on Mac python command calls the default Python 2.7; Python 3 is available by python3.

@evhub
Copy link
Owner

evhub commented Jun 21, 2016

I have an idea as to what the problem may be. Does anything different happen if you try to run the commands as root? Try:

sudo coconut --jupyter
sudo coconut --jupyter console

@moigagoo
Copy link
Contributor Author

Nope, nothing changed, the same output on both commands.

@fredcallaway
Copy link

I'm getting the same behavior (sudo & otherwise) on my macbook running 10.11 with Python 3.5 anaconda distribution.

@evhub
Copy link
Owner

evhub commented Jun 21, 2016

I was able to identify the problem, and it has been fixed on develop. I will try to release a patch with this fix in it some time this week.

@evhub evhub closed this as completed Jun 21, 2016
@evhub evhub removed the in progress label Jun 21, 2016
@moigagoo
Copy link
Contributor Author

moigagoo commented Jun 22, 2016

@evhub I've tried running coconut develop in Jupyter, and here's the error I get:

$ coconut --jupyter console
Coconut 1.0.0-post_dev [Albatross]
/usr/bin/python: No module named coconut
Jupyter Console 4.1.1

It seems like Python path is hardcoded. On Mac, the default Python is 2.7, /usr/bin/python means Python 2.

I have both Jupyter and coconut installed for Python 3 (/usr/local/bin/python3).

The same error is raised when I run jupyter notebook after adding coconut kernel with sudo.

@evhub
Copy link
Owner

evhub commented Jun 23, 2016

@moigagoo That's strange--the Python path definitely shouldn't be hardcoded. Can you try running coconut --verbose --jupyter console on develop?

@evhub evhub reopened this Jun 23, 2016
@evhub
Copy link
Owner

evhub commented Jun 24, 2016

I think I figured out the problem you were having the second time, also. Should be really actually fixed on develop now.

@evhub evhub closed this as completed Jun 24, 2016
@evhub evhub removed the in progress label Jun 24, 2016
@moigagoo
Copy link
Contributor Author

@evhub Great job! Thanks!

@evhub
Copy link
Owner

evhub commented Jun 24, 2016

@moigagoo @fredcallaway Released in v1.1.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants