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

Run jupyter notebook in a conda env can't change kernel with correct $PATH #71

Open
scku208 opened this issue Apr 13, 2018 · 0 comments

Comments

@scku208
Copy link

scku208 commented Apr 13, 2018

I install miniconda and create a env named "startup", then I install jupyter notebook and some extensions in it.
I also create some other envs for different jobs, named like "sci", "gis",..., install required packages in it.

run terminal with:

source activate startup
jupyter-notebook

everything looks great, open an ipynb file and run cell:

import os
os.environ['PATH']

give the path like
/Users/scku/miniconda3/envs/startup/bin:/Users/scku/miniconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin"

run:

import sys
sys.path

give the path
['',
'/Users/scku/miniconda3/envs/startup/lib/python36.zip',
'/Users/scku/miniconda3/envs/startup/lib/python3.6',
'/Users/scku/miniconda3/envs/startup/lib/python3.6/lib-dynload',
'/Users/scku/miniconda3/envs/startup/lib/python3.6/site-packages',
'/Users/scku/miniconda3/envs/startup/lib/python3.6/site-packages/IPython/extensions',
'/Users/scku/.ipython']

but when I change kernel by "Kernel" -> "Change kernel" -> "conda env:sci"
run

import os
os.environ['PATH']

get the confusion path (still "starup", no "sci")
'/Users/scku/miniconda3/envs/startup/bin:/Users/scku/miniconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin'

run

import sys
sys.path

get the path I expect
['',
'/Users/scku/miniconda3/envs/sci/lib/python36.zip',
'/Users/scku/miniconda3/envs/sci/lib/python3.6',
'/Users/scku/miniconda3/envs/sci/lib/python3.6/lib-dynload',
'/Users/scku/miniconda3/envs/sci/lib/python3.6/site-packages',
'/Users/scku/miniconda3/envs/sci/lib/python3.6/site-packages/IPython/extensions',
'/Users/scku/.ipython']

shouldn't the "changing kernel behavior" like (run with terminal):

#default path
KuShangChende-MacBook-Air:~ scku$ echo $PATH
/Users/scku/miniconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin
#startup path + default path
KuShangChende-MacBook-Air:~ scku$ source activate startup
(startup) KuShangChende-MacBook-Air:~ scku$ echo $PATH
/Users/scku/miniconda3/envs/startup/bin:/Users/scku/miniconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin
# sci path + startup path + default path
(startup) KuShangChende-MacBook-Air:~ scku$ source activate sci
(sci) KuShangChende-MacBook-Air:~ scku$ echo $PATH
/Users/scku/miniconda3/envs/sci/bin:/Users/scku/miniconda3/envs/startup/bin:/Users/scku/miniconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin

Or I missed something? thanks for help.

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

1 participant