takluyver / nbopen

Open a Jupyter notebook in the best available server
BSD 3-Clause "New" or "Revised" License
304 stars 58 forks source link

Dead kernel on OS X #20

Open jvtrudel opened 9 years ago

jvtrudel commented 9 years ago

nbopen open ipynb files from a Finder double click. Great! But... the kernel just die after few seconds.

Have you a hint of what can cause that behaviour and how to solve that?

takluyver commented 9 years ago

Nothing comes to mind. Can you replicate it using nbopen at the command line? If so, there might be an error message in the terminal.

jfeist commented 9 years ago

I can confirm that the same happens for me (it started some months ago I think). I always get it when nbopen has to start a notebook server itself, but not when it opens the notebook in an existing server. As I typically use a single notebook server running in my home folder, this error actually reminds me that I forgot to start that server, so I never investigated further.

ryanlake10288 commented 8 years ago

+1

Jupyter + iPython certainly installed but keep getting ~/anaconda/bin/python: No module named ipykernel in console

LunarLanding commented 8 years ago

Hi. I've had similar problems. I have pyenv installed, that migth be the issue. Meanwhile, I used automator to make double click work. Here's the bash script inside automator: https://gist.github.com/LunarLanding/e20ccf918f98d5974fc9 You'll have to modify the part where I use pyenv to make it use anaconda's python.

takluyver commented 8 years ago

Hmmm, I bet it relies on some modification to your environment variables - possibly $PYTHONPATH - which is done by one of those files sourced in @LunarLanding's script, like ~/.bash_profile.

It's a recurring annoyance that many things setting up environment variables seem to think they only matter when you're in a terminal, breaking anything that relies on them and is launched from the GUI. This is worst on OSX, I think - on Linux, the desktop runs ~/.profile at login, so you can set environment variables there.

LunarLanding commented 8 years ago

@takluyver Thanks for the insight.

xoolive commented 8 years ago

In case it helps, my version of python3 is located in /usr/local/bin/

As part of my investigation, I tried to replace the path in the shebang at the top of nbopen.py and the new error message is ImportError: No module named 'runpy'

If I also put the full path to python3 in the osx-install.sh script, then the import message is back to ipykernel.

That is the point where I don't understand anymore :smile:

takluyver commented 8 years ago

@xoolive look for anything in ~/.profile or ~/.bash_profile (or similar files) that might be modifying environment variables like $PATH or $PYTHONPATH. I suspect that's the root cause. I don't know what you can do about it on Macs, though.

xoolive commented 8 years ago

I don't use those files (only some ~/.zshenv but not much except adding /usr/local/bin and customizing my prompt...)

I checked the result of the env command, and no $PYTHONPATH, nothing weird in my $PATH except /usr/local/bin... (which makes me wonder how Python finds its way within the site-packages tree thing inside avirtualenv but that is another story, I installed nbopen outside of my virtualenv mess, and checked the symbolic link to Python inside the app as well...)