Install MinkowskiEngine on ubuntu20.04
Before installing this library, first confirm whether the cudatoolkit version of pytorch in the environment is consistent with the installed CUDA version, make sure it is consistent, and then start the installation
My CUDA version is 11.6, so use the following installation command to install pytroch and the corresponding toolkit first
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge
After installation, test it to make sure that the GPU can be called
#测试一下,确保cuda可以使用
python
>>> import torch
>>> torch.cuda.is_available()
True
>>> quit()
install dependencies
pip install ninja #官方文档没说,这里依赖还需要安装ninja库
conda install openblas-devel -c anaconda #安装依赖
When I was installing openblas-devel
, it automatically installed the cpu version of pytorch, which caused pytorch to be unable to call the GPU. For this reason, torch.cuda.is_available()
I False
deleted the environment and reinstalled pytorch and this dependency. This is the case, whether you install openblas-devel
the dependency first or install the GPU version of pytorch first. , there is a problem that pytorch is installed as a cpu version. The next solution is to clear the cache of the package downloaded in conda, so that the dependency can be re-downloaded instead of installed from the cache. It is strange to find that the cpu version of pytorch will not be installed this time. . .
Then clone the warehouse and install it locally
git clone https://github.com/NVIDIA/MinkowskiEngine.git
cd MinkowskiEngine
python setup.py install --blas_include_dirs=${CONDA_PREFIX}/include --blas=openblas
An error was reported, the location of CUDA was not found
Because I installed CUDA11.6 before, I need to specify the location of CUDA through the export command (here to change according to the location where I installed CUDA)
export CUDA_HOME=/usr/local/cuda-11.6
Then because of this issue , you need to MAX_JOBS
set it to 2 before installing
export MAX_JOBS=2
Then execute the install command
python setup.py install --blas_include_dirs=${CONDA_PREFIX}/include --blas=openblas
Successful installation
After the installation is complete, test whether it can import MinkowskiEngine normally
python
>>> import MinkowskiEngine as ME
>>> print(ME.__version__)
0.5.4
knock off