"AssertionError: Torch not compiled with CUDA enabled" in spite upgrading to CUDA version
I figured out this is a popular question, but still I couldn't find a solution for that.
I'm trying to run a simple repository here which uses PyTorch. Although I just upgraded my PyTorch to the latest CUDA version from pytorch.org (1.2.0), it still throws the same error. I'm on Windows 10 and use Conda with Python 3.7.
raise AssertionError("Torch not compiled with CUDA enabled")
Output:
AssertionError: Torch not compiled with CUDA enabled
How can I fix the problem?
Here is my conda list:
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0 anaconda
_pytorch_select 1.1.0 cpu anaconda
_tflow_select 2.3.0 mkl anaconda
absl-py 0.7.1 pypi_0 pypi
alabaster 0.7.12 py37_0 anaconda
anaconda 2019.07 py37_0 anaconda
anaconda-client 1.7.2 py37_0 anaconda
anaconda-navigator 1.9.7 py37_0 anaconda
anaconda-project 0.8.3 py_0 anaconda
argparse 1.4.0 pypi_0 pypi
asn1crypto 0.24.0 py37_0 anaconda
astor 0.8.0 pypi_0 pypi
astroid 2.2.5 py37_0 anaconda
astropy 3.2.1 py37he774522_0 anaconda
atomicwrites 1.3.0 py37_1 anaconda
attrs 19.1.0 py37_1 anaconda
babel 2.7.0 py_0 anaconda
backcall 0.1.0 py37_0 anaconda
backports 1.0 py_2 anaconda
backports-csv 1.0.7 pypi_0 pypi
backports-functools-lru-cache 1.5 pypi_0 pypi
backports.functools_lru_cache 1.5 py_2 anaconda
backports.os 0.1.1 py37_0 anaconda
backports.shutil_get_terminal_size 1.0.0 py37_2 anaconda
backports.tempfile 1.0 py_1 anaconda
backports.weakref 1.0.post1 py_1 anaconda
beautifulsoup4 4.7.1 py37_1 anaconda
bitarray 0.9.3 py37he774522_0 anaconda
bkcharts 0.2 py37_0 anaconda
blas 1.0 mkl anaconda
bleach 3.1.0 py37_0 anaconda
blosc 1.16.3 h7bd577a_0 anaconda
bokeh 1.2.0 py37_0 anaconda
boto 2.49.0 py37_0 anaconda
bottleneck 1.2.1 py37h452e1ab_1 anaconda
bzip2 1.0.8 he774522_0 anaconda
ca-certificates 2019.5.15 0 anaconda
certifi 2019.6.16 py37_0 anaconda
cffi 1.12.3 py37h7a1dbc1_0 anaconda
chainer 6.2.0 pypi_0 pypi
chardet 3.0.4 py37_1 anaconda
cheroot 6.5.5 pypi_0 pypi
cherrypy 18.1.2 pypi_0 pypi
click 7.0 py37_0 anaconda
cloudpickle 1.2.1 py_0 anaconda
clyent 1.2.2 py37_1 anaconda
colorama 0.4.1 py37_0 anaconda
comtypes 1.1.7 py37_0 anaconda
conda 4.7.11 py37_0 anaconda
conda-build 3.18.9 py37_3 anaconda
conda-env 2.6.0 1 anaconda
conda-package-handling 1.3.11 py37_0 anaconda
conda-verify 3.4.2 py_1 anaconda
console_shortcut 0.1.1 3 anaconda
constants 0.6.0 pypi_0 pypi
contextlib2 0.5.5 py37_0 anaconda
cpuonly 1.0 0 pytorch
cryptography 2.7 py37h7a1dbc1_0 anaconda
cudatoolkit 10.0.130 0 anaconda
curl 7.65.2 h2a8f88b_0 anaconda
cycler 0.10.0 py37_0 anaconda
cython 0.29.12 py37ha925a31_0 anaconda
cytoolz 0.10.0 py37he774522_0 anaconda
dask 2.1.0 py_0 anaconda
dask-core 2.1.0 py_0 anaconda
decorator 4.4.0 py37_1 anaconda
defusedxml 0.6.0 py_0 anaconda
distributed 2.1.0 py_0 anaconda
docutils 0.14 py37_0 anaconda
entrypoints 0.3 py37_0 anaconda
et_xmlfile 1.0.1 py37_0 anaconda
ez-setup 0.9 pypi_0 pypi
fastcache 1.1.0 py37he774522_0 anaconda
fasttext 0.9.1 pypi_0 pypi
feedparser 5.2.1 pypi_0 pypi
ffmpeg 4.1.3 h6538335_0 conda-forge
filelock 3.0.12 py_0 anaconda
first 2.0.2 pypi_0 pypi
fYou don't have to install it via anaconda, you could install cuda from their website. after install ends open a new terminal and check your cuda version with: >>> nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Thu_Nov_18_09:52:33_Pacific_Standard_Time_2021 Cuda compilation tools, release 11.5, V11.5.119 Build cuda_11.5.r11.5/compiler.30672275_0 my is V11.5 then go here and select your os and preferred package manager(pip or anaconda), and the cuda version you installed, and copy the generated install command, I got: pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html notice that for me I had python 3.10 installed but my project run over 3.9 so either use virtual environment or run pip of your wanted base interpreter explicitly (for example C:\Software\Python\Python39\python.exe -m pip install .....) else you will be stuck with Could not find a version that satisfies the requirement torch errors then open python console and check for cuda availability >>> import torch >>> torch.cuda.is_available() True
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/ade8198fd5505de06cc2ceeb3aa5dfc7fc54741d04785f8458d74a2bc9900ac4