matplotlib-cpp icon indicating copy to clipboard operation
matplotlib-cpp copied to clipboard

Fix compiling errors on Windows

Open kokosxD opened this issue 4 years ago • 1 comments

Compiling code from some examples results in compiling errors on 64-bit Windows using Visual Studio 2019. This request fixes these errors and improves the Windows experience of matplotlib-cpp.

Note that compiling in DEBUG configuration still causes some runtime exceptions, but this is just a comment and this request doesn't deal with fixing it

Traceback (most recent call last):
  File "Python39\site-packages\numpy\core\__init__.py", line 22, in <module>
    from . import multiarray
  File "Python39\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "Python39\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Python39\site-packages\numpy\__init__.py", line 145, in <module>
    from . import core
  File "Python39\site-packages\numpy\core\__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.9 from "build.exe"
  * The NumPy version is: "1.20.3"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'

Traceback (most recent call last):
  File "Python39\site-packages\numpy\core\__init__.py", line 22, in <module>
    from . import multiarray
  File "Python39\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "Python39\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Python39\lib\site-packages\matplotlib\__init__.py", line 107, in <module>
    from . import _api, cbook, docstring, rcsetup
  File "Python39\lib\site-packages\matplotlib\cbook\__init__.py", line 28, in <module>
    import numpy as np
  File "Python39\site-packages\numpy\__init__.py", line 145, in <module>
    from . import core
  File "Python39\site-packages\numpy\core\__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.9 from "build.exe"
  * The NumPy version is: "1.20.3"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'

kokosxD avatar May 21 '21 16:05 kokosxD

In my fork, I ended up temporarily disabling _DEBUG when it includes Python.h to work around the debug issues.

DentonW avatar Aug 29 '21 13:08 DentonW