gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.
MIT License
3.85k stars 264 forks source link

Error starting Kernel #162

Closed robmarkcole closed 4 years ago

robmarkcole commented 5 years ago

Mac OS 10.14.3, I have followed the setup instructions in the readme, on starting the kernel I get the following:

Traceback (most recent call last):
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
    result = yield result
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 73, in post
    type=mtype))
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 315, in wrapper
    yielded = next(result)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 148, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/jupyter_client/manager.py", line 259, in start_kernel
    **kw)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "/Users/robincole/anaconda3/lib/python3.6/site-packages/jupyter_client/launcher.py", line 128, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "/Users/robincole/anaconda3/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/Users/robincole/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gophernotes': 'gophernotes'

I did have to manually export PATH=$PATH:~/go/bin, not sure if that is related.

In my kernel.json I have:

{
    "argv": [
        "gophernotes",
        "{connection_file}"
        ],
    "display_name": "Go",
    "language": "go",
    "name": "go"
}

I see the Troubleshooting instructions but am not sure where I should be adding the full path to the gophernotes executable

robmarkcole commented 5 years ago

OK after a couple of restarts of jupyter it is working

cosmos72 commented 5 years ago

Yes, the directory ~/go/bin must be in your $PATH.

Thanks for pointing this out: it's not written explicitly in the README, I will add it

zhangleivip commented 5 years ago

OK after a couple of restarts of jupyter it is working

I did export PATH=$PATH:~/go/bin ,but I can't success.please help me

cosmos72 commented 5 years ago

Hi @zhangleivip, did you receive an error message? It would help to understand the problem you describe. Since you are at it, it would also help knowing which operating system you are using.

Mathis001 commented 5 years ago

OK after a couple of restarts of jupyter it is working

I did export PATH=$PATH:~/go/bin ,but I can't success.please help me

I had a similar issue, but I found out the underlying reason was the terminal session I was running jupyter in didn't update the $PATH env variable to be able to run gophernotes from the command line, i.e. $ gophernotes. I could run it from another ssh session, but I was running jupyter in a screen and closing that out and creating a new screen solved my issue.

Before I realized this, my fix was to look at where gophernotes ran from, and update the kernel.json.

$ whereis gophernotes
gophernotes: /home/jupyter/go/bin/gophernotes
$ jupyter kernelspec list
Available kernels:
  gophernotes    /home/jupyter/.local/share/jupyter/kernels/gophernotes
  python2        /home/jupyter/.local/share/jupyter/kernels/python2
  python3        /home/jupyter/.local/share/jupyter/kernels/python3

$ sudo nano /home/jupyter/.local/share/jupyter/kernels/gophernotes/kernel.json

{
    "argv": [
                "/home/jupyter/go/bin/gophernotes",
        "{connection_file}"
        ],
    "display_name": "Go",
    "language": "go",
    "name": "go"
}

It looks like the kernel is looking for the gophernotes in the wrong location, or the path variable is messed up. By calling the absolute path for it, it should solve any environment variable issues.