Skip to content

Latest commit

 

History

History
118 lines (94 loc) · 5.2 KB

install.md

File metadata and controls

118 lines (94 loc) · 5.2 KB

Installation Guide

Conda & Pip Dependencies

Here, we provide a more thorough explanation of the installation process listed in the main readme. Basically, what we does is create a separated conda environment, install PyTorch from conda and then install other dependencies one-by-one using pip. The reason for the cat command is that pip install -r requirements.txt will fail even if only one of the dependencies failed to install and it quickly became infuriating to see an error message eating away 30 minutes of our lives.

# Clone this codebase with:
git clone https://github.com/zju3dv/EasyVolcap
cd EasyVolcap

# If you haven't installed conda, 
# We recommend installing it from https://docs.conda.io/projects/miniconda/en/latest/
# On Ubuntu, these scripts can be used
# cd ~
# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# chmod +x Miniconda3-latest-Linux-x86_64.sh
# ./Miniconda3-latest-Linux-x86_64.sh # and finish the installation as the guide

# Maybe install mamba through conda 
# The recommended way is to use mambaforge directly instead of installing miniconda3
conda install -n base mamba -c conda-forge -y

# Picks up on environment.yml and create a pytorch env
# mamba env create

# If this doesn't work, separate create and update as follows
# Note that as of 2023.04.21, wsl2 with python 3.10 could not correctly initialize or load opengl
# You need manually change the following command to accomodate for that (3.10 to 3.9)
# And update the environtment.yaml file to use python 3.9 instead of 3.10
# mamba create -n easyvolcap "python==3.10" -y
# mamba create -n easyvolcap "python>=3.10,<3.10" -y
mamba create -n easyvolcap "python>=3.10" -y
conda activate easyvolcap
mamba env update # picks up environment.yml

# With the environment created, install other dependencies 
# And possibly modify .zshrc to automatically activate this env
# echo conda activate easyvolcap >> ~/.zshrc
# source ~/.zshrc # actually not needed (already activated)

# Install all pip dependencies one by one in case some fails
# pip dependencies might fail to install, check the root cause and try this script again
# Possible caveats: cuda version? pytorch version? python version?
cat requirements.txt | sed -e '/^\s*#.*$/d' -e '/^\s*$/d' | xargs -n 1 pip install 

# Registers command-line interfaces like `evc` `evc-train` `evc-test` etc.
pip install -e . --no-build-isolation --no-deps

Note that the provided examples in the main readme uses an HDR video, thus you might also need to install a version of ffmpeg that supports the zscale filter.

sudo add-apt-repository ppa:savoury1/ffmpeg4
sudo apt update
sudo apt install ffmpeg

CUDA Related Compilations

To use any compiled CUDA modules, you need to have the CUDA Toolkit installed and configured.

Typically your system administration would have already done so if you're using a shared server for AI realted research. Check under /usr/local to find anything related to CUDA.

Then, add these lines to your .zshrc or .bashrc to expose related paths for compilation:

# CUDA related configs
export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
export CUDA_HOME="/usr/local/cuda"
export CUDA_DEVICE_ORDER=PCI_BUS_ID # OPTIONAL: defaults to capability order, might be different for GL and CUDA

To retain the compiled objects without starting over in case anything fails, we recommend first cloning tinycudann then perform the compilation and installation manually:

cd ~
git clone https://github.com/NVlabs/tiny-cuda-nn --recursive
cd tiny-cuda-nn/bindings/torch
python setup.py install

Or maybe try to install tiny-cuda-nn with:

pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

This is automatically done when installing dependencies for EasyVolcap using this command above:

# Install all pip dependencies one by one in case some fails
cat requirements.txt | sed -e '/^\s*#.*$/d' -e '/^\s*$/d' | xargs -n 1 pip install

If you still encounter cannot find -lcuda: No such file or directory error after setting the above paths, try executing

# ln -s /usr/lib/x86_64-linux-gnu/libcuda.so ~/anaconda3/envs/easyvolcap/lib/libcuda.so
ln -s /usr/lib/x86_64-linux-gnu/libcuda.so ~/miniconda3/envs/easyvolcap/lib/libcuda.so

and then install tiny-cuda-nn with: pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch.