Packages from Conda env not found on Jupyer Notebook

I created an environment called imagescraper and installed pip with it.

Then I move on to using pip to install a package called ImageScraper;

>>activate imagescraper [imagescraper]>>pip install ImageScraper 

Just to make sure the package is successfully installed:

 >>conda list [imagescraper] C:\Users\John>conda list # packages in environment at C:\Anaconda2\envs\imagescrap # future 0.15.2 <pip> imagescraper 2.0.7 <pip> lxml 3.6.0 <pip> numpy 1.11.0 <pip> pandas 0.18.0 <pip> pip 8.1.1 py27_1 python 2.7.11 4 python-dateutil 2.5.2 <pip> pytz 2016.3 <pip> requests 2.9.1 <pip> setproctitle 1.1.9 <pip> setuptools 20.3 py27_0 simplepool 0.1 <pip> six 1.10.0 <pip> vs2008_runtime 9.00.30729.1 0 wheel 0.29.0 py27_0 

Before starting a Jupyter laptop, just check where we get the path from:

 [imagescraper] C:\Users\John>python Python 2.7.11 |Continuum Analytics, Inc.| (default, Feb 16 2016, 09:58:36) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org >>> import sys >>> sys.executable 'C:\\Anaconda2\\envs\\imagescraper\\python.exe' >>> import image_scraper 

Everything seems to be in order, so I proceed to launch the Jupyter laptop with

 [imagescraper]>>jupyter notebook 

In the notebook, I created a new book, and when I tried the same thing,

 import image_scraper 

I am returning with:

 --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-1-6c2b65c9cdeb> in <module>() ----> 1 import image_scraper ImportError: No module named image_scraper 

By doing the same to check the paths in a Jupyter laptop, I get this:

 import sys sys.executable 'C:\\Anaconda2\\python.exe' 

Which tells me that this does not apply to the environment where I installed the modules.

Is there a way to ensure that my laptops are native env packages?

+7
python ipython jupyter-notebook
source share
1 answer

Here are two possible solutions:

You can register a new kernel based on the imagescraper . The kernel starts from the imagescraper environment and, therefore, sees all its packages.

 source activate imagescraper conda install ipykernel ipython kernel install --name imagescraper 

This will add a new kernel called imagescraper to the jupyter toolbar.


Another solution is to install jupyter notebook in the imagescraper environment and run jupyter from the environment. To do this, activate imagescraper every time you start the jupyter laptop.

 source activate imagescraper conda install notebook jupyter notebook 
+11
source share

All Articles