Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why there are no clear installation instructions or guide to solve installation issues #803

Open
hatem-darweesh opened this issue May 21, 2023 · 2 comments

Comments

@hatem-darweesh
Copy link

First of all thanks for the effort and great work.
For several days now I have been trying to install the torch-point3d without any success.
jumping from issue to issue, suggesting to suggesting. using Ubuntu 18 and 22. python 3.7 , 3.10, trying conda, poetry, and without.
nothing seems to work.
And after getting all the requirements.txt installed successfully, running unittest returned many errors.

Saying the Requirements are:

  • CUDA 10 or higher (if you want GPU version)
  • Python 3.7 or higher + headers (python-dev)
  • PyTorch 1.8.1 or higher (PyTorch >= 1.9 is recommended)
    Is not useful at all, because those are never enough. I had those prerequisites installed every time. (or maybe that is the problem).

Even with the docker option, I wish there are any explanation how to build and what are the parameters parameters.

This is a great effort and amazing contribution to the community.
It is sad that many people can't utilize or suffer until they succeed.

At lease if I have a fresh Linux installed, I should be able to setup and use the framework smoothly.
Or a ready docker images that could be downloaded and used with supporting instructions.

@ttsesm
Copy link

ttsesm commented May 23, 2023

Actually tbh, I am not sure whether the library is actively maintained anymore. The commits in the different branches seems to be really scarce with some of them going back even a year ago or more.

@HankCSH
Copy link

HankCSH commented May 26, 2023

To be honest, I have tried to install this library for weeks and just finalised the clear installation steps. Even though I now install it successfully and can run the test python -m unittest -v without any error and run the training.py, I still cannot run forward.py and lots of notebooks. Based on lots of issue in this repo, some should be api and resource managing issues. I tried so hard but still cannot solve them.
Anyway, I will provide step-by-step installation here and hope no one needs to spend as much time as I am.
I am pretty sure my installation might not be the best, but at least you can run this library.

Environment: WSL version 2, Ubuntu-20.04
GCC version = 9.4.0
CUDA Toolkit version = 11.1.1
Python version = 3.7
Pytorch version= 1.8.1+cu111
Torch-points3d version = 1.3.0
Package manager, virtual environment: Anaconda

Step 1: Install WSL on Windows

Open Windows PowerShell, and type wsl -l -o, to see the available distribution. And type wsl --install -d <DistroName> to install. Details see here. In my case, I strongly suggest installing Ubuntu-20.04, as its default GCC version is GCC9, believe me, this is extremely important as CUDA Toolkit (11.1.1) installation is based on this. So, type wsl --install -d Ubuntu-20.04. And you will need to create the username and enter the password for your Linux system.

Step 1.5: Check GCC version, and update-alternatives if needed

If you are not using Ubuntu-20.04, or somehow, gcc version is greater than 9.x, you will need to install GCC 9. Please follow below:

1. Use gcc --version to check your current version

2. Install GCC 9 sudo apt install gcc-9 g++-9 -y

3. change the default GCC to gcc-9, 20 is the priority, you can set other

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 10

4. See if GCC 9 is changed to default

sudo update-alternatives --config gcc
sudo update-alternatives --config g++

Step 2: Install CUDA and cuDNN

I use CUDA toolkit (11.1.1) as Pytorch(1.8.1) installation requirement.

1. install cuda toolkit=11.1.1

wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run
sudo sh cuda_11.1.1_455.32.00_linux.run
After you execute the .run, just follow the instruction, and install.

2. Add path to .bashrc

echo 'export PATH="/usr/local/cuda-11.1/bin:$PATH"' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH="/usr/local/cuda-11.1/lib64:$LD_LIBRARY_PATH"' >> ~/.bashrc
source ~/.bashrc
sudo ldconfig
After this, you shall able to see the cuda version through nvcc --version

3. install cuDNN

wget https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-11.1-linux-x64-v8.0.5.39.tgz
tar -xzvf cudnn-11.1-linux-x64-v8.0.5.39.tgz
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-11.1/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-11.1/lib64/
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-11.1/lib64/

Step3: Use Anaconda to create a virtual environment for torch-points3d

1. Install anaconda

wget https://repo.continuum.io/archive/wget https://repo.continuum.io/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
bash Anaconda3-2023.03-1-Linux-x86_64.sh

2. create an environment and enter it

conda create -n torch-points3d python=3.7
conda activate torch-points3d

Step4: Install all requirements, including MinkowskiEngine & TorchSparse

1. install pytorch==1.8.1

pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
*To test if the installation is correctly, use python to test import torch torch.cuda.is_available(), the result should to True

2. install the requirements for torch-points3d

cd
git clone https://github.com/torch-points3d/torch-points3d.git
cd torch-points3d
pip install -r requirements.txt
*If there are any things goes wrong, then need to manually install the package, for torch-cluster torch-scatter torch-sparse can be build from sources, torch-points-kernels can be build form here

  • To test if the installation is correctly, use python to test import torch_points_kernels.points_cuda, there should be nothing happens.

3. install MinkowskiEngine

cd
sudo apt install build-essential python3-dev libopenblas-dev -y
pip install ninja
pip install -U MinkowskiEngine --install-option="--blas=openblas" -v --no-deps

  • To test if the installation is correctly, use python to test import MinkowskiEngine as ME, there should be nothing happens.

4. install TorchSparse

sudo apt-get install libsparsehash-dev
pip install --upgrade git+https://github.com/mit-han-lab/[email protected]

  • To test if the installation is correctly, use python to test from torchsparse import nn as spnn, there should be nothing happens.

5. install torch-points3d

I use wheel to install torch-points3d
wget https://files.pythonhosted.org/packages/c5/f1/f3af914effa74b9a20cec6d27896ade54c01af1c402b9e176de56d0150c7/torch_points3d-1.3.0-py3-none-any.whl
pip install torch_points3d-1.3.0-py3-none-any.whl
Until now, you should see the library is installed successfully. However, somehow, some requirements are out-date in both pip install and the wheel, so we need to install them again

6. Install the following packages, even pip will show errors, leave them there. If not, you will not be able to run torch-points3d successfully.

pip install hydra-core==1.0.7
conda install numpy==1.19.5
pip install open3d==0.12.0
pip install wandb --upgrade

Step 5: test

Finally, we were here.
cd
cd torch-points3d
python -m unittest -v
You shall see something like "Ran 163 tests in 213.969s OK"

Step 6: Train.py

Important, Comment out the trainer.py line.355

skip_first=getattr(self._cfg.training.tensorboard.pytorch_profiler, "skip_first", 10)
As this api is for torch>=1.9.0, and we use torch=1.8.1

Somehow, in some documents, the codes are out-date, so use the following code for testing:
python train.py task=segmentation data=segmentation/shapenet-fixed models=segmentation/pointnet2 model_name=pointnet2_charlesssg

Here are some tips for the train.py configure

  • The settings are based on the config.yaml location: torch-points3d/conf/config.yaml
  • The provided task and data will be used to load the configuration for the dataset at conf/data/{task}/{data}.yaml
  • model argument will be used to load the model config at conf/models/{task}/{model}.yaml
  • Finally model_name is used to pull the appropriate model from the model configuration file.
  • generally, try to match data and model with the same name. For example, using s3disfused-sparse for sparseconv3

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants