首页 > 其他分享 >WSL2安装CUDA记录

WSL2安装CUDA记录

时间:2023-07-13 16:57:25浏览次数:43  
标签:get WSL2 sudo apt local CUDA nvidia 安装 cuda

❗建议直接Windows安装驱动,不要在子系统里装

  1. 官网安装,选择自己的版本即可

    https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local

    wget <https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin>
    sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
    wget <https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-repo-ubuntu2204-12-2-local_12.2.0-535.54.03-1_amd64.deb>
    sudo dpkg -i cuda-repo-ubuntu2204-12-2-local_12.2.0-535.54.03-1_amd64.deb
    sudo cp /var/cuda-repo-ubuntu2204-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
    sudo apt-get updatesudo apt-get -y install cuda
  2. 查看nvcc发现没有,但/usr/local/cuda/bin下是有nvcc的

    root@DESKTOP-PO8BKKM:~# nvcc --version
    Command 'nvcc' not found, but can be installed with:
    apt install nvidia-cuda-toolkit

    所以需要添加一下环境变量,就可以了。

    root@DESKTOP-PO8BKKM:~# export PATH=$PATH:/usr/local/cuda/bin
    root@DESKTOP-PO8BKKM:~# nvcc --version
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2023 NVIDIA Corporation
    Built on Tue_Jun_13_19:16:58_PDT_2023
    Cuda compilation tools, release 12.2, V12.2.91
    Build cuda_12.2.r12.2/compiler.32965470_0
  3. nvidia-smi报错

    root@DESKTOP-PO8BKKM:~# nvidia-smi
    NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

    按这个:https://blog.csdn.net/weixin_44124632/article/details/130471902

    没有解决。。

    看一下nvidia版本

    root@DESKTOP-PO8BKKM:~# ls /usr/src | grep nvidia
    nvidia-535.54.03
    root@DESKTOP-PO8BKKM:~# sudo apt-get install dkms
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    dkms is already the newest version (2.8.7-2ubuntu2.2).
    dkms set to manually installed.
    0 upgraded, 0 newly installed, 0 to remove and 60 not upgraded.
    root@DESKTOP-PO8BKKM:~# sudo dkms install -m nvidia -v 535.54.03
    Error! Your kernel headers for kernel 5.10.16.3-microsoft-standard-WSL2 cannot be found.
    Please install the linux-headers-5.10.16.3-microsoft-standard-WSL2 package or use the --kernelsourcedir option to tell DKMS where it's located.
  4. 卸载试试看

    参考:http://www.manongjc.com/detail/62-afswonvqlgmvots.html

    sudo apt-get purge nvidia*
    sudo apt-get autoremove
    sudo apt-get autoclean
    sudo rm -rf /usr/local/cuda*
  5. 尝试重新装一个wls-ubuntu版本cuda

    wget <https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin>
    sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
    wget <https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb>
    sudo dpkg -i cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb
    sudo cp /var/cuda-repo-wsl-ubuntu-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
    sudo apt-get update
    sudo apt-get -y install cuda

    依然没有用,哈哈

  6. 尝试直接windows安装,成功。。

    参考:https://blog.csdn.net/no1xium/article/details/131465611

标签:get,WSL2,sudo,apt,local,CUDA,nvidia,安装,cuda
From: https://www.cnblogs.com/rthete/p/17551419.html

相关文章

  • nginx安装及配置
    ......
  • 验证torch和torchvision安装成功
    importtorchprint("torch_version:",torch.__version__)print("cuda_version:",torch.version.cuda)print("cudnn_version:",torch.backends.cudnn.version())print("----------------------------------")flag=torch.cuda.is_ava......
  • Kubernetes轻量级日志工具Loki安装及踩坑记录
    Loki简介Loki是Grafana出品的一个轻量级日志系统,熟悉ELK的都知道ELK使用起来的成本,而且仅仅是日志检索使用ELK的话有点大材小用了。Loki8技术栈中使用了以下组件。Promtail用来将容器日志发送到Loki或者Grafana服务上的日志收集工具,该工具主要包括发现采集目标以及给日志......
  • k8s安装并迁移jumpserver
    一、环境二、安装依赖服务以下操作按需操作1.安装Helmwgethttps://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gztarxfhelm-v3.12.1-linux-amd64.tar.gzmvlinux-amd64/helm/usr/local/bin/helmversionhelmrepoaddjumpserverhttps://jumpserver.github.io/he......
  • Archlinux安装和配置fcitx5
    本文基于archlinux系统,搭配dwm窗口管理器进行配置fcitx5安装一些基础包的安装,关于fcitx5框架我们只需要安装fcitx5-im包就可以,这个包实际上就包含了:fcitx5fcitx5-configtoolfcitx5-gtkfcitx5-qt除此之外再安装中文插件和基本的主题sudopacman-Sfcitx5-imfcitx5-chin......
  • 如何实现rpm安装mysql的配置文件目录的具体操作步骤
    rpm安装mysql的配置文件目录MySQL是一个流行的关系型数据库管理系统,它提供了一种简单而高效的方式来管理和存储数据。在安装MySQL时,我们需要配置一些参数,以满足我们的需求。本文将介绍如何使用RPM包安装MySQL,并详细说明配置文件的目录和使用方法。RPM包安装MySQLRPM(Red......
  • Linux系统安装MySql服务器
    1、登录购买的云服务器,进入到根目录,如下图: 2、查看系统里是否有安装MySQL相关的程序包,有则需要先卸载,再重新安装,卸载过程文档后续补充,如需先卸载,可自行百度查找解决方案进行处理。查询是否安装命令:rpm-qa|grepmysql 如图,是已经安装的情况(如下截图的是redis,mysql同理)......
  • docker-machine(v0.16.2)安装,云盘下载
    1、附件下载链接:https://pan.baidu.com/s/1WbTTCKosPuody3ni2UpCkQ提取码:9thm2、安装onosx:$curl-Lhttps://github.com/docker/machine/releases/download/v0.16.2/docker-machine-`uname-s`-`uname-m`>/usr/local/bin/docker-machine&&\chmod+x/usr/loca......
  • Docker Nginx安装使用以及踩坑点总结
    拉取nginx镜像dockerpullnginx:latest运行镜像暂时不需要配置volume挂载dockerrun--namenginx-p80:80-dnginx参数详解:--namenginx指定容器的名称-p80:80映射端口-d守护进程运行创建volume目录mkdir-p/www/nginx/conf.dmkdir-p/www/nginx/htmlmkd......
  • java JDK安装及配置
    javaJDK安装及配置windows11jdk-8u261-windows-x64.exe1、点击安装,一路默认即可2、设置系统环境变量新建JAVA_HOME指明JDK安装路径,就是刚才安装时所选择的路径C:\ProgramFiles\Java\jdk1.8.0_261,此路径下包括lib,bin,jre等文件夹(此变量最好设置,因为以后运行tomcat,eclipse等......