microsoft / vscode-ai-toolkit

MIT License
896 stars 41 forks source link

CUDA Libraries is not detected,then Setup WSL Environment,Report the following error. #29

Closed mack007liu closed 8 months ago

mack007liu commented 9 months ago

Information: validate-env[o] 05:04:17.77 IsCudaRuntimeInstalled : False Debug: validate-env[o] 05:04:17.77 ExecuteAsync Completed Elapsed:0:00:1 7700138 [2023-12-18T09:04:17.776Z] [INFO] Validation outcome prer eqsmet: false [2023-12-18T09:04:17.776Z] [INFO] Initialize WebView pane [2023-12-18T09:04:17.777Z] [INFO] Navigating view to reqt irements page [2023-12-18T09:4:18.893Z] [INFO] telemetry event:activat e extension sent [2023-12-18T99:04:18.893Z] [INFO] telemetry event:require ments needed sent [2023-12-18T9:04:19.22Z] [INFO] Navigation to loadPrere quisiteCheck was successful: true [2023-12-18T09:04:19.023Z] [INFO] Loading View: loadPrere quisiteCheck [2023-12-18T99:04:19.029Z] [INFO] Extenension: Invoking alidateEnvironement for: conda Debug: validate-env[o] 95:04:19.19 ExecuteAsync Started

mack007liu commented 9 months ago

windows 11 sub system Ubuntu 22

mack007liu commented 9 months ago

image

mack007liu commented 9 months ago

image

elsaco commented 9 months ago

The plugin doesn't give any feedback why CUDA or Conda installation fails. In my case Conda doesn't install. So to prepare the environment I run the script directly inside the WSL instance. If anything fails there will be better feedback while running the scripts manually.

Look inside C:\Users\<username>\.vscode\extensions\ms-windows-ai-studio.windows-ai-studio-0.2.1-win32-x64\bin\Scripts and copy nvidia_cuda_install.sh to WSL and execute it. If the script runs okay next time you run the plugin it will detect CUDA as available.

nvidia_cuda_install.sh ``` #!/usr/bin/env bash export DEBIAN_FRONTEND=noninteractive set -e # Clean up rm -rf /var/lib/apt/lists/* INSTALL_CUDNN=false INSTALL_CUDNNDEV=false INSTALL_NVTX=false INSTALL_TOOLKIT=false CUDA_VERSION=11.8 CUDNN_VERSION=8.6.0.163 if [ "$(id -u)" -ne 0 ]; then echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' exit 1 fi apt_get_update() { if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then echo "Running apt-get update..." apt-get update -y fi } # Checks if packages are installed and installs them if not check_packages() { if ! dpkg -s "$@" > /dev/null 2>&1; then apt_get_update apt-get -y install --no-install-recommends "$@" fi } check_packages wget ca-certificates # Add NVIDIA's package repository to apt so that we can download packages # Always use the ubuntu2004 repo because the other repos (e.g., debian11) are missing packages NVIDIA_REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64" KEYRING_PACKAGE="cuda-keyring_1.0-1_all.deb" KEYRING_PACKAGE_URL="$NVIDIA_REPO_URL/$KEYRING_PACKAGE" KEYRING_PACKAGE_PATH="$(mktemp -d)" KEYRING_PACKAGE_FILE="$KEYRING_PACKAGE_PATH/$KEYRING_PACKAGE" wget -O "$KEYRING_PACKAGE_FILE" "$KEYRING_PACKAGE_URL" 2>&1 apt-get install -yq "$KEYRING_PACKAGE_FILE" apt-get update -yq # Ensure that the requested version of CUDA is available cuda_pkg="cuda-libraries-${CUDA_VERSION/./-}" nvtx_pkg="cuda-nvtx-${CUDA_VERSION/./-}" toolkit_pkg="cuda-toolkit-${CUDA_VERSION/./-}" if ! apt-cache show "$cuda_pkg"; then echo "The requested version of CUDA is not available: CUDA $CUDA_VERSION" exit 1 fi echo "Installing CUDA libraries..." apt-get install -yq "$cuda_pkg" if [ "$INSTALL_CUDNN" = "true" ]; then # Ensure that the requested version of cuDNN is available AND compatible cudnn_pkg_version="libcudnn8=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" if ! apt-cache show "$cudnn_pkg_version"; then echo "The requested version of cuDNN is not available: cuDNN $CUDNN_VERSION for CUDA $CUDA_VERSION" exit 1 fi echo "Installing cuDNN libraries..." apt-get install -yq "$cudnn_pkg_version" fi if [ "$INSTALL_CUDNNDEV" = "true" ]; then # Ensure that the requested version of cuDNN development package is available AND compatible cudnn_dev_pkg_version="libcudnn8-dev=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" if ! apt-cache show "$cudnn_dev_pkg_version"; then echo "The requested version of cuDNN development package is not available: cuDNN $CUDNN_VERSION for CUDA $CUDA_VERSION" exit 1 fi echo "Installing cuDNN dev libraries..." apt-get install -yq "$cudnn_dev_pkg_version" fi if [ "$INSTALL_NVTX" = "true" ]; then echo "Installing NVTX..." apt-get install -yq "$nvtx_pkg" fi if [ "$INSTALL_TOOLKIT" = "true" ]; then echo "Installing CUDA Toolkit..." apt-get install -yq "$toolkit_pkg" fi # Clean up rm -rf /var/lib/apt/lists/* echo "Done!" ```
mack007liu commented 9 months ago

Thank you, it can work now.

alexgorbatchev commented 9 months ago

scripts are in C:\Users\[user]\.vscode\extensions\ms-windows-ai-studio.windows-ai-studio-0.2.1-win32-x64\bin\Scripts as of 12/29/2023