6

I am trying to plot some data in Python and therefore require matplotlib. When trying to import it, I get the ModuleNotFoundError.

My line that raises the error is

import matplotlib.pyplot as plt

My installed packages include (according to PyCharm's Python Interpreter Menu):

matplotlib==3.3.4
numpy==1.20.1
pandas==1.4.3
kiwisolver==1.3.1

The stack trace shows

  File "C:\Program Files\JetBrains\PyCharm 2020.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2020.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/user/pycharm/ai_ems/data/data_classes/load/electrical/fit_compressor_data.py", line 3, in <module>
    import matplotlib.pyplot as plt
  File "C:\Program Files\JetBrains\PyCharm 2020.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\user\pycharm\ai_ems\ems-gym\venv_ems-gym\lib\site-packages\matplotlib\__init__.py", line 174, in <module>
    _check_versions()
  File "C:\Users\user\pycharm\ai_ems\ems-gym\venv_ems-gym\lib\site-packages\matplotlib\__init__.py", line 168, in _check_versions
    module = importlib.import_module(modname)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'kiwisolver'
bad_coder
  • 11,289
  • 20
  • 44
  • 72
naraghi
  • 430
  • 1
  • 6
  • 18
  • Yup, apparently they are. but after finding this : https://github.com/nucleic/kiwi/issues/68 I uninstalled and reinstalled kiwisolver, and for some reason it works now – naraghi Mar 11 '21 at 12:10

1 Answers1

11

After finding this: https://github.com/nucleic/kiwi/issues/68:

I uninstalled and reinstalled kiwisolver, and for some reason it works now.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
naraghi
  • 430
  • 1
  • 6
  • 18
  • In my case I just needed to uninstall it; the reinstall said `Requirement already satisfied`. I had installed matplotlib via conda, but the fix was to uninstall via pip (the pip in the conda environment). So all I had to do was `pip uninstall kiwisolver` from within my conda environment. – MindSeeker Mar 20 '23 at 21:02