VPython not showing under New in Jupyter notebook

711 views
Skip to first unread message

Joe Heafner

unread,
Jan 6, 2017, 10:05:40 AM1/6/17
to VPython Users
I’m trying to set up Jupyter VPython on my classroom iMacs and having a lot of difficulty I didn’t have when setting it up on my personal machines. Apparently Safari has Javascript problems that I solved by making Chrome the default browser for Jupyter notebooks (by changing a setting in a Jupyter config file. Now, the new problem is that after installing VPython, the VPython kernel doesn’t show up under New on the far right of the interface when launching a new Jupyter notebook. I have the same packages installed on this machine as on my personal machine, where it works properly. I can’t find anything with Google about this particular issue. Suggestions?

Joe Heafner
Sent from one of my Macs

Bruce Sherwood

unread,
Jan 6, 2017, 10:12:26 AM1/6/17
to VPython-users
That would seem to be a failure of the vpython installer to install the vpnotebook module, so the first thing to try would be "pip show vpnotebook" and possibly "pip install vpnotebook" (or the conda equivalents).

What vpnotebook does is execute the following statements:

from __future__ import division, print_function
from math import *

If you are using Python 3, the first statement is irrelevant, but the second statement is of course what allows your students to say sqrt without importing anything themselves.

heafnerj

unread,
Jan 6, 2017, 10:44:22 AM1/6/17
to VPython-users
On Friday, January 6, 2017 at 10:12:26 AM UTC-5, Bruce Sherwood wrote:
That would seem to be a failure of the vpython installer to install the vpnotebook module, so the first thing to try would be "pip show vpnotebook" and possibly "pip install vpnotebook" (or the conda equivalents).


The vpnotebook module is installed as confirmed by both pip and conda.

Joe

heafnerj

unread,
Jan 6, 2017, 10:51:25 AM1/6/17
to VPython-users
Fixed. For some reason, I removed the vpython and vpnotebook packages installed by conda and replaced them with those installed by pip and now I can see the VPython kernel. I have no idea why that should have worked.

Joe

Bruce Sherwood

unread,
Jan 6, 2017, 10:54:36 AM1/6/17
to VPython-users
You're a wizard at applying the right voodoo!

Kevin Karplus

unread,
Jan 6, 2017, 2:44:19 PM1/6/17
to vpytho...@googlegroups.com
Anaconda installs python in a different place than the default python—you have to modify your path if you want to use the anaconda-installed python.  You probably did not need to remove the conda-installed packages as they were (most likely) in a different place than the packages needed for the python you were using.  

It is possible to have many different versions of python installed on a Mac or Linux system, so it is important to make sure that you are invoking the one you intend.  Running
which python
from the shell will tell which one is the default (the first one found on the path).
For me that is 
/Users/kevin/anaconda3/bin/python
​which invokes version 3.5.2.​

​I also have /Users/kevin/anaconda2/bin/python​, which I can invoke as python2 getting version 2.7.12, and /usr/bin/python,  which gets 2.7.10

It sounds like Jupyter was invoking /usr/bin/python instead of whatever anaconda python you had installed.  If you want to numpy, scipy, matplotlib, … it may be worthwhile to figure out where Jupyter is getting its path from, and change that to put the anaconda bin directory before /usr/bin


Kevin Karplus   kar...@soe.ucsc.edu    http://www.soe.ucsc.edu/~karplus
Professor of Biomolecular Engineering, University of California, Santa Cruz
Affiliations for identification only.

On Fri, Jan 6, 2017 at 7:51 AM, heafnerj <heaf...@gmail.com> wrote:
Fixed. For some reason, I removed the vpython and vpnotebook packages installed by conda and replaced them with those installed by pip and now I can see the VPython kernel. I have no idea why that should have worked.

Joe

--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joe Heafner

unread,
Jan 7, 2017, 1:10:27 PM1/7/17
to VPython Users

> On Jan 6, 2017, at 14:43, Kevin Karplus <kar...@soe.ucsc.edu> wrote:
>
> Anaconda installs python in a different place than the default python—you have to modify your path if you want to use the anaconda-installed python. You probably did not need to remove the conda-installed packages as they were (most likely) in a different place than the packages needed for the python you were using.
>
> It is possible to have many different versions of python installed on a Mac or Linux system, so it is important to make sure that you are invoking the one you intend. Running
> which python
> from the shell will tell which one is the default (the first one found on the path).
> For me that is
> /Users/kevin/anaconda3/bin/python
> ​which invokes version 3.5.2.​
>
> ​I also have /Users/kevin/anaconda2/bin/python​, which I can invoke as python2 getting version 2.7.12, and /usr/bin/python, which gets 2.7.10
>
> It sounds like Jupyter was invoking /usr/bin/python instead of whatever anaconda python you had installed. If you want to numpy, scipy, matplotlib, … it may be worthwhile to figure out where Jupyter is getting its path from, and change that to put the anaconda bin directory before /usr/bin

All true, but this was a “fresh” machine with no other Python installation other than what shipped with OS X 10.11. I used precisely the same installation procedures on it that I previously used on my own machines, for which there were no problems. The ONLY difference was that on this machine, I had to install Anaconda inside a non-admin account in addition to an installation within the admin account (installing for all users was denied by the Anaconda installer). “echo $PATH” gave the exact same path on all the machines so I’m 99.999999% certain it wasn’t a path issue.

Anyway, everything is working now so I can finally go Classic-Free with VPython (and GlowScript) for the very first time. I must say, though, that I will miss VIDLE as it’s a nice little editing environment.
Reply all
Reply to author
Forward
0 new messages