Rich
Rich

Reputation: 1163

Can't install the "Boost" prerequisite for Caffe

I'm getting into machine learning, and I recently happened upon this: Wide-Area Image Geolocalization with Aerial Reference Imagery .

It's a net that predicts the GPS location of an image, from just the image. Needless to say, I was thrilled, only to discover that one of the requirements:

import glob
import caffe
import numpy as np
import multiprocessing
import matplotlib.pyplot as plt
from collections import defaultdict

was Caffe, which I can't seem to install, because I can't install the main prerequisite: Boost

I first tried to run the standard sudo apt-get install libboost-all-dev, which not only failed:

The following packages have unmet dependencies:
 libboost-all-dev : Depends: libboost-chrono-dev but it is not going to be installed
                    Depends: libboost-date-time-dev but it is not going to be installed
                    Depends: libboost-filesystem-dev but it is not going to be installed
                    Depends: libboost-graph-dev but it is not going to be installed
                    Depends: libboost-graph-parallel-dev but it is not going to be installed
                    Depends: libboost-iostreams-dev but it is not going to be installed
                    Depends: libboost-log-dev but it is not going to be installed
                    Depends: libboost-mpi-dev but it is not going to be installed
                    Depends: libboost-mpi-python-dev but it is not going to be installed
                    Depends: libboost-program-options-dev but it is not going to be installed
                    Depends: libboost-python-dev but it is not going to be installed
                    Depends: libboost-regex-dev but it is not going to be installed
                    Depends: libboost-serialization-dev but it is not going to be installed
                    Depends: libboost-system-dev but it is not going to be installed
                    Depends: libboost-thread-dev but it is not going to be installed
                    Depends: libboost-wave-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

It gave me a "but it is not going to be installed" error. I then tried to install from source:

wget -O boost_1_55_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
tar xzvf boost_1_55_0.tar.gz
cd boost_1_55_0/
./bootstrap.sh --prefix=/usr/local
./b2

And that promptly filled up my entire terminal with g++ errors. I then tried to start from scratch:

sudo apt-get --purge remove libboost-all-dev libboost-dev libboost-doc
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get clean
sudo apt-get update
sudo apt-get install libboost1.54-dev

And while that worked with the test script: How to Install boost on Ubuntu?

When I tried then to make caffe, I got this:

CXX src/caffe/util/db.cpp
In file included from ./include/caffe/common.hpp:19:0,
                 from ./include/caffe/util/db.hpp:6,
                 from src/caffe/util/db.cpp:1:
./include/caffe/util/device_alternate.hpp:34:23: fatal error: cublas_v2.h: No such file or directory
 #include <cublas_v2.h>
                       ^
compilation terminated.
make: *** [.build_release/src/caffe/util/db.o] Error 1

What could be the problem here?

Upvotes: 1

Views: 1046

Answers (1)

Vtik
Vtik

Reputation: 3140

Well, I don't think it is a Boost problem but a Caffe one !

It's been already reported that For Caffe installation, Make sure to set CPU_Only := 1 In your makefile.config as the following :

# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1

This is due to your device_alternate.hpp having the following :

line  4: #ifdef CPU_ONLY
line 32: #else
line 34: #include <cublas_v2.h>
line 99: #endif

Upvotes: 2

Related Questions