2

first time on stack overflow. Basically pip is installing packages and Jupyter notebook can't find them to import. I've searched other similar questions and found some tips, but none of them have worked in my particular instance. I've shown the information that was helpful in other posts so you can see what I' mworking with:

My Notebook

In similar questions they've asked what "jupyter kernelspec list" returns in the terminal, so I've inlcuded that here:

KernelSpec Results

I would include my kernel.json file as well, but I tried changing with it, and upon seeing no change, tried deleting it altogether and my notebook runs fine.

So I'm thoroughly confused, and could really use some help.

Thankyou

asolano3
  • 21
  • 2

1 Answers1

0
  1. Make sure the packages you think you installed are really installed to the running environment. E.g. from inside notebook run:

    !pip list | grep package_name

  2. If the package in question is installed, get details using [pip show][1]

!pip show pyyaml

Name: PyYAML
Version: 5.1
Summary: YAML parser and emitter for Python
Home-page: https://github.com/yaml/pyyaml
Author: Kirill Simonov
Author-email: xi@resolvent.net
License: MIT
Location: /home/ntg/anaconda3/lib/python3.7/site-packages
Requires: 
Required-by: bokeh, anaconda-client
  1. Remember that for some libraries the import is not the name of the module,e.g. to install pyyaml I did pip install pyyaml, but to import it I will need import yaml... When in doubt, google the specific module.

Keep in mind that pip deals with modules (think libraries such as pandas). If you cannot find some of your code, make sure it is in the directory you think it is, if not in the same directory, make sure the other directory has a file named init.py to denote the dir is a module, and possibly check Cannot import from __init__ in a subfolder

ntg
  • 12,950
  • 7
  • 74
  • 95