-
Notifications
You must be signed in to change notification settings - Fork 793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gallery examples that use altair.expr module #657
Comments
Sorry for the confusion – we removed the old bloated expr module before adding back in a new version of the expr module. It will stay, and those examples will continue to function. |
perhaps I have to do the 'run from master' ( |
It depends what you want to do... if you install 2.0.0rc1 then you should have the expr module installed as well. Try running
to make certain you're importing the version you think you're importing. |
Oh, you can't install 2.0.0rc1 via conda-forge... you need to install it via pip. If you did conda install altair, then you have altair version 1.3. |
See the installation page for details: https://altair-viz.github.io/getting_started/installation.html |
For version and path, I get:
and when I do
|
That's very strange... were these cells run with the same kernel? I see that the top cell has execution count 4 and the bottom cell has execution count 1. Can you restart the kernel and then run these in sequence? |
OK, so you're not actually running 2.0.0rc1... the So basically, you pip installed Altair 2.0.0rc1 in one Python kernel, and you're running Jupyterlab on another kernel, so you're importing an old version of Altair. This is one of the biggest warts of the jupyter multi-kernel model right now. I suspect if you run
and
you will see different executables. I wrote a whole blog post about this issue; you can read it here: https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/ What you need to do is make certain you have installed altair in the kernel you're using in JupyterLab. The easiest way to do this is probably to exit Jupyterlab, run the Let me know how it goes. |
Indeed, they were two different executables I've tried a slew of things, and still no luck.. I'm running a conda environment, that in the terminal has pip installed altair. But now that both are consistently using the conda36 environment, I'm getting I'm going to try to use regular virtualenv to get a python3 environment, to see if I have any better luck that way. actually, before I do that, I'll see if I can work my way through your blog post. |
Are you using Conda environments, or just the root environment? |
Using Conda environments.
On Mon, Mar 26, 2018 at 8:35 PM Jake Vanderplas ***@***.***> wrote:
Are you using Vonda environments, or just the root environment?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#657 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALwOFtsvxp4B00ndX_hyIZP_-KcWYBrks5tiYlCgaJpZM4S6zWa>
.
|
Ah, I know what's happening then. I suspect you're creating a conda environment, installing Altair in it, and not installing JupyterLab. This means that when you run So you need to make an environment:
and then follow the installation instructions from https://altair-viz.github.io/getting_started/installation.html#installing-altair-with-jupyterlab including installing JupyterLab (don't skip that step)
Now you can run If you forget to install jupyterlab in the new environment, then launching juptyerlab will use the executable from the root environment, and plots won't work. If you open a notebook with the wrong kernel, then it won't have access to the altair version that you installed, and plots won't work. Hope that helps |
To the helpful instructions you provided above, I added: Then after overcoming all the installation challenges, I had to remember to actually print the chart in the gallery examples! It might be helpful if each gallery example ended with A note that the guidance here: For instance, success didn't require me to do this in the Jupyter lab I just did Given this tweet, and that others are encountering a range of similar issues: In any case, the altair.expr import are now working for me. (I'm not yet confident that I can talk others through it.) I think part of the challenge is that I don't exactly understand what a Jupyter lab/notebook kernel is. Maybe in addition to the if-this-goes-wrong-then-do-that, it might help to explain why
and
yield different results, and how that relates to executables and Jupyter Lab kernels. In essence:
|
That's why I wrote that blog post... note that the blog post is not an attempt to help people install Altair, but an attempt to help people understand why |
No, I think this adds too much confusion, because it's unnecessary. You just need to choose the Python 3 kernel (which in this case is now identical to the altair-test kernel) This is why in the installation instructions I emphasize "Choose the Python 3 kernel". As long as you follow the installation instructions exactly, it will work. |
No, the only thing that is necessary is to follow the exact installation instructions given in the docs. That pattern from the (unrelated) blog post is what you need if you want to install a package within an already running jupyter notebook, which is orthogonal to the altair installation question. |
That could be helpful. |
I think the best option is to point people to Colab, now that it's working. There are just too many variables in play with JupyterLab/Jupyter notebook + jupyter extensions/ipyvega + conda envs/pip envs + exact versions needed + confusion about installation and execution paths. |
Good to know about Colab!! |
I see the "Decision: remove expr module" in #459
But many of the examples in the gallery include
from altair.expr import datum
So each of those examples yields a
ModuleNotFoundError
For instance:
etc.
Hopefully these examples can be updated so that they function.
The text was updated successfully, but these errors were encountered: