I'm trying to use a specific jupyter environment to run a notebook. Ideally I'd like to be able to select the environment from within jupyter, but I would settle at this point for just being able to get the environment to work at all. How can I get the notebook to recognize another environment either by starting in that environment or by selecting it after starting the notebook?
The environment name on the drop down menu at the upper right changes, but the environment does not appear to be activated. Nor is the notebook apparently reading the environment that I was in when I started jupyter lab. Here is what I have tried:
I'm running this notebook on a linux server routed through ssh.
I have multiple environments installed using conda, created with .yml files:
base /FILEPATH/anaconda3
jupyter_env * /FILEPATH/anaconda3/envs/jupyter_env
science_env /FILEPATH/anaconda3/envs/science_env
I activated jupyter_env. I ran this command to add the other environment to the notebook (or so I think):
python -m ipykernel install --user --name science_env --display-name "science_env"
I start a jupyter lab
jupyter lab --port 7989 --no-browser &
and open either a new notebook or an existing notebook. I can see "science_env" in the upper right under the dropdown box and I can select it.
However if I try to import a package that is in science_env and it fails. Also if I open a kernel for that notebook and type "conda info" it still says:
active environment : jupyter_env
Just to check that I have the packages I need installed: In the terminal window when I use "conda list" to show what is in an environment I see that jupyter_env includes (a relevant section of the list in the i-j range, full lists at the bottom):
ipykernel 5.3.1 py38h23f93f0_0 conda-forge
ipython 7.16.1 py38h23f93f0_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
jedi 0.17.1 py38h32f6830_0 conda-forge
jinja2 2.11.2 pyh9f0ad1d_0 conda-forge
json5 0.9.4 pyh9f0ad1d_0 conda-forge
jsonschema 3.2.0 py38h32f6830_1 conda-forge
jupyter_client 6.1.5 py_0 conda-forge
jupyter_core 4.6.3 py38h32f6830_1 conda-forge
jupyterlab 2.1.5 py_0 conda-forge
jupyterlab_server 1.2.0 py_0 conda-forge
in science_envs for the same range I have (it's too long to put the whole list - I could add it later if someone things it is relevant):
ipykernel 5.3.4 py37h43977f1_0 conda-forge
ipyleaflet 0.13.3 pyh9f0ad1d_0 conda-forge
ipython 7.17.0 py37hc6149b9_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
ipywidgets 7.5.1 py_0 conda-forge
jedi 0.17.2 py37hc8dfbb8_0 conda-forge
jinja2 2.11.2 pyh9f0ad1d_0 conda-forge
jmespath 0.10.0 pyh9f0ad1d_0 conda-forge
joblib 0.16.0 py_0 conda-forge
jpeg 9d h516909a_0 conda-forge
json-c 0.13.1 hbfbb72e_1002 conda-forge
jsonschema 3.2.0 py37hc8dfbb8_1 conda-forge
jupyter 1.0.0 py_2 conda-forge
jupyter_client 6.1.6 py_0 conda-forge
jupyter_console 6.1.0 py_1 conda-forge
jupyter_core 4.6.3 py37hc8dfbb8_1 conda-forge
jupyterlab 0.35.6 py37_0 conda-forge
jupyterlab_server 0.2.0 py_0 conda-forge
If I activate the science_env environment, then start the jupyter lab it still does not work. And if I do "conda list" in the console within a jupyter notebook it does not list the same packages as if I do conda list from the command line. The list appears to match my base install and not any of my environments. How can I get the notebook to recognize another environment either by starting in that environment or by selecting it after starting the notebook?
I also tried to set this up for another member of my lab and they are having the same problem. Can anyone help me see why this is not working?
Full list of packages in jupyter_env
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 1_gnu conda-forge
academic 0.6.2 pypi_0 pypi
attrs 19.3.0 py_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.1 py_0 conda-forge
bibtexparser 1.1.0 pypi_0 pypi
bleach 3.1.5 pyh9f0ad1d_0 conda-forge
brotlipy 0.7.0 py38h1e0a361_1000 conda-forge
ca-certificates 2020.6.20 hecda079_0 conda-forge
certifi 2020.6.20 py38h32f6830_0 conda-forge
cffi 1.14.0 py38hd463f26_0 conda-forge
chardet 3.0.4 py38h32f6830_1006 conda-forge
cryptography 2.9.2 py38h766eaa4_0 conda-forge
decorator 4.4.2 py_0 conda-forge
defusedxml 0.6.0 py_0 conda-forge
entrypoints 0.3 py38h32f6830_1001 conda-forge
future 0.18.2 pypi_0 pypi
idna 2.10 pyh9f0ad1d_0 conda-forge
importlib-metadata 1.7.0 py38h32f6830_0 conda-forge
importlib_metadata 1.7.0 0 conda-forge
ipykernel 5.3.1 py38h23f93f0_0 conda-forge
ipython 7.16.1 py38h23f93f0_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
jedi 0.17.1 py38h32f6830_0 conda-forge
jinja2 2.11.2 pyh9f0ad1d_0 conda-forge
json5 0.9.4 pyh9f0ad1d_0 conda-forge
jsonschema 3.2.0 py38h32f6830_1 conda-forge
jupyter_client 6.1.5 py_0 conda-forge
jupyter_core 4.6.3 py38h32f6830_1 conda-forge
jupyterlab 2.1.5 py_0 conda-forge
jupyterlab_server 1.2.0 py_0 conda-forge
ld_impl_linux-64 2.34 hc38a660_9 conda-forge
libffi 3.2.1 he1b5a44_1007 conda-forge
libgcc-ng 9.2.0 h24d8f2e_2 conda-forge
libgomp 9.2.0 h24d8f2e_2 conda-forge
libsodium 1.0.17 h516909a_0 conda-forge
libstdcxx-ng 9.2.0 hdf63c60_2 conda-forge
markupsafe 1.1.1 py38h1e0a361_1 conda-forge
mistune 0.8.4 py38h1e0a361_1001 conda-forge
nb_conda_kernels 2.2.3 py38_0 conda-forge
nbconvert 5.6.1 py38h32f6830_1 conda-forge
nbformat 5.0.7 py_0 conda-forge
ncurses 6.1 hf484d3e_1002 conda-forge
notebook 6.0.3 py38h32f6830_1 conda-forge
openssl 1.1.1g h516909a_1 conda-forge
packaging 20.4 pyh9f0ad1d_0 conda-forge
pandoc 2.10.1 h516909a_0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.7.0 pyh9f0ad1d_0 conda-forge
pexpect 4.8.0 py38h32f6830_1 conda-forge
pickleshare 0.7.5 py38h32f6830_1001 conda-forge
pip 20.1.1 py_1 conda-forge
prometheus_client 0.8.0 pyh9f0ad1d_0 conda-forge
prompt-toolkit 3.0.5 py_1 conda-forge
ptyprocess 0.6.0 py_1001 conda-forge
pycparser 2.20 pyh9f0ad1d_2 conda-forge
pygments 2.6.1 py_0 conda-forge
pyopenssl 19.1.0 py_1 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyrsistent 0.16.0 py38h1e0a361_0 conda-forge
pysocks 1.7.1 py38h32f6830_1 conda-forge
python 3.8.3 cpython_he5300dc_0 conda-forge
python-dateutil 2.8.1 py_0 conda-forge
python_abi 3.8 1_cp38 conda-forge
pyzmq 19.0.1 py38ha71036d_0 conda-forge
readline 8.0 h46ee950_1 conda-forge
requests 2.24.0 pyh9f0ad1d_0 conda-forge
ruamel-yaml 0.16.10 pypi_0 pypi
ruamel-yaml-clib 0.2.2 pypi_0 pypi
send2trash 1.5.0 py_0 conda-forge
setuptools 49.1.0 py38h32f6830_0 conda-forge
six 1.15.0 pyh9f0ad1d_0 conda-forge
sqlite 3.32.3 hcee41ef_1 conda-forge
terminado 0.8.3 py38h32f6830_1 conda-forge
testpath 0.4.4 py_0 conda-forge
tk 8.6.10 hed695b0_0 conda-forge
toml 0.10.1 pypi_0 pypi
tornado 6.0.4 py38h1e0a361_1 conda-forge
traitlets 4.3.3 py38h32f6830_1 conda-forge
urllib3 1.25.9 py_0 conda-forge
wcwidth 0.2.5 pyh9f0ad1d_1 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.34.2 py_1 conda-forge
xz 5.2.5 h516909a_1 conda-forge
zeromq 4.3.2 he1b5a44_2 conda-forge
zipp 3.1.0 py_0 conda-forge
zlib 1.2.11 h516909a_1009 conda-forge