Jupyter not running 'source' after opening from Anaconda exe

41 views
Skip to first unread message

Matthew Gidden

unread,
Nov 26, 2018, 6:29:21 AM11/26/18
to Project Jupyter
 
<crossposting from Anaconda Public>

Hi all,

I have a colleague who recently installed anaconda who is having trouble getting the Jupyter launcher to recognize environment variables in her conda environment.

Specs - Windows 10, Python 3.5
Package at issue - message_ix (channel: conda-forge)

`nb_conda` is already installed to access conda environments in the notebooks.

We get correct behavior in two cases:

1) launch anaconda prompt and run `$ jupyter notebook`. Opening the prompt runs the `source` command as expected.
2) launch cmd, run `$ source`, then run `$ jupyter notebook`

However, when launching the notebooks from the provided exe (via clicking through the start menu), the environment is not `source`d.

I have confirmed that Anaconda is in the user's `PATH`.

Has anyone else observed this, is there a known fix?

Best,
Matt

Roland Weber

unread,
Nov 27, 2018, 1:26:03 AM11/27/18
to Project Jupyter
Hello Matt,

it is the nature of an "environment", including all environment variables, that it must be established _before_ invoking a command. Commands run within the environment in which you start them. They can respond to environment settings, or report errors if they cannot work within the environment. But a command is not supposed to say "No, I don't want to run in this environment, I'll just create a totally different one instead."

Write a shell script or batch file that activates the Anaconda environment and then calls the Jupyter command within that environment.

cheers,
  Roland

Matthew Gidden

unread,
Nov 27, 2018, 4:55:04 AM11/27/18
to jup...@googlegroups.com
Hi Roland,

Thanks so much for your answer. I can indeed write a bash/powershell script for our users to open their notebook server under the right environments. Does anyone know if this is a feature that will be in a future jupyter release? At the moment, with `nb_conda` you can switch your kernel to a different conda environment. It seems like a missing feature that this does not also activate this environment. Or do I have something here mixed up?

Best,
Matt

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/64ecac5b-0ba7-4902-beb0-1bb671a167ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roland Weber

unread,
Nov 28, 2018, 1:13:34 AM11/28/18
to Project Jupyter
Hello Matt,

you have something mixed up. The nb_conda module runs inside the Jupyter process and starts kernels in separate processes. It's the task of that module to establish the environment for those kernel processes. But it has no control over the environment of the Jupyter process itself. In fact, you need to establish that environment beforehand, so that Jupyter can find and load the nb_conda module in the first place.

cheers,
  Roland

Damián Avila

unread,
Dec 6, 2018, 9:59:46 AM12/6/18
to jup...@googlegroups.com
Quick correction, the package allowing to change kernels is nb_conda_kernels, and there were some changes lately addressing the activation issue (thanks to Michael Grant): https://github.com/Anaconda-Platform/nb_conda_kernels#220 (PR for the interested: https://github.com/Anaconda-Platform/nb_conda_kernels/pull/80).

Hope it helps!

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Damián Avila
Reply all
Reply to author
Forward
0 new messages