1

I recently learned about environments in conda, as it was necessary to take advantage of the osmnx library. But I can't get a jupyter notebook to use that environment.

I have followed the instructions/answers/hints from environmental_kernels, a similar stackoverflow questionand this person having the same error on conda_env_dirs. To no avail.

I'll outline my steps I've taken so far.

  • Created and entered an environment using source activate OSMNX
  • Open python and confirm osmnx loads (import osmnx with no errors).
  • Install environment kernels (pip install environment_kernels)
  • Edit ~/.jupyter/jupyter_notebook_config.py by adding the following two lines:

    c.NotebookApp.kernel_spec_manager_class = 'environment_kernels.EnvironmentKernelSpecManager'
    c.EnvironmentKernelSpecManager.env_dirs=['~/.conda/envs']
    
  • Install jupyter in environment (conda install jupyter)
  • Run jupyter notebook

When it runs I see that I can start a new notebook, but only in Python 3.

enter image description here

When I open an existing notebook, I see the option to change kernels, but again only one option listed.

enter image description here

And most importantly, when I try to import osmnx, I get an error.

When I run which python and which jupyter I get two paths:

which python : /Users/scottieb/anaconda/envs/OSMNX/bin/python

which jupyter : /Users/scottieb/anaconda/envs/OSMNX/bin/jupyter

It feels like I must have missed a step with environment kernels, but the setup instructions are so simple that there's not much to have overlooked.

Community
  • 1
  • 1
ScottieB
  • 3,958
  • 6
  • 42
  • 60
  • Did you use anaconda2 or anaconda3 while creating the root environment? – Nehal J Wani Mar 01 '17 at 03:03
  • I used the graphical installer for Python 3.6 (https://www.continuum.io/downloads) – ScottieB Mar 01 '17 at 04:27
  • I recreated the config, but still no success. But then I followed these instructions (http://stackoverflow.com/questions/38280739/how-to-make-conda-virtual-environments-persistent-and-available-for-tools-such-a?rq=1) and have it _finally_ working! Marking this as a duplicate. – ScottieB Mar 01 '17 at 04:37

0 Answers0