0
votes

got a new laptop (MacBook Air with Catalina) and installed python 3 thru Homebrew.

When trying to install and run some libraries in a jupyter notebook (also installed thru Homebrew) like:

!pip3 install pandas 

and then:

import pandas as pd

I get the error:

ModuleNotFoundError: No module named 'pandas'

Same thing with numpy, matplotlib, bs4, etc. Even though when I rerun the !pip3 install something I get the message:

Requirement already satisfied: numpy in /usr/local/lib/python3.8/site-packages (1.19.2)

When I run:

!which python3
!which pip3

I get

/usr/local/bin/python3

/usr/local/bin/pip3

is there something I'm doing wrong?

2
You would need to restart the kernel in jupyter before importingOneCricketeer
Try running python3 -m pip list and see if they are installedLisa
Already restarted kernel and nothing.Cateban
running python3 -m pip list I get Package Version --------------- ------- beautifulsoup4 4.9.3 bs4 0.0.1 numpy 1.19.2 pandas 1.1.3 pip 20.2.3 python-dateutil 2.8.1 pytz 2020.1 setuptools 49.2.0 six 1.15.0 soupsieve 2.0.1 wheel 0.34.2Cateban
check in a jupiter: print(sys.version) which version it useTimur U

2 Answers

0
votes

I’ve catch like this problem It helped me that:

Uninstall python And install python Then reboot system

I guess your Catalina use 3 version py3 this time It’s need realias

I guess on Mac OS is better to use pip3 by terminal.

0
votes

Problem seemed to be installing jupyter thru homebrew. Uninstalled it, and then reinstalled it with pip and now everything is working