3

I am setting up boost-python for the python bindings of a library. Previously, boost was installed but linked against python2.7. After some tribulations, everything from the previous boost install is gone and I am trying to install a fresh boost.

I am using Linux Mint for the record, and Anaconda with python 3.6.8. It works correctly in the CLI : python --version gives 3.6.8

I then begin to follow the instructions for building boost : https://www.boost.org/users/history/version_1_69_0.html

What I got from other threads is to do this :

sudo apt-get install python3-dev

I am not sure I am supposed to since I have anaconda3 but anyway, I did it.

./bootstrap.sh

here the file project-config.jam is created and the line about python says :

using python : 3.6 : /home/myUser/anaconda3 ; 

I then proceed to build with b2 :

sudo ./b2 --with-python -j8 install

the installation fails with literally a wall of text full of these :

./boost/python/detail/wrap_python.hpp:50:11: fatal error: 
pyconfig.h: No such file or directory
# include <pyconfig.h>
          ^~~~~~~~~~~~
compilation terminated.

When I search inside ~/anaconda3/include/python3.6m the file pyconfig.h sits there as expected

Is there additional information I should give to b2 or bootstrap ?

Patafikss
  • 154
  • 1
  • 2
  • 15

1 Answers1

5

I face the same problem for installing boost 1.70 and Anaconda3 with python Anaconda with python 3.7.1. I found an answer based on this question. Ubuntu - Linking boost.python - Fatal error: pyconfig cannot be found

By the way to solve this problem first you should find the "pyconfig.h" file in the installation directory of Anaconda. For me it's in "~/anaconda3/include/python3.7m". Then export this address or just add this address to the .bashrc file.

export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:path/to/your/Anaconda3/include/python3.7m"

Put the address to Anaconda in your pc instead of path/to/your/Anaconda3. Remember to restart the terminal after this. Then again just run "./b2" in the boost folder. It should compile the rest.