Skip to content
Advertisement

ModuleNotFoundError: No module named ‘sympy’

I’m on MacOSX Mojave 10.14.6 on a MacBook Pro 2015. So I pip installed sympy, right?

I head over to my shell, run python3, and do:

$python3
Python 3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:36:03) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sympy'

Just to be sure, I pip installed again just to make sure.

$ pip install sympy
Requirement already satisfied: sympy in /usr/local/lib/python3.7/site-packages (1.4)
Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.7/site-packages (from sympy) (1.1.0)

My pip list also includes sympy as sympy 1.4.

What’s wrong here? Is there another setup step I’ve missed?

Advertisement

Answer

Apparently all I had to do was

python3 -m pip install sympy

Mac being weird with two built in pythons and a third python for user.

Pro tip: use a virualenv.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement