Forums

Altair for PythonAnywhere notebooks?

I've seemingly successfully installed the Altair visualization library, with the following:

pip3 install --user -U altair vega_datasets notebook vega3

However, when I try to spawn a jupyter notebook, it doesn't find the package. Maybe the python version/kernel that the notebook is looking at is not the one I installed into? But I even did the installation from within the notebook, with the same results.

Maybe this would be a good addition to the "batteries included" of PythonAnywhere, if it's technically feasible?

Thanks!

You need to run the version of the pip command that matches your Notebook's kernel. If you run this in one of your notebook's cells:

import sys
print(sys.version)

...then it will print out the full version, which will be something like this:

3.5.2 (default, Jul 17 2016, 00:00:00) 
[GCC 4.8.4]

In that case, it was saying that I was running Python 3.5, so the pip command to install the package would be:

pip3.5 install --user -U altair vega_datasets notebook vega3

Give that a go and let us know how you get on.

Bah, of course. I'll use as my excuse that I only recently made the jump from python2 to python3. Thanks so much, it works perfectly!

altair in notebook

Excellent! Thanks for confirming.