pycolmap
pycolmap copied to clipboard
Pip wheels for Mac M1 (arm64)
I am struggling to build the library on a Macbook Pro M1 with the given instructions and latest commit in master.
I do not have access to a Macbook Pro M1, so I cannot help without detailed logs and error outputs. I do not know if anyone has tried so far. You likely need to build COLMAP and pycolmap from source - see https://github.com/colmap/colmap/issues/1423
I finally managed to build on a MacBook Pro M1. I am not sure how I could contribute to this project, is it enough to share the .whl file?
Can you please instead describe in details what steps you took to make it work so others can reproduce it?
I am using Homebrew and Miniforge.
First I had to install qt5 using Homebrew:
brew install qt5
And create a python 3.9 environment:
conda create -n myenv python=3.9
conda activate myenv
Then build Colmap:
conda install cmake boost eigen freeimage glog gflags metis suitesparse ceres-solver glew cgal
git clone -b dev [email protected]:colmap/colmap.git
cd colmap
mkdir build
cd build
cmake .. -DBOOST_STATIC=OFF -DQt5_DIR="/opt/homebrew/opt/qt@5/lib/cmake/Qt5" -DCGAL_DATA_DIR="/opt/homebrew/Caskroom/miniforge/base/myenv/hloc/lib/cmake/CGAL"
make
make install
sudo install_name_tool -add_rpath /opt/homebrew/Caskroom/miniforge/base/envs/myenv/lib /usr/local/bin/colmap
cd ../..
# Test with colmap -h
Then build pycolmap:
git clone --recursive [email protected]:colmap/pycolmap.git
cd pycolmap
export CMAKE_PREFIX_PATH="/opt/homebrew/opt/qt@5/lib/cmake/Qt5"
export CGAL_DATA_DIR="/opt/homebrew/Caskroom/miniforge/base/envs/myenv/lib/cmake/CGAL"
pip install -v .
I tried to build colmap following your steps. Everything went ok, but when I tried to start it, I got the following error:
ERROR: flag 'flagfile' was defined more than once (in files '/tmp/gflags-20211021-3963-1mi18ai/gflags-2.2.2/src/gflags.cc' and '/Users/runner/miniforge3/conda-bld/gflags_1599590635449/work/src/gflags.cc').
Could you guess what might be the problem?
I was able to build, but got an error when trying to import pycomap:
>>> import pycolmap
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/PATH_TO_PYTHON/python3.9/site-packages/pycolmap.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '___kmpc_barrier'
Any idea what went wrong? I used the dev branch of colmap as of today (7/15/2022). Should I use a different version of colmap for ToT pycolmap?
I was able to build, but got an error when trying to import pycomap:
>>> import pycolmap Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dlopen(/PATH_TO_PYTHON/python3.9/site-packages/pycolmap.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '___kmpc_barrier'Any idea what went wrong? I used the dev branch of colmap as of today (7/15/2022). Should I use a different version of colmap for ToT pycolmap?
I was able to resolve this error by disabling OpenMP, i.e. change the ON in this line of CMakeLIst.txt of colmap repo to OFF:
option(OPENMP_ENABLED "Whether to enable OpenMP parallelization" OFF)
Not sure about the performance penalty this incurs.