2. Installation - WangLabTHU/GPro GitHub Wiki

hcwang and qxdu edited on Aug 4, 2023, 1 version

System Requirements

Python version: >= 3.9.0, AMD/NVIDIA graphic devices ("cuda", "cpu")

Anaconda (suggest: conda 4.10.1), Linux/Windows/MacOS system (cuda>=11.2, suggest Linux)

Environment setup

(For users who don't have CUDA/Anaconda installed, please follow this step. If you already have them installed, you may skip this step)

First, install the cuda from the website.

The user could check the successfully installation of cuda by:

nvcc --version

For a successful installation, the version of cuda will be printed.

Then, install the Anaconda3 from the website.

The user could check the successfully installation of Anaconda3 by:

conda list

For a successful installation, a list of installed packages appears.

Installation

We provide installation from source here, which might be further optimized into a pypi package soon.

First, download the package by git clone.

git clone https://github.com/WangLabTHU/GPro.git

Then, We recommend using anaconda for installation. Here, mygpro is the name of virtual environment.

conda create -n mygpro python=3.9

After preparing the envrionment, you can activate your virtual environment by:

conda activate mygpro

Then, under the virtual environment, we can execute the following code for installation. All functions and classes in the ./gpro directory will be embedded into the system, and you can import these functions like using a normal Python package. These functions will be further detailed in the following chapters.

cd GPro
pip install .

See Sessions for detailed online installation environment dependencies.

Alternative choose: Envs for offline machine

(If you were unable to install the package using the previous method, you can attempt the following alternative)

We have also upload an archive of virtual environment, generated by conda-pack. You can decompress it on offline machines that might be hard to directly configure the environment, through our google drive repository:

Before migration, please make sure that the hardware and operating system must comply with our session information.

First, move the environment archive to your envs/mygpro folder of anaconda (you should create this folder first). anaconda_path means the path of your anaconda folder, for example: ~/anaconda3

mv gpro.tar.gz anaconda_path/envs/mygpro/

For example, here we move the archive into our "mygpro" envrionment in anaconda, and our anaconda_path is /home/qxdu/anaconda3/

mv gpro.targz /home/qxdu/anaconda3/envs/mygpro/

Second, unzip the archive, and you'd better remove it to reduce memory cost:

cd anaconda_path/envs/mygpro/
tar -zxvf gpro.tar.gz
rm -rf gpro.tar.gz # not essential

Third, test whether this environment can be activated, and remove the current gpro package. The current gpro package has an incorrect soft link. We need to reinstall this package in the GPro directory.

conda activate mygpro
pip uninstall gpro

Fourth, Download the zip format of GPro, or directly open this url in your browser. After the zip file is downloaded, deploy it on your offline machines. You will get a zip file named GPro-main.zip. You should unzip it and rename this folder:

gunzip GPro-main.zip
mv GPro-main GPro

Last, you should get into the root folder of GPro, follow the previous tutorial to reinstall this package. Remember this step still need to be executed under the newly created virtual environment:

cd GPro
pip install --user -e .

At this point, you have completed the configuration of the environment on an offline machine.

Exceptional case

If your CUDA version is lower than 11.2 and none of the above installation methods worked, a possible solution might be to remove the cudatoolkit=11.1.74=h6bb024c_0, pytorch=1.9.0=py3.9_cuda11.1_cudnn8.0.5_0, torchaudio=0.9.0=py39, and torchvision=0.10.0=py39_cu111 from the env/freeze.yml file. Then, install the appropriate version of PyTorch that's compatible with your CUDA version, as listed on this website.

Note that we've successfully used this method to install our package on a Linux system with CUDA 10.1. If you still encounter issues, please reach out to [email protected] for further discussion or report the problem on GitHub.

In another case, if your operating system is Windows, and want to install on your local machine, you may install Linux on Windows using WSL as per the instructions on the website.