Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_include_path for numpy include headers isn't detected #505

Open
kfirufk opened this issue Dec 4, 2023 · 0 comments
Open

add_include_path for numpy include headers isn't detected #505

kfirufk opened this issue Dec 4, 2023 · 0 comments

Comments

@kfirufk
Copy link

kfirufk commented Dec 4, 2023

Hi, I'm trying to get matplotlib-cpp to work, there is wonderful example at #255 for that, but unfortunately it does not work in my case.

I'm on Gentoo Linux with python 3.11.6

i created the following code snippet in the notebook:

#pragma cling add_include_path("/usr/include/python3.11")
#pragma cling add_include_path("/usr/lib/python3.11/site-packages/numpy/core/include")


#include "matplotlibcpp.h"
#include <vector>
#include <cmath>

namespace plt = matplotlibcpp;

    std::vector<double> t(1000);
    std::vector<double> x(t.size());

    for(size_t i = 0; i < t.size(); i++) {
        t[i] = i / 100.0;
        x[i] = sin(2.0 * M_PI * 1.0 * t[i]);
    }

    plt::xkcd();
    plt::plot(t, x);
    plt::title("AN ORDINARY SIN WAVE");
    plt::show();

and I get:

In file included from input_line_19:1:
/usr/local/include/matplotlibcpp.h:20:12: fatal error: 'numpy/arrayobject.h' file not found
#  include <numpy/arrayobject.h>
           ^~~~~~~~~~~~~~~~~~~~~

Interpreter Error: 

I know that the add_include_path functionality works cause before i included /usr/include/python3.11 i would get error about missing Python.h.
directory /usr/lib/python3.11/site-packages/numpy/core/include includes numpy/arrayobject.h, so what am I missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant