cnr-isti-vclab / TagLab

A CNN based image segmentation tool oriented to marine data analysis
https://taglab.isti.cnr.it/
GNU General Public License v3.0
78 stars 31 forks source link

Upgrading to CUDA NVCC 12.0 (after 11.6) #84

Closed Jordan-Pierce closed 1 year ago

Jordan-Pierce commented 1 year ago

Hi all,

Just curious to see if there are plans to upgrade to support CUDA NVCC 12.0? It seems there are vulnerabilities associated with earlier versions (<11.6), which makes it problematic to install and use TagLab for some. Or is this a Pytorch issue?

Found NVCC version: 12.0
nvcc version installed not supported by pytorch!!
Something is wrong with NVCC. Do you want to install the CPU version of pythorch? [Y/n]y
Traceback (most recent call last):
  File "install.py", line 102, in <module>
    raise Exception('Installation aborted. Install a proper NVCC version or set the pythorch CPU version.')
Exception: Installation aborted. Install a proper NVCC version or set the pythorch CPU version.

Thanks,

Jordan

Jordan-Pierce commented 1 year ago

Disregard this: Pytorch does not have pre-built binaries for CUDA 12.0 yet, so you would need to build Pytorch from source... Though if someone runs into a similar issue, I did the following and got TagLab running, though I did not test the training/inference features:

# Previously installed NVCC 12.0
# Previously installed CudNN 

# Anaconda environment
conda create --name taglab python=3.8
conda activate taglab

# Install pre-built binaries of NVCC 11.6
conda install -c "nvidia/label/cuda-11.6.0" cuda-nvcc

# Install pytorch 1.12.1 with cuda toolkit 11.6
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

# Check that pytorch is installed correctly in python, and has access to gpu
# Within python terminal:
import torch
torch.cuda.is_available() # should return True

# Run the TagLab installer script
python install.py

# If you have issues installing pycocotools, comment it out in the installer, and instead install:
pip install pycocotools-windows

# Run TagLab!
python TagLab.py
Jordan-Pierce commented 11 months ago

Another note to self:

# X corresponds to your versions of CUDA

# Previously installed NVCC X on Windows
# Previously installed CudNN X on Windows

# Anaconda environment
conda create --name taglab python=3.8
conda activate taglab

# Install pycocotools-windows
pip install pycoctools-windows

# Install pre-built GDAL binaries
# https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
pip install GDAL-3.4.3-cp38-cp38-win_amd64.whl

# Install pre-built binaries of NVCC 11.X
conda install -c "nvidia/label/cuda-11.X.0" cuda-nvcc

# Install pytorch with cuda toolkit 11.X
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu11X

# Go to install.py, comment out pycocotols on line 255

# requirements needed by TagLab
install_requires = [
    'wheel',
    'pyqt5',
    'scikit-image',
    'scikit-learn',
    'pandas',
    'opencv-python',
    'matplotlib',
    'albumentations',
    'shapely',
    # 'pycocotools'
]

# Install taglab
python install.py

# Install numpy
conda install numpy

# Launch TagLab
python TagLab.py