Caffe: Solve the problem: "cannot find -lboost_python3" when using Python3 Ubuntu16.04

Created on 14 Oct 2016  路  12Comments  路  Source: BVLC/caffe

When

make all

cannot find -lboost_python3

occurred.

Then I went to

/usr/lib/x86_64-linux-gnu

search and found that the library file is in different name as

libboost_python-py35.so

so I made a link by following command

sudo ln -s libboost_python-py35.so libboost_python3.so 

which solved my problem.

Suggest that this step could add to Installation Guide

Most helpful comment

I am building caffe under Ubuntu 16.04. The solution for me is to change boost_python3 to boost_python-py35.

All 12 comments

solved my problem thx !

Hi, I am in similar situation, which version of python and libboost did you use ?
Could you upload your Makefile.config file, please ?
thanks

This solution did not work for me, unfortunately. Any reason why?
I changed the boost_python3 in the Makefile.config to boost_python3-py35 and it worked perfectly.

I solved using cmake. I modified the cmakelist.txt, I changed the interpreter line : set(python_version "3.5.2" CACHE STRING "Specify which Python version to use"). And It worked!

Great solution!@H-adorable

I am building caffe under Ubuntu 16.04. The solution for me is to change boost_python3 to boost_python-py35.

Thank you. This has solved my question.

I am building caffe in Ubuntu 16.04. For me changing boost_python3 to boost_python-py35 worked. "boost_python3-py35" did not work for me.

For my Python 3.6 setup, something similar worked, ln -s libboost_python36.so libboost_python3.so

thanks @minhaj3

For those who tried all methods mentioned above and still got the error, check if you have already installed libboost by running: sudo apt-get install -y --no-install-recommends libboost-all-dev.

Ive got multiple python versions using pyenv (3.8 and 3.7).
I started the build on python3.7 and since on my system i had boost_python38 hence in the makefile i edited to look for boost_python38 instead of boost_python37
PYTHON_LIBRARIES := boost_python38 python3.7m
I did that becausesudo apt-get install -y --no-install-recommends libboost-all-dev says requirement already satisfied.

But now when I do make -j4 Im getting this error :-

CXX/LD -o .build_release/tools/extract_features.bin
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status
make: *** [Makefile:630: .build_release/tools/get_image_size.bin] Error 1
make: *** Waiting for unfinished jobs....
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status
make: *** [Makefile:630: .build_release/tools/convert_imageset.bin] Error 1
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status
make: *** [Makefile:630: .build_release/tools/convert_annoset.bin] Error 1
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status
make: *** [Makefile:630: .build_release/tools/extract_features.bin] Error 1
Was this page helpful?
0 / 5 - 0 ratings