How to install python and deep learning libraries

1. Check if your computer has an NVIDIA graphics card

Platform

Steps

Windows

  1. Open Device Manager (Right-click the Start button; click Device Manager).

  2. Find and expand the Display adapters category.

  3. If the list contains any device starting with NVIDIA, your computer is equipped with an NVIDIA GPU.

  4. Visit Download The Official Nvidia Drivers to download and install (or update to) the latest driver for your NVIDIA GPU.

Linux

  1. Open Terminal.

  2. Type lspci | grep -i nvidia and press Enter.

  3. If the command produces any text output, your computer is equipped with an NVIDIA GPU.

  4. Visit Download The Official Nvidia Drivers to download and install (or update to) the latest driver for your NVIDIA GPU.

macOS

The required NVIDIA GPU is not supported on macOS.

2. Check the maximum supported CUDA version of your NVIDIA GPU

If your computer is running macOS or is not equipped with an NVIDIA graphics card, please skip this step.

Platform

Steps

Windows

  1. Open Command Prompt (Press Win + R; type cmd; press Enter).

  2. Type nvidia-smi and press Enter.

  3. Look for CUDA Version in the output.

  4. Note this version number for later.

Linux

  1. Open Terminal.

  2. Type nvidia-smi and press Enter.

  3. Look for CUDA Version in the output.

  4. Note this version number for later.

Note

Older NVIDIA GPUs may not support the nvidia-smi command or may not display CUDA version. If this happens, try updating your graphics card drivers first and check again. Otherwise, your graphics card does not support CUDA.

Now, please check if your computer meets the basic requirements for running. If it does, you can continue with the next steps. Otherwise, your computer cannot run the project participating in LiGHTLIN through the following configuration methods.

Platform

CPU only

or nonuse GPU

or non-CUDA GPU

or NVIDIA GPU with CUDA < 11.8

NVIDIA GPU with CUDA >= 11.8

Windows 10/11 64-bit

Linux x86-64

Otherwise (including macOS)

3. Download and install Miniconda

If your computer has already installed Anaconda or Miniconda, please skip this step.

Platform

Installation Steps

Windows

  1. Go to Miniconda Archive.

  2. Download Miniconda3-latest-Windows-x86_64.exe.

  3. Run the installer.

  4. (Recommended) Change the default installation driver (C:).

  5. Complete the installation.

Linux

  1. Go to Miniconda Archive.

  2. Download Miniconda3-latest-Linux-x86_64.sh.

  3. Open Terminal in the download folder.

  4. Type ./Miniconda3-latest-Linux-x86_64.sh.

  5. Type yes and press Enter for any prompt that requires the user to type yes or no.

  6. Close and reopen the terminal for changes to take effect.

4. Launch CONDA environment (for daily use)

Platform

Steps to Launch

Windows

  1. Open Start menu.

  2. Find and run Anaconda Prompt as Administrator!

Linux

  1. Open Terminal.

  2. If you follow Step 3, there will be (base) at the beginning of the line, indicating that the conda environment has been automatically activated.

5. Create a Python 3.12 virtual environment

Type conda create --name lightlin python=3.12 in the CONDA environment and press Enter. Here, lightlin is the name of the virtual environment, and you can also change it to another name. Please wait for the execution to complete before proceeding to the next step.

6. Activate the virtual environment (for daily use)

Type conda activate lightlin in the CONDA environment and press Enter. When the beginning of a new line changes to (lightlin), it indicates a successful virtual environment switch. Here, lightlin needs to be replaced with the virtual environment name you taken.

8. Verify Installation

To ensure everything works properly later, please check your installation with the following steps:

  1. Run Steps 4 and 6 to activate the target virtual environment.

  2. Type pip list and carefully check that the suffixes of pytorch, spconv, and kaolin are consistent with each other and compatible with your CUDA Version.

  3. Type python.

  4. In the output, verify that the Python version is 3.12.X (you can ignore the X).

  5. Type the following commands one by one and press Enter after each:

import torch
import spconv
import torch_scatter
import kaolin
import torch_geometric
torch.cuda.is_available()

If no errors are reported, everything has been installed successfully!

Finally, you can type exit() and press Enter to exit Python.

9. Postscript (for daily use)

In the virtual environment, you need to master how to change the working directory

cd "/path/of/your/project"  # For Linux

REM For Windows
cd /d "D:\path\of\your\project"

Note

The working directory is the folder where your commands are executed. You can see it in the prompt before you type a command, e.g.:

  • On Linux: the path shown before the $, # etc, e.g.

    ubuntu@linuxopsys:~/path/of/your/project$

    (lightlin) [root@pc project]#

    (in the latter case, run pwd to show the full path /path/of/your/project).

  • On Windows: the path shown before the >, e.g.

    D:\path\of\your\project>

    (base) D:\path\of\your\project>

and execute Python files by

python your_script.py

or using command-line arguments like

python your_script.py -h

We also recommend that you master the basic usage methods of conda and pip.

For example:

  • Clean after installing the library to save disk space:

conda clean -a
pip cache purge
  • Exit the current virtual environment to activate the default (base) environment:

conda deactivate
  • Remove a virtual environment:

conda env remove -n your_env_name