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

Getting Notebooks to recognize conda env ( ImportError: cannot import name 'ensure_dir_exists' ) #4435

Open
brookisme opened this issue Mar 1, 2019 · 0 comments

Comments

@brookisme
Copy link
Contributor

brookisme commented Mar 1, 2019

Hi Jupyter-Folk.

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.

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 problems
  • conda 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.

screen shot 2019-02-28 at 5 41 00 pm

However when creating a notebook i do not see it listed as an option

screen shot 2019-02-28 at 5 41 22 pm

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 ...

screen shot 2019-02-28 at 5 47 51 pm

Thanks!

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