I am on Ubuntu 14.04 and I have libboost-all-dev installed (Boost 1.54) and I need to install the Boost.NumPy library.

I know that NumPy comes with Boost 1.64+ but I need to stick with 1.54 for now, and hence I need to installed from this repo which is currently deprecated.

I followed the instructions under Boost.NumPy/libs/numpy/doc/cmakeBuild.rst. These instructions are:

  1. mkdir build
  2. cd build
  3. cmake ..
  4. make
  5. sudo make install

All good, I don't get any errors during these commands, so I assume that Boost.Numpy was installed successfully on my system.

I tried to compile a simple C++ program to check if the system can find the file but it is not working.

The C++ file just contains the following header:

#include <boost/python/numpy.hpp>

I then compile like this:

g++ test.cpp

I get the error:

test.cpp:1:34: fatal error: boost/python/numpy.hpp: No such file or directory
 #include <boost/python/numpy.hpp>
compilation terminated.

I tried to search for the header file and I can see that is there.

$ sudo find / -name "numpy.hpp"

I have also added the following in my .bashrc file:

export INCLUDE="/usr/local/include/boost:$INCLUDE"
export LIBRARY_PATH="/usr/local/include/boost:$LIBRARY_PATH"
export CFLAGS="-I/usr/local/include/boost"

Still nothing.

So why is Boost.Numpy not installed properly? What do I miss? The documentation is quite minimal and I couldn't find anything else around.

And in general, how can I find out if a Boost library I have installed is available to the system?


1 Answer 1


Since you're including the header as


it expects to find numpy.hpp in a subdirectory python of a directory boost somewhere on either the default include file search path, or a path supplied to the compiler via the -I option

However, the file is actually at


with no python subdirectory - so you should include it in your C++ file as just

#include <boost/numpy.hpp>

and then telling g++ to add /usr/local to the include file search path

g++ -I/usr/local/include test.cpp

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .