Skip to content
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

Activating the environment fails if conda not in default path #16

Open
Cadair opened this issue Jun 16, 2016 · 5 comments
Open

Activating the environment fails if conda not in default path #16

Cadair opened this issue Jun 16, 2016 · 5 comments

Comments

@Cadair
Copy link
Owner

Cadair commented Jun 16, 2016

If conda is not in the default path of the shell activating the environment fails. If possible the env vars from the shell that started the notebook need to be passed to the subprocess.

I discovered this as I have a zsh alias that turns on conda.

ping @JanSchulz

@Cadair Cadair mentioned this issue Jun 16, 2016
@jankatins
Copy link
Collaborator

One could argue that not having conda itself in PATH means that you don't want to have conda envs activated... at least on windows, you can't activate an env without having access to the activate.bat script.

If possible the env vars from the shell that started the notebook need to be passed to the subprocess.

AFAIK that's already happening: https://github.com/Cadair/jupyter_environment_kernels/blob/master/environment_kernels/activate_helper.py#L388

@Cadair
Copy link
Owner Author

Cadair commented Jun 16, 2016

When I say fail, it did not fail gracefully maybe we should just add a check to see if activate is in the path before we throw the subprocess?

Interesting, that it seems to be passing in the env, because even when I added conda to my path (in the session, not in the .zshrc) it still did not work.

@jankatins
Copy link
Collaborator

@Cadair Can you add a stacktrace?

@jankatins
Copy link
Collaborator

Is this still the case?

@jbayardo
Copy link

jbayardo commented Aug 6, 2018

Hi; we are seeing the same kind of problem.

When we do:

. /home/ec2-user/anaconda3/etc/profile.d/conda.sh

And then run jupyter lab/notebook:

[I 18:35:17.029 LabApp] Starting initial scan of virtual environments...
[E 18:35:17.034 LabApp] Exception in callback <functools.partial object at 0x7fee7f508aa0>
    Traceback (most recent call last):
      File "/home/ec2-user/anaconda3/envs/male_reco/lib/python2.7/site-packages/tornado/ioloop.py", line 605, in _run_callback
        ret = callback()
      File "/home/ec2-user/anaconda3/envs/male_reco/lib/python2.7/site-packages/tornado/stack_context.py", line 277, in null_wrapper
        return fn(*args, **kwargs)
      File "/home/ec2-user/anaconda3/envs/male_reco/lib/python2.7/site-packages/environment_kernels/core.py", line 151, in _update_env_data
        self._get_env_data(reload=True)
      File "/home/ec2-user/anaconda3/envs/male_reco/lib/python2.7/site-packages/environment_kernels/core.py", line 166, in _get_env_data
        env_data.update(supplyer(self))
      File "/home/ec2-user/anaconda3/envs/male_reco/lib/python2.7/site-packages/environment_kernels/envs_conda.py", line 22, in get_conda_env_data
        env_paths.extend(_find_conda_env_paths_from_conda(mgr))
      File "/home/ec2-user/anaconda3/envs/male_reco/lib/python2.7/site-packages/environment_kernels/envs_conda.py", line 77, in _find_conda_env_paths_from_conda
        stdout=subprocess.PIPE)
      File "/home/ec2-user/anaconda3/envs/male_reco/lib/python2.7/subprocess.py", line 390, in __init__
        errread, errwrite)
      File "/home/ec2-user/anaconda3/envs/male_reco/lib/python2.7/subprocess.py", line 1025, in _execute_child
        raise child_exception
    OSError: [Errno 2] No such file or directory

If we add conda to the default PATH, it is no longer an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants