lava / matplotlib-cpp

Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib
MIT License
4.27k stars 1.12k forks source link

File Not Found errors when installing matplotlib-cpp on Mac with Xcode and Python #318

Open KGx55 opened 2 years ago

KGx55 commented 2 years ago

This is about an attempt to install matplotlib-cpp.h onto a Mac. I have been looking for a solution, but have not yet found one.

When installing this onto the Mac running Xcode 13.4.1 and Python3.10.5. Xcode was first updated, and then Python was installed, then pip was used to install matplotlib. All operated correctly. In order to install matplotlib for C++, I downloaded matplotlib-cpp and placed it into its own directory.

The sample program minimal.cpp was used to create a new Xcode project.

In that project-program, the line,

include "../matplotlibcpp.h"

Returned a file not found error.

When a specific path to the file was added to the program, the compiler found matplotlibcpp.h but returned a file not found error for Python.h

After tracking down that error and providing a complete path, two more file not found errors emerged, and so on.

There must be a way to direct the compiler to use all the necessary include files and have them operate correctly. So far, I have not found code that pulls it all together and makes it work with the Xcode C++ example. Perhaps a future release could have instructions on how to accomplish the installation along with whatever is needed to reference all the needed include files.

NoahPrentice commented 1 week ago

Same problem here. Running Python 3.9.6 and on MacOS Sonoma 14.2.1. Python was reinstalled with Homebrew 4.3.6 and then I pip3 installed matplotlib. I copied the matplotlib-cpp library into its own directory, and had the same errors when running a sample program. Chat-GPT could also not identify any user error (though this is not particularly surprising).