Open burkesquires opened 8 years ago
I don't know about Mac stuff - pinging @artwr who did the Mac app installation stuff.
Wow...no need to rush! Thanks for forwarding!
Hi @burkesquires,
Could you help me a little bit by giving me :
1) Your version of OSX
2) The version of Python you are using. (python -V
or python3 -V
)
Best, Arthur
Hi Arthur, I am on 10.10.5 with python 3.5.1. Cheers
I actually have the same issue on OSX 10.11.1 and python 3.5.1. Would love to see how you solve this problem.
So I did a little digging into Info.plist. The file lists two items for PyRuntimeLocations:
Item 0 = @executable_path/../Frameworks/libpython3.5.dylib
Item 1 = /Users/[my_user_name]/anaconda/lib/libpython3.5.dylib
I could not find any file for Item 0 in the executable_path/../Frameworks. Looking for Item 1, at ~/anaconda/lib/
there is no file for libpython3.5.dylib
. However, there is one named libpython3.5m.dylib
. I changed Item 1 in the Info.plist file to add the extra 'm'. Double clicking a .ipynb file now opens a new window in my browser, but I get a 404 error for localhost:8888
. So, I guess the server is still not getting started. Any other thoughts on what to do?
It is a good question. I have been using nbopen mostly from the command line (which seems to work fine for me and does not require py2app).
I am getting the same error with OSX 10.11.3 and python 3.5.1. I believe that the Frameworks bit changed form 10.9 to 10.10. It might have been when this broke. I have experimented with changing the path in the Plist but to no avail for now. I will try to experiment a little bit more and will report back next week.
@kyletabor: Is that an actual 404 error, or are you just using that as a shorthand for it failing to connect? 404 means that there is a server there, but it doesn't have the page you're asking it to serve. If the notebook server isn't running, it won't connect.
@takluyver, sorry it was a server not found error.
As an alternate experiment, I started a jupyter notebook server manually and then tried to double click an .ipynb file. The result was a true 404 error. The header shows the logo for jupyter notebook, but the body shows a 404 error. The URL was http://localhost:8888/notebooks/jupyter%20notebooks/User%20Analysis.ipynb
The actual local file location of the notebook is ~/ml/data_analysis/jupyter notebooks/User Analysis.ipynb
I suspect you have a leftover file from an old notebook server in the Jupyter runtime dir. Shut down your notebook servers, and then run:
rm $(jupyter --runtime-dir)/nbserver-*.json
Ok, I've made it a little further down the road. I can now use the command line nbopen filename
and it launches the notebook and server correctly. However, if I try to double click a file, the kernel dies immediately. Another issue is that when double clicking a file, the resulting notebook is trying to start a ruby kernel (I have iruby installed), and not a python kernel. This is not an issue when using the command line.
The former sounds like a common problem where the kernel relies on some environment variables that are set in your terminal (e.g. by ~/.bash_profile
or ~/.bashrc
). When you launch the server from the GUI, it doesn't use those environment variables.
You're exactly right @takluyver. I fixed it by creating using the OS X automator to run a bash script and load the correct environment variables.
For anyone else who may encounter this problem here's what I did:
1) Find the nbopen.app file that is created in the ../nbopen/dist
folder after the install. Open the package contents and open the Info.plist file. Find the PyRuntimeLocations and make sure the files listed there actually refer to your python distributions. I had to change ~/anaconda/lib/libpython3.5.dylib
to ~/anaconda/lib/libpython3.5m.dylib
. After a restart, I was then able to use nbopen from the command line.
2) I created an automator script so I could actually double click a file and start a jupyter notebook server (I mean what's the point of using nbopen if I have to use the command line?). I use RVM to manage my rubies, and I found that something in ~/.profile
was screwing with my $PATH environment variable, so I didn't include that in my script. After creating the automator script, I set the script file to be the default app for .ipynb files. And voila! I can now just open a notebook from finder or from spotlight. I've spent 3 hours saving 10 seconds from my workflow...
Automator Script:
if [ -f "$HOME"/.bash_profile ]; then
source "$HOME"/.bash_profile
elif [ -f "$HOME"/.bashrc ]; then
source "$HOME"/.bashrc
fi
echo $PATH
for f in "$@"
do
nbopen "$f" &
done
Anyway, thank you guys for the help. I hope this trouble shooting saves some time for other people with this problem.
@kyletabor how do you use the Automator script?
@pranv To use the script, you need to create a new automator "Application". The application receives files and folders as input. Then create a function for "Run Shell Script". Save the application as some witty name like "NBOPEN AUTOMATOR". Then find your favorite .ipynb file, and right click to "Get Info". Under "Open With:", select your "NBOPEN AUTOMATOR" app you just created.
@kyletabor thanks a lot!
@kyleabor One more step: Change the ‘Pass input:’ dropdown to ‘as arguments’ in the 'Run Shell Script' function. This threw me for a bit, but it otherwise works great. Thanks!
@kyletabor, @JohnTasto, @takluyver : Wow, this wasn't easy, but this is awesome. Thanks everyone! Very cool!
@kyletabor 's script above wasn't terminating after opening the .ipython file, so I had to alter the Automator workflow by removing the & in 'nbopen "$f" &'. I may have stopped arguments from being passed to the nbopen script by removing the &, but it works great now. Thanks!
I installed nbopen then tried to double click a jupyter notebook. I have the jupyter notebook open. I got an error in a new window:
"A Python runtime not could be located. You may need to install a framework build of Python, or edit the PyRuntimeLocations array in this application's Info.plist file."
In the console:
GetDYLDEntryPointWithImage(/System/Library/Frameworks/AppKit.framework/Versions/Current/AppKit,_NSCreateAppKitServicesMenu) failed.