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:
- mkdir build
- cd build
- cmake ..
- make
- 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"
/usr/local/include/boost/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?
Thanks.
Best Answer
Since you're including the header as
it expects to find
numpy.hpp
in a subdirectorypython
of a directoryboost
somewhere on either the default include file search path, or a path supplied to the compiler via the-I
optionHowever, the file is actually at
with no
python
subdirectory - so you should include it in your C++ file as justand then telling
g++
to add/usr/local
to the include file search path