Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Everything I do to make this work #1210

Open
zhiawei opened this issue Apr 16, 2024 · 2 comments
Open

Everything I do to make this work #1210

zhiawei opened this issue Apr 16, 2024 · 2 comments

Comments

@zhiawei
Copy link

zhiawei commented Apr 16, 2024

I'm using:

  • Ubuntu 22.04 (WSL2)
  • Nvidia CUDA Driver:
    image

From a fresh WSL:

#Update and Upgrade
sudo apt-get update && sudo apt-get upgrade -y

#Miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
export PATH=$PATH:~/miniconda3/bin
conda init
#Python 3.7
conda create -n alphapose python=3.7 -y
conda activate alphapose

#Gcc
sudo apt install gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9

#CUDA Toolkit 11.3
wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux.run
sudo sh cuda_11.3.0_465.19.01_linux.run
export PATH=/usr/local/cuda-11.3/bin/:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.3/lib64/:$LD_LIBRARY_PATH

#Nvidia cuDNN (this might not be important but why not)
wget https://developer.download.nvidia.com/compute/cudnn/9.1.0/local_installers/cudnn-local-repo-ubuntu2204-9.1.0_1.0-1_amd64.deb
sudo dpkg -i cudnn-local-repo-ubuntu2204-9.1.0_1.0-1_amd64.deb
sudo cp /var/cudnn-local-repo-ubuntu2204-9.1.0/cudnn-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cudnn-cuda-11

#Torch
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113

#HalpeCOCOAPI
#credit to this link (https://github.com/HaoyiZhu/HalpeCOCOAPI/issues/1)
git clone https://github.com/HaoyiZhu/HalpeCOCOAPI.git
#UPDATE THE SETUP.py WITH THE CODE BELOW
cd HalpeCOCOAPI/PythonAPI
python3 setup.py build develop

#AlphaPose
#cd back to home or wherever you wanna put AlphaPose Git
git clone https://github.com/MVIG-SJTU/AlphaPose.git
cd AlphaPose
pip install ninja
pip install cython matplotlib cython_bbox numpy scipy easydict opencv-python pycocotools pyyaml tensorboardx terminaltables tqdm visdom
CC=gcc-9 CXX=g++-9 python setup.py build develop

#Install PyTorch3D (Optional, only for visualization)
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -c bottler nvidiacub
pip install pytorch3d

#Depending on whatever error you get
sudo apt-get install libgl1 
export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH 
#RESTART YOUR TERMINAL

Error I gotten so far:

  1. python -c "import torch; print(torch.cuda.is_available())" if this says FALSE, your CUDA version went wrong somewhere. Your Driver being 12.4 is fine, but the CUDA Toolkit and Torch needs to be the same. Mine is based on CUDA 11.3
  2. Could not load library libcudnn_cnn_infer.so.8. Error: libcuda.so: cannot open shared object file: No such file or directory Please make sure libcudnn_cnn_infer.so.8 is in your library path! If you got this error, the solution link is here
    https://discuss.pytorch.org/t/libcudnn-cnn-infer-so-8-library-can-not-found/164661/19
    image
    BUT I just use this: export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH and restart my terminal. It seems this is WSL2 problem that I'm too stupid to understand.
  3. HALPECOCOAPI bug, rewrite the setup.py with this (credit to this link (x86_64-linux-gnu-gcc: error: ../common/maskApi.c: No such file or directory (solution) HaoyiZhu/HalpeCOCOAPI#1):
from setuptools import setup, Extension
import numpy as np

# To compile and install locally run "python setup.py build_ext --inplace"
# To install library to Python site-packages run "python setup.py build_ext install"

ext_modules = [
    Extension(
        'halpecocotools._mask',
        sources=['common/maskApi.c'], # update this line
        include_dirs = [np.get_include(), 'common'],
        extra_compile_args=[],
    )
]

setup(
    name='halpecocotools',
    packages = ['halpecocotools'],
    package_dir = {'halpecocotools': 'halpecocotools'},
    install_requires=[
        'setuptools>=18.0',
        'cython>=0.27.3',
        'matplotlib>=2.1.0',
    ],
    version='0.0.0',
    description="COCO API for Halpe-Fullbody dataset",
    url="https://github.com/HaoyiZhu/HalpeCOCOAPI",
    ext_modules= ext_modules
)

My condolences to those who are still suffering before me. They need to fix this problem already.

@Keronaya
Copy link

#Torch
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
ERROR: Could not find a version that satisfies the requirement torch==1.12.0+cu113 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.4.0)
ERROR: No matching distribution found for torch==1.12.0+cu113

Still like this

@william-yl-gu
Copy link

william-yl-gu commented Sep 19, 2024

Hi @Keronaya,
I am not sure whether this will help you.
I manage to install alphapose by replacing the whole script below:

#CUDA Toolkit 11.3
wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux.run
sudo sh cuda_11.3.0_465.19.01_linux.run
export PATH=/usr/local/cuda-11.3/bin/:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.3/lib64/:$LD_LIBRARY_PATH

#Nvidia cuDNN (this might not be important but why not)
wget https://developer.download.nvidia.com/compute/cudnn/9.1.0/local_installers/cudnn-local-repo-ubuntu2204-9.1.0_1.0-1_amd64.deb
sudo dpkg -i cudnn-local-repo-ubuntu2204-9.1.0_1.0-1_amd64.deb
sudo cp /var/cudnn-local-repo-ubuntu2204-9.1.0/cudnn-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cudnn-cuda-11

#Torch
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113

To the following conda command:

# 20240919 Replace the above with the conda command to keep cuda installation in the conda environment.
conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants