weixk2015 / DeepSFM

This is a PyTorch implementation of the ECCV2020 paper "DeepSFM: Structure From Motion Via Deep Bundle Adjustment".
BSD 3-Clause "New" or "Revised" License
315 stars 45 forks source link

boost-python-py36 #8

Open joaquinsalas opened 3 years ago

joaquinsalas commented 3 years ago

Dear Xingkui, thanks for sharing the code DeepSFM.

Nonetheless, when I try to set up my machine to test it, I cannot install minieigen. I have tried on three different machines, fulfilling the previous requirements with no avail. I tried using pip, conda to install without success. Would it be possible for you to give me some advise. I am running as you suggest ubuntu 16.04 with all the version requirements you define:

Pytorch 0.4.0 CUDA 9.0 python 3.6.4 scipy argparse tensorboardX progressbar2 path.py transforms3d minieigen

Following the error messages, I have installed

libeigen3-dev

but cannot install libboost-python-py36

Would you please help me?

MusherM commented 3 years ago

same question, tried nearly all the ways, still cannot find a solution

MusherM commented 3 years ago

First try:

pip install minieigen
  1. You may get an error(if not goto 2.):

    #include <Cores/Eigen> //I didn't remember concrete information, just like this

    this line will report an error, because lack of libeigen3-dev, just:

    sudo apt install libeigen3-dev

    then try:

    pip install minieigen

    to install

  2. You may get another error, reported that it lacks libboost_python-py36.so(may be displayed as lboost_python-py36, if not goto 6. ). As normal, you just need to:

    pip install libboost-python-dev

    then you get the .so, but there comes another problem, although I use the Conda virtual environment python==3.6.4, but pip still gets me libboost_python38.so, I guess it just installed it as the latest python version.

    So we need to abandon pip, install it manually. Firstly download the boost file, you can find it easily, and I use boost_1_67_0.

    cd ./boost_1_67_0/
    ./bootstrap.sh --with-python=/home/musher/anaconda3/envs/python36-pytorch/bin/python3.6 --with-python-version=3.6 --with-python-root='/home/musher/anaconda3/envs/python36-pytorch/lib/python3.6' --prefix=/usr/local
    ./b2 cflags='-fPIC' cxxflags='-fPIC' --with-python include='/home/musher/anaconda3/envs/python36-pytorch/include/python3.6m'

    You must replace the related paths with your conda virtual environment paths!!!

    Then:

    ./b2 install
  3. You may get another error, finally displays xxx skipped, xxx ignored(Just like this, if not goto 4. ), it means failure to install, and my cause is that it lacks python-dev , and you just need to:

    sudo apt install python-dev

    then repeat:

    ./bootstrap.sh --with-python=/home/musher/anaconda3/envs/python36-pytorch/bin/python3.6 --with-python-version=3.6 --with-python-root='/home/musher/anaconda3/envs/python36-pytorch/lib/python3.6' --prefix=/usr/local
    ./b2 cflags='-fPIC' cxxflags='-fPIC' --with-python include='/home/musher/anaconda3/envs/python36-pytorch/include/python3.6m'
    ./b2 install

    and you can just install it successfully, and you will get /usr/local/lib/libboost_python36.a

  4. boost installation requires libboost_python-py36.so, different from the .so we get(which is libboost_python36.a), and you can use a soft link to solve it:

    cd /usr/local/lib
    ln -s libboost_python36.so libboost_python-py36.so

    and you can get boost required so, and in correct name

  5. But when you use

    pip install minieigen

    it may still present lack of libboost_python-py36.so, it may result from that the system can't find it, you need to use:

    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

    to let system be able to find the place(of course it is only effective in this termination, if you want it to be effective permanently, you need to add it into you ~/.zshrc or ~/.bashrc, depending on which termination you use) Then use:

    pip install minieigen

    you can install it.

  6. Test if you install it correctly

    python
    import minieigen

    if no error is reported, then you just install it successfully.

sleeplessai commented 2 years ago

@joaquinsalas @MusherM For non-sudoer situation, I compile minieigen by installing gcc_linux-64 g++_linux-64 py-boost in my local conda enviroment. Then, I add the $CONDA_ENV$/lib to LD_PATH and link the .so file by ln -s libboost_python36.so libboost_python-py36.so. It cost whole night to make it work finally.

$ pip list | grep minieigen
minieigen       0.5.4

Btw, this minieigen warping is awful to compile. I am planning to alternate it with other library.