Previously when I launched a jupyter-notebook within a conda environment I would have access to the conda environment. I recently started with a clean Anaconda3 (macOS) install and now I can no longer connect to the conda env with jupyter. The issue seems to be related to this issue and this stack-overflow question.
As noted in the comments the question is closely related to this SO question as well. However question is probably closer and none of the answers in either fix my issue.
I would expect after creating and activating a conda env, that either jupyter notebook:
- would work out of the box and recognize the environment it was launched in: this does not happen. the jupyter-notebook doesn't have access to the modules installed in the new env
- or, i would need to run conda install jupyter in the new environment. the install fails with ImportError: cannot import name 'ensure_dir_exists'. Note the traceback does indeed indicate that it is using the correct conda-env /Users/brook/anaconda3/envs/test2/lib/python3.6/site-packages/notebook/nbextensions.py
I tried the following:
conda update jupyter_core jupyter_client
in the base env: this did not fix any of the problemsconda install jupyter_core jupyter_client
notebook in the new env: these installed correctly but then when i ran jupyter notebook i got ImportError: cannot import name 'ensure_dir_exists'conda install nb_conda
in the new env but that also failed with ImportError: cannot import name 'ensure_dir_exists'conda install nb_conda
in the base env: this almost worked - i think. after launching the notebook the conda tab shows my current env as the default.
However when creating a notebook i do not see it listed as an option
I thought that since its checked as the default the "Python 3" option would be the current env "test3". However this still didn't work - importing modules give ModuleNotFoundError and double checking at the command line the modules are correctly installed.
Finally. I should note that recently I did a Unix install on a cloud instance and running conda install jupyter in the new env worked as expected.
For those who made it this far, some details:
- macOS (10.11.6)
- i tried the graphical-installer, also the cmd line install from the most recent version as well as 5.3.1 and 5.2.0
- and ...
Thanks!