-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
AssertionError: Torch not compiled with CUDA enabled #30664
Comments
How did you install pytorch? It sounds like you installed pytorch without CUDA support. https://pytorch.org/ has instructions for how to install pytorch with cuda support. |
Shalom! I am new to pytorch, and already installed pytorch in my Mac laptop. trying to run the wsi_bert.py code, and get this error. |
Try this. |
Note that unless you know otherwise, your Mac probably doesn't have an NVIDIA GPU on it. For further support questions related to installation, please follow up on the forums https://discuss.pytorch.org/ |
Some CUDA functions seem to result in AssertionError for MacOS users that haven't installed Pytorch with CUDA support. More info: pytorch/pytorch#30664
I don't know where to raise an issue, but this continues to be a problem on Windows when Pytorch is installed without CUDA support even though it has been recently fixed for MacOS. Can someone help me? |
Experiencing this problem on Windows as well. |
I tried re-installing pytorch as per @swj0418 above, |
I have the same question too. I think i need to modify the code, but i don't what to do. |
Same here, installing as described on pytorch site (
Where there's clearly cpu already in the package names, which can be confirmed after installation:
p.s. CUDA 10.1 was completely installed before creating the env and installing pytorch |
I had the same problem (Win10, CUDA installed prior to making conda env) The option to install using pip worked for me (inside a miniconda env, python 3.7.7) From the pytorch website:
|
Change code |
@Gailsunset I was running the same code from |
In my case, I had |
how did you delete it? |
Just confirming this approach worked for me; Windows 10, using Anaconda's CMD Terminal; CUDA v10 |
I'm having the same problem on an Ubuntu VM. No CUDA installed (because no GPU), and I am 100% sure it is the cpu-only version. I know because I have uninstalled and reinstalled many times (each time making sure all previous files are removed), trying pytorch 1.4, 1.5, and 1.6, all with corresponding torchvision versions. I've also tried editing the code to specify the whole torch.device="cpu" thing but the issue persists. I currently have torch=1.5 with cpu only and torchvision 0.6 installed and would be really grateful to anyone with suggestions. |
i have a rtx 2060 and it worked fine with this toolkit. |
@Testin1234 are you resolve this one? |
If you've ever ran
|
Thank you so much!!!!!!!! |
I encountered the same problem, I think you should uninstall the cpu version of torch, and change it to the gpu version to solve it |
Many thanks for the solution, that's the only solution that worked on my linux machine as well. |
这是来自QQ邮箱的假期自动回复邮件。感谢您的来信,邮件我已收到,谢谢!祝您生活愉快!
|
This worked like a charm, Thank you !!! |
I heve the same issue in same pc |
这是来自QQ邮箱的假期自动回复邮件。感谢您的来信,邮件我已收到,谢谢!祝您生活愉快!
|
you can set runtime mode to resolve this issue |
#30664
1. Go to NIVIDIA and install cuda toolkit:
nvcc —version
2. Install pytorch
…On Fri, Sep 29, 2023 at 12:28 AM geeker-smallwhite ***@***.***> wrote:
Hi, I have M2 max chip MacOS with 12 CPU, 38 GPU. I am getting this error
:“Torch not compiled with CUDA enabled”. May I ask your help please? Thanks
I heve the same issue in same pc
you can set runtime mode to resolve this issue
—
Reply to this email directly, view it on GitHub
<#30664 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADBSBD47WYWGVZA7QQMXKLLX4Z2BZANCNFSM4JUZTN3A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
You need to make sure that your cuda driver (downloaded at https://developer.nvidia.com/cuda-downloads) matches with the pytorch-cuda library version that you install with python. For example, the current snippet at the official pytorch site is: So, you need to have the 11.8 version of cuda downloaded from nvidia official website and installed. |
这是来自QQ邮箱的假期自动回复邮件。感谢您的来信,邮件我已收到,谢谢!祝您生活愉快!
|
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 |
thank you!!!!! |
这是来自QQ邮箱的假期自动回复邮件。感谢您的来信,邮件我已收到,谢谢!祝您生活愉快!
|
thank you so much it works for me :) |
这是来自QQ邮箱的假期自动回复邮件。感谢您的来信,邮件我已收到,谢谢!祝您生活愉快!
|
I am getting the same error. My laptop doesn't have a dedicated Nvidia GPU. How can I resolve this? Is there any solution? |
这是来自QQ邮箱的假期自动回复邮件。感谢您的来信,邮件我已收到,谢谢!祝您生活愉快!
|
This one worked for me too! Thanks |
this didn't work on my mac and now my torch is broken saying module not found but already satisfied so thanks a lot for this |
这是来自QQ邮箱的假期自动回复邮件。感谢您的来信,邮件我已收到,谢谢!祝您生活愉快!
|
I also encountered the same error, this method is worked.. |
这是来自QQ邮箱的假期自动回复邮件。感谢您的来信,邮件我已收到,谢谢!祝您生活愉快!
|
This fixed my problem when encountering this issue while using DeepLabCut (DLC). |
I use in conda env., reinstall it by commands and solved it. |
This happens once you install pytorch using conda. Instead, install it using: |
I'm trying to do neural style swapping, and for some reason, I keep getting the following errors.
AssertionError: Torch not compiled with CUDA enabled
File "c:\apps\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 260, in cuda
return self._apply(lambda t: t.cuda(device))
File "c:\apps\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 187, in _apply
module._apply(fn)
File "c:\apps\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 187, in _apply
module._apply(fn)
File "c:\apps\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 193, in _apply
param.data = fn(param.data)
File "c:\apps\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 260, in
return self.apply(lambda t: t.cuda(device))
File "c:\apps\Miniconda3\lib\site-packages\torch\cuda_init.py", line 161, in _lazy_init
check_driver()
File "c:\apps\Miniconda3\lib\site-packages\torch\cuda_init.py", line 75, in _check_driver
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
I recently reinstalled conda and this has just been completely broken for me.
cc @ezyang
The text was updated successfully, but these errors were encountered: