Skip to content
Chris Choy edited this page Aug 5, 2020 · 30 revisions

Installing the Minkowski Engine

v0.5

Currently, unavailable to the public.

From the Source

sudo apt install libopenblas-dev
pip install -U git+https://github.com/NVIDIA/MinkowskiEngine
# If it gives you "Unsupported GNU version!" use
# export CC=g++-7; pip install git+https://github.com/NVIDIA/MinkowskiEngine

Cloning the MinkowskiEngine git repo

sudo apt install libopenblas-dev
git clone https://github.com/NVIDIA/MinkowskiEngine
cd MinkowskiEngine
pip install -U ./
# If it gives you "Unsupported GNU version!" use
# export CC=g++-7; pip install -U ./

System Python

sudo apt install libopenblas-dev
pip install MinkowskiEngine

From the Source

sudo apt install libopenblas-dev
pip install -U git+https://github.com/NVIDIA/MinkowskiEngine
# If it gives you "Unsupported GNU version!" use
# export CXX=g++-7; pip install git+https://github.com/NVIDIA/MinkowskiEngine

Specifying the compiler

Use the environment variable CXX to control the compiler.

export CXX=g++-7; pip install git+https://github.com/StanfordVL/MinkowskiEngine

If you have multiple python versions and want to specify the version, define an environment variable to install the Minkowski Engine on the specified version.

export PYTHON=python3.7
$PYTHON setup.py install

Installation options

# export CXX=g++-7; If you have an older version of GCC.
pip install -U git+https://github.com/StanfordVL/MinkowskiEngine \
                           \ # if you want to force cuda installation
                           --install-option="--force_cuda" \
                           \ # if you want to force no cuda installation. force_cuda supercedes cpu_only
                           --install-option="--cpu_only" \
                           \ # optional when torch fails to find cuda_home.
                           --install-option="--cuda_home=<cuda_home>" \
                           \ # override to openblas, atlas, mkl, blas
                           --install-option="--blas=<blas>" \
                           \ # blas include and library path if default ones fail
                           --install-option="--blas_include_dirs=<csv>" \
                           --install-option="--blas_library_dirs=<csv>"

With Anaconda

conda install mkl mkl-include -c intel
conda install pytorch -c pytorch
git clone https://github.com/StanfordVL/MinkowskiEngine.git
cd MinkowskiEngine
python setup.py install --blas=mkl

nvcc fatal : Unknown option -fopenmp

If you are using pytorch v1.5 or lower, you might experience the following error when compiling MinkowskiEngine v0.5. This is an error in the pytorch, which has been fixed on pytorch v1.6 https://github.com/pytorch/pytorch/pull/36945/files.

Please install pytorch v1.6.

error: Command "/usr/local/cuda/bin/nvcc -I/home/chrischoy/anaconda3/envs/py3-mink-reg/lib/python3.8/site-packages/torch/include -I/home/chrischoy/anaconda3/envs/py3-mink-reg/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/chrischoy/anaconda3/envs/py3-mink-reg/lib/python3.8/site-packages/tor
ch/include/TH -I/home/chrischoy/anaconda3/envs/py3-mink-reg/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/chrischoy/projects/MinkowskiEngine/src -I/home/chrischoy/projects/MinkowskiEngine/src/3rdparty -I/home/chrischoy/anaconda3/envs/py3-mink-reg/include/python3.8 -c /home/chrischoy
/projects/MinkowskiEngine/src/math_functions_cpu.cpp -o build/temp.linux-x86_64-3.8/home/chrischoy/projects/MinkowskiEngine/src/math_functions_cpu.o -fopenmp -O3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14" failed with exit status 1

Specifying CXX

/usr/local/cuda/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!

sudo apt install g++-7
export CXX=gcc-7; python setup.py install

Possible compilation error with torch 1.4

In a very rare case, you might get compilation errors

error: cannot call member function `void std::basic_string<_CharT, _Traints, _Alloc>::_Rep::_M_set_sharable() ....` without object

[2020-04-15] Got a report that using torch 1.3.1 solved the issue, but it is unclear what exactly caused the problem.

Compilation error with GCC < 7

error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string<char>, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string<char>, at::Tensor>&

To install g++ > 6, https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/

sudo apt install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7

A related issue can be found at #124

basic_string error

    /usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’ without object
           __p->_M_set_sharable();

https://github.com/pytorch/vision/issues/1893

Upgrade CUDA version >= 10.1.243

With Docker

https://github.com/StanfordVL/MinkowskiEngine/issues/135 https://github.com/StanfordVL/MinkowskiEngine/issues/88