1

I am having an issue building OpenSFM. I am getting an error from running the setup.py file.

First, I am running Ubuntu 16.04 on VirtualBox. I installed Docker and ran

docker pull freakthemighty/opensfm

This image was successfully built.

Additionally, I cloned the OpenSFM repository from here into my home folder.

Next, I am supposed to build by running this in the main folder:

python setup.py build

This is the resulting error

walter@VirtualUbuntu:~$ python setup.py build
Configuring...
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    subprocess.Popen(['cmake','../opensfm/src'], cwd='cmake_build').wait()
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Here is the setup.py file in question.

3 Answers3

1

The official response I got:

Hi @walter,

there are two ways of running opensfm, with or without docker.

If you want to use docker, then there is no need to run python setup.py build. Instead build the docker image using

cd path/to/OpenSfM
docker build -t mapillary/opensfm .

then run using

docker run -ti mapillary/opensfm /bin/sh -c "bin/run_all data/berlin"

Note that this will create the reconstruction inside the docker container. You will need some docker knowledge to map a local folder to a folder inside the docker image so that we can access the results outside.

The other option is not to use docker. In this case, you will need to install the dependencies on your ubuntu machine see https://github.com/mapillary/OpenSfM#installing-dependencies-on-ubuntu . After doing that you will be able to run python setup.py build

hope this helps, pau

  • docker run -ti mapillary/opensfm /bin/sh -c "bin/opensfm_run_all data/berlin" worked for me. Did you find a way to create working directory or volume for the outputs? Thanks – ncelik Jan 01 '20 at 17:19
0

I ended up building the Dockerfile myself. I added a last few steps to get it to work and have OpenSfM build automatically.

I clone the repository first, then add a couple missing packages, followed by building the setup.py file automatically.

FROM ubuntu:16.04

# Install apt-getable dependencies
RUN apt-get update \
    && apt-get install -y \
        build-essential \
        cmake \
        git \
        libatlas-base-dev \
        libboost-python-dev \
        libeigen3-dev \
        libgoogle-glog-dev \
        libopencv-dev \
        libsuitesparse-dev \ 
        python-dev \
        python-numpy \
        python-opencv \
        python-pip \
        python-pyexiv2 \
        python-pyproj \
        python-scipy \
        python-yaml \
        wget \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


# Install Ceres from source
RUN \
    mkdir -p /source && cd /source && \
    wget http://ceres-solver.org/ceres-solver-1.10.0.tar.gz && \
    tar xvzf ceres-solver-1.10.0.tar.gz && \
    cd /source/ceres-solver-1.10.0 && \
    mkdir -p build && cd build && \
    cmake .. -DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF && \
    make install && \
    cd / && \
    rm -rf /source/ceres-solver-1.10.0 && \
    rm -f /source/ceres-solver-1.10.0.tar.gz


# Install opengv from source
RUN \
    mkdir -p /source && cd /source && \
    git clone https://github.com/paulinus/opengv.git && \
    cd /source/opengv && \
    mkdir -p build && cd build && \
    cmake .. -DBUILD_TESTS=OFF -DBUILD_PYTHON=ON && \
    make install && \
    cd / && \
    rm -rf /source/opengv

#Clone the OpenSfM Repository
RUN git clone https://github.com/mapillary/OpenSfM.git

#Add additional functions that for some reason didn't come with the docker file
Run apt-get update \ 
    && apt-get install python-networkx \ 
    python-exif \
    python-xmltodict

#Automatically build OpenSfM so that its prebuilt in the docker
Run cd OpenSfM && python setup.py build 
0

I was getting same error on docker for windows with python 3.

To solve this problem;

  1. I have built https://raw.githubusercontent.com/paulinus/opensfm-docker-base/master/Dockerfile.python3 as "paulinus/opensfm-docker-base:latest" image.

  2. I created Dockerfile as below;

FROM paulinus/opensfm-docker-base:latest
RUN pip3 install joblib
RUN git clone https://github.com/mapillary/OpenSfM.git && cd OpenSfM && git submodule update --init --recursive && python3 setup.py build

For some reason joblib was missing from required python module which creates error when you want to run commands such as "bin/opensfm_run_all data/berlin"

cmake error caused by "pybind11_add_module" was solved with "git submodule update --init --recursive" command. (Check issue on https://github.com/patrikhuber/eos/issues/127)

  1. Then I built it

docker build -t opensfm-python3 .

Now opensfm works on a docker container in windows.

docker run -it opensfm-python3 bash

or you can run the command outside of the docker container as below;

docker run -it opensfm-python3 bash -c "cd OpenSfM && bin/opensfm_run_all data/berlin"
ncelik
  • 119
  • 9