-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Change in behavior launching ipython notebooks from anacona environment #541
Comments
I'm not familiar with Anaconda, because I do not use it. However, try |
+1 to the |
@jdfreder - I'm not sure your idea will work with Conda. Basically, to switch conda environments, you need to add the appropriate directory to your path. The thing about just invoking the python in the correct location is that anything else may use the wrong scripts since the path isn't set correctly. By the way, I think |
First of all:
and in the notebook:
which is reasonable becuase the native kernel lives in the environment... So... it is weird that your kernel is pointing to the root environment... Do you have any kernels in the JUPYTER_DATA_DIR directory? Also:
Here @minrk explained a little bit more if you need more insight: ipython/ipython#8877 |
Yes. I do have three kernels in the ls /Users/jhamman/Library/Jupyter/kernels/
bash/ python2/ python3/ so the |
And I guess the |
The notebook no longer relies on IPython, which provides one of many kernels. For convenience the notebook does, however, add the IPython kernel for the notebook server's env if no Python kernel is already registered. That IF is the source of frustration, if you want to be doing it all the time, though. The idea being that changing the env of the notebook server should not change the env of your kernels. Similarly, making an env with a kernel doesn't require installing the notebook in that env, just the kernel. This is my habit - I frequently make envs and install IPython in them, and register a kernelspec for the env. What I don't do is install the notebook server multiple times. We could also make the in-env kernel available unconditionally with a different name, though. It's more special treatment of IPython than we wanted, but it may be appropriate to put this behavior back. There's another hack you can do, and I'm not sure if/how we can make it more convenient to do so: Change the absolute path for Python in the kernel.json to just |
@minrk Are you using conda? Does that mean you have a notebook server installed in conda root and not elsewhere? If so, how do you get the PATHs right when you are working in an env? Pity this has become so brain-braking... |
@michaelaye yes, I'm using conda, and the notebook (latest master) is in the root env. I also have an env called |
So, the kernel text is so simple, I just added what I needed into my |
+1 |
as an update for anybody who struggles with this, it seems that the conda package |
Thanks @michaelaye for the update; it's true that Do you think the issue can be closed ? |
for me yes, but @jhamman should decide. |
Yes, I was imprecise in my question, I was addressing to everyone but it was unclear. |
When I run However, when I run Then, when I run But, this location does not have a JSON file in it. Any suggestions as to how I can get the two paths to match? FYI, I am working in a Windows environment. |
Two options:
|
Cross posting this issue from ContinuumIO/anaconda-issues#461.
Previously, I have been able to run ipython notebooks from Anaconda environments using this workflow:
and then in a new notebook
would yield
Recently, this behavior has changed (I've seen it on Mac OS and Linux for Python 2.7 and 3.4). Now I get the root anaconda python executable:
Consequently, I'm not able to import/use packages in my environments from ipython notebooks. If I start an ipython session in the terminal, this problem does NOT exist. So this may just be an issue with the notebook kernels.
After discussion with @jasongrout, it seems like this change came in the 4.0 release.
@jasongrout and I have discussed methods for allowing the environment executable to be an available (default) kernel when launching a notebook from a virtual environment.
The first idea mentioned was
ipython notebook --defaultkernel
, wheredefaultkernel
indicates that the user would like to use the python executable that is launching the notebook.cc @minrk @jasongrout
xref: ContinuumIO/anaconda-issues#461 ipython/ipython#8880
The text was updated successfully, but these errors were encountered: