Skip to content

Easy setup for Ubuntu 22.04.5 LTS #193

@Vinit2244

Description

@Vinit2244

Problem/Issue Faced

I encountered numerous errors due to version mismatches while setting up the environment using the provided code. To resolve this, I separated the Conda installations from the pip installations and downgraded pip to version 23.1 before installing the pip dependencies, and separated out installing some pip dependencies outside of requirements.txt (installing them separately).

Note: Please find the updated environment.yml and requirements.txt files attached at the end of this message

Solution/Steps

# Clone the repository
git clone https://github.com/cvg/Mask3D.git
cd Mask3D

# Moving into the specific commit for which I have made this setup
git checkout 11bd5ff94477ff7194e9a7c52e9fae54d73ac3b5

# Create and activate environment (Make sure to update the contents of environment.yml file before proceeding)
conda env create -f environment.yml
conda activate mask3d_env

# Downgrade pip to v23.1
python -m pip install "pip==23.1"

# Note that several version dependency warnings will be raised while installing some of the below mentioned packages, ignore them as long as your final library is getting installed

# Separately install pycocotools
# Installing pycocotools dependencies
sudo apt-get install build-essential
pip install -U cython setuptools
pip install numpy==1.24.2

# Building pycoco
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
pip install .

# Install pip dependencies (Make sure to first create requirements.txt file - see end of this comment for file contents)
cd ../..
pip install -r requirements.txt
pip3 install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
pip3 install torch-scatter==2.0.9 -f https://data.pyg.org/whl/torch-1.12.1+cu113.html

# Install nvcc 11.3 inside our conda env
conda install -c nvidia/label/cuda-11.3.0 cuda-nvcc=11.3

# Set the CUDA_HOME variable to point to our conda env's CUDA
export CUDA_HOME=$CONDA_PREFIX
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH

# Install g++9 on system (cannot install in conda env due to version mismatch and dependencies)
sudo apt update
sudo apt install gcc-9 g++-9

# Point the environment variables to the g++9 of system
export CC=/usr/bin/gcc-9
export CXX=/usr/bin/g++-9

# Install detectron2
pip install more-itertools # Dependency for detectron2

# Set ARCH list (to check your  system's architecture run the command: 
# python -c "import torch; print(torch.cuda.get_device_capability(0))")
export TORCH_CUDA_ARCH_LIST="8.6" # Replace with your architecture
pip3 install 'git+https://github.com/facebookresearch/detectron2.git@710e7795d0eeadf9def0e7ef957eea13532e34cf' --no-deps

# Build MinkowskiEngine
mkdir third_party
cd third_party
git clone --recursive "https://github.com/NVIDIA/MinkowskiEngine"
cd MinkowskiEngine
git checkout 02fc608bea4c0549b0a7b00ca1bf15dee4a0b228
sudo apt-get install libopenblas-dev # Thanks to Issue #115 
python setup.py install --force_cuda --blas=openblas

# Build segmentator
cd ..
git clone https://github.com/ScanNet/ScanNet.git
cd ScanNet/Segmentator
git checkout 3e5726500896748521a6ceb81271b0f5b2c0e7d2
make

# Build pointnet2
cd ../../pointnet2
python setup.py install

# Build Mask3D
cd ../../
pip3 install pytorch-lightning==1.7.2
pip install .

# Reinstall the older versions of PyTorch and TorchVision because PyTorch-Lightning v1.7.2 upgrades them to newer versions, but the code requires these specific older versions.
pip3 install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113

Following this setup, use the simple visualisation code from here or #171 .


Updated environment.yml file contents:

name: mask3d_env
channels:
  - anaconda
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - blas=1.0=openblas
  - boltons=23.0.0=py310h06a4308_0
  - brotlipy=0.7.0=py310h7f8727e_1002
  - bzip2=1.0.8=h7b6447c_0
  - ca-certificates=2023.01.10=h06a4308_0
  - certifi=2022.12.7=py310h06a4308_0
  - cffi=1.15.1=py310h5eee18b_3
  - charset-normalizer=2.0.4=pyhd3eb1b0_0
  - conda=23.3.1=py310h06a4308_0
  - conda-content-trust=0.1.3=py310h06a4308_0
  - conda-package-handling=2.0.2=py310h06a4308_0
  - conda-package-streaming=0.7.0=py310h06a4308_0
  - cryptography=39.0.1=py310h9ce1e76_0
  - idna=3.4=py310h06a4308_0
  - jsonpatch=1.32=pyhd3eb1b0_0
  - jsonpointer=2.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.38=h1181459_1
  - libffi=3.4.2=h6a678d5_6
  - libgcc-ng=11.2.0=h1234567_1
  - libgfortran-ng=11.2.0=h00389a5_1
  - libgfortran5=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libopenblas=0.3.21=h043d6bf_0
  - libstdcxx-ng=11.2.0=h1234567_1
  - libuuid=1.41.5=h5eee18b_0
  - ncurses=6.4=h6a678d5_0
  - nomkl=3.0=0
  - openblas-devel=0.3.21=h06a4308_0
  - openssl=1.1.1s=h7f8727e_0
  - packaging=23.0=py310h06a4308_0
  - pluggy=1.0.0=py310h06a4308_1
  - pycosat=0.6.4=py310h5eee18b_0
  - pycparser=2.21=pyhd3eb1b0_0
  - pyopenssl=23.0.0=py310h06a4308_0
  - pysocks=1.7.1=py310h06a4308_0
  - python=3.10.9=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - requests=2.28.1=py310h06a4308_1
  - ruamel.yaml=0.17.21=py310h5eee18b_0
  - ruamel.yaml.clib=0.2.6=py310h5eee18b_1
  - setuptools=65.6.3=py310h06a4308_0
  - six=1.16.0=pyhd3eb1b0_1
  - sqlite=3.41.2=h5eee18b_0
  - tk=8.6.12=h1ccaba5_0
  - toolz=0.12.0=py310h06a4308_0
  - tqdm=4.65.0=py310h2f386ee_0
  - urllib3=1.26.15=py310h06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.2.10=h5eee18b_1
  - zlib=1.2.13=h5eee18b_0
  - zstandard=0.19.0=py310h5eee18b_0
  - pip
prefix: /opt/conda

Updated requirements.txt file contents:

absl-py==1.4.0
addict==2.4.0
aiohttp==3.8.4
aiosignal==1.3.1
albumentations==1.2.1
antlr4-python3-runtime==4.8
anyio==3.6.2
appdirs==1.4.4
asttokens==2.2.1
async-timeout==4.0.2
attrs==23.1.0
backcall==0.2.0
black==21.4b2
cachetools==5.3.0
click==8.1.3
cloudpickle==2.1.0
comm==0.1.3
configargparse==1.5.3
contourpy==1.0.7
cycler==0.11.0
dash==2.9.3
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-table==5.0.0
debugpy==1.6.7
decorator==5.1.1
docker-pycreds==0.4.0
executing==1.2.0
fastapi==0.95.1
fastjsonschema==2.16.3
fire==0.4.0
flake8==6.0.0
flask==2.2.3
fonttools==4.39.3
frozenlist==1.3.3
fsspec==2023.4.0
fvcore==0.1.5.post20220512
gitdb==4.0.10
gitpython==3.1.31
google-auth==2.17.3
google-auth-oauthlib==1.0.0
grpcio==1.54.0
h11==0.14.0
hydra-core==1.0.5
imageio==2.21.1
importlib-metadata==3.10.1
iopath==0.1.10
ipykernel==6.22.0
ipython==8.12.0
ipywidgets==8.0.6
itsdangerous==2.1.2
jedi==0.18.2
jinja2==3.1.2
joblib==1.2.0
jsonschema==4.17.3
jupyter-client==8.2.0
jupyter-core==5.3.0
jupyterlab-widgets==3.0.7
kiwisolver==1.4.4
lazy-loader==0.2
loguru==0.6.0
markdown==3.4.3
markupsafe==2.1.2
matplotlib==3.7.1
matplotlib-inline==0.1.6
multidict==6.0.4
mypy-extensions==1.0.0
natsort==8.3.1
nbformat==5.7.0
nest-asyncio==1.5.6
networkx==3.1
ninja==1.10.2.3
oauthlib==3.2.2
omegaconf==2.0.6
open3d==0.17.0
opencv-python-headless==4.7.0.72
pandas==2.0.0
parso==0.8.3
pathspec==0.11.1
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
pillow==9.5.0
platformdirs==3.2.0
plotly==5.14.1
plyfile==0.7.4
portalocker==2.7.0
prompt-toolkit==3.0.38
protobuf==4.22.3
psutil==5.9.5
ptyprocess==0.7.0
pure-eval==0.2.2
pyasn1==0.5.0
pyasn1-modules==0.3.0
pydantic==1.10.7
pydeprecate==0.3.2
pygments==2.15.1
pyparsing==3.0.9
pyquaternion==0.9.9
pyrsistent==0.19.3
python-dateutil==2.8.2
python-dotenv==0.20.0
python-multipart==0.0.6
pytz==2023.3
pyviz3d==0.2.28
pywavelets==1.4.1
pyyaml>=6.0
pyzmq==25.0.2
qudida==0.0.4
regex==2023.3.23
requests-oauthlib==1.3.1
rsa==4.9
scikit-image==0.20.0
scikit-learn==1.1.2
scipy==1.9.0
sentry-sdk==1.20.0
setproctitle==1.3.2
smmap==5.0.0
sniffio==1.3.0
stack-data==0.6.2
starlette==0.26.1
tabulate==0.9.0
tenacity==8.2.2
tensorboard==2.12.2
tensorboard-data-server==0.7.0
tensorboard-plugin-wit==1.8.1
termcolor==2.2.0
threadpoolctl==3.1.0
tifffile==2023.4.12
toml==0.10.2
tornado==6.3
traitlets==5.9.0
trimesh==3.14.0
typing-extensions==4.5.0
tzdata==2023.3
uvicorn==0.21.1
wandb==0.15.0
wcwidth==0.2.6
werkzeug==2.2.3
widgetsnbextension==4.0.7
yacs==0.1.8
yarl==1.8.2
zipp==3.15.0

Hope it helps :) Please consider liking this comment if it helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions