首页 > 其他分享 >raise AssertionError(“Torch not compiled with CUDA enabled“)

raise AssertionError(“Torch not compiled with CUDA enabled“)

时间:2023-06-09 15:08:06浏览次数:42  
标签:AssertionError raise compiled pytorch cuda 版本 CUDA


raise AssertionError(“Torch not compiled with CUDA enabled”)

遇到的问题,就是 GPU driver 以及cuda都装完了,pytorch装完之后想试试代码。
结果报错,raise AssertionError(“Torch not compiled with CUDA enabled”)。

解决方案

就是打开pytorch 官网,对照一下 cuda 版本和 pytorch版本是不是对的上。

比如我的 cuda 版本是 11.1, 那么 装 1.8.0 是可行的

raise AssertionError(“Torch not compiled with CUDA enabled“)_python


另外,我再 cuda 11.0 的情况下,也试着装了一下 pytorch 1.8.1,

结果也是能够调用 GPU的,就是不知道会不会有隐患。

总之遇到这个问题,可以考虑一下 cuda 版本和 pytorch版本 能不能在下载官网上找到对应的,然后修改一下。

例子:https://github.com/pytorch/pytorch/issues/30664

pytorch 官网: https://pytorch.org/get-started/previous-versions/


标签:AssertionError,raise,compiled,pytorch,cuda,版本,CUDA
From: https://blog.51cto.com/u_11384719/6447821

相关文章

  • zabbix--邮件告警报错“Support for SMTP authentication was not compiled in”
    邮件报警失败:SupportforSMTPauthenticationwasnotcompiledin 解决办法:升级curl版本具体操作步骤:1)安装curl #rpm-Uvhhttp://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/city-fan.org-release-2-1.rhel6.noarch.rpm#yum--showduplicateslistc......
  • AssertionError CUDA unavailable, invalid device 0 requested
    报错信息UserWarning:Userprovideddevice_typeof'cuda',butCUDAisnotavailable.Disablingwarnings.warn('Userprovideddevice_typeof\'cuda\',butCUDAisnotavailable.Disabling')AssertionError:CUDAunavailable,inv......
  • Linux多进程13-kill,raise,abort函数
    #include<sys/types.h>#include<signal.h>intkill(pid_tpid,intsig);-功能:给某个进程pid,发送某个信号sig-参数:-pid:>0:将信号发送给指定的进程=0:将信号发送给当前的进程组=-1:将信号发送给每一个......
  • Python很多时候要从键盘连续输入一个数组,并用空格隔开;Python爬取一些数据;python pip安
    Python要从键盘连续输入一个数组,并用空格隔开,Python中的实现方法如下:str=input(‘以空格为间隔连续输入一个数组:’)然后在键盘中输入,会·得到的str为一个字符串,要将其转为一个列表有两种方法方法一:a=[int(n)forninstr_in.split()]方法二:a=list(map(int,str.strip().sp......
  • Python | raise的使用
    当程序出现错误,Python会自动引发异常,Python允许我们在程序中手动设置异常,使用raise语句即可。一旦执行了raise语句,raise后面的语句将不能执行。我们从来都是想方设法地让程序正常运行,为什么还要手动设置异常呢?首先要分清楚程序发生异常和程序执行错误,它们完全是两码事,程序由于......
  • raise和raise from捕获异常
    raise/from捕获:可同时抛出自定义异常和原生异常>>>try:...a=2/0...exceptExceptionase:...raiseException('分母不能为0')frome...Traceback(mostrecentcalllast):File"<stdin>",line2,in<module>ZeroDivisionEr......
  • 成功解决requests 报错raise SSLError(e, request=request)_requests.exceptions.SSL
    问题描述在使用requests调用https接口时,会遇到ssl证书报错raiseSSLError(e,request=request)requests.exceptions.SSLError:HTTPSConnectionPool(host='v4.ketangpai.com',port=443):Maxretriesexceededwithurl:/UserApi/login(CausedbySSLError(SSLCertVerificat......
  • python 报错AssertionError: process has already started
    python报错AssertionError:processhasalreadystarted现象  原因在Python中设置守护进程daemon,一定要放在start方法上面才会有效解决方法 ......
  • python之终止代码运行之raise
    raise函数可以终止代码的运行print('hello')raise'终止运行,并报异常'print('word')执行结果>>>:helloTraceback(mostrecentcalllast):File"D:/Users/720......
  • IDEA Rebuild项目错误:Information:java: java.lang.AssertionError: Value of x -1
    模仿lombok工具,我的enumgen工具写完了。  公司的项目emax-rpcapi-list依赖了enumgen后,IDEARebuildProject时,或者mavenpackage/install的时候,出现报错→Information:java......