Skip to content Skip to sidebar Skip to footer

Python 3.7 Cmath Module Import Error

i installed python3.7 on ubuntu using ppa:deadsnakes/ppa repository. When I try to run import cmath in python shell it fails with message: ModuleNotFoundError: No module named 'cm

Solution 1:

This was a bug in the deadsnakes backport of python3.7 specifically for xenial.

During the 3.7 beta period (when the package was imported). The cpython build system used PY_CORE_CFLAGS as a make variable. It was later changed to PY_STDMODULE_CFLAGS. debian ships a patch with their package that adjusts a generated makefile line using a sed expression for that specific variable. Since this was missing it caused the cmath module to build incorrectly.

This has been fixed in this commit

This fix is available in 3.7.0-1+xenial2 (debian version)

Solution 2:

I installed python3.7 by downloading and installing it using make and cmath started working. It looks like ppa:deadsnakes/ppa repository had missing cmath module.

Post a Comment for "Python 3.7 Cmath Module Import Error"