Torch is incompatible with CUDA

I have been trying to create an environment to enable tensorflow, pytorch, etc.
I created a new environment <new_env> via Anaconda with following packages:

GPU: GeForce GTX 1660 Ti
GPU driver: 452.06

python 3.6
pytroch 1.4.0
cudatoolkit 10.0.130
cudnn 7.6.5
tensorflow 2.0.0

However, when I try to check the availability of the CUDA on jupyter notebook the following error is shown:

torch.cuda.device_count()

---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
in
----> 1 torch.cuda.get_device_name(0)

~\anaconda3\envs\ML\lib\site-packages\torch\cuda_init_.py in get_device_name(device)

  • 302 if :attr:device is None (default).*
  • 303 “”"*
    –> 304 return get_device_properties(device).name
  • 305 *
  • 306 *

~\anaconda3\envs\ML\lib\site-packages\torch\cuda_init_.py in get_device_properties(device)

  • 323 *
  • 324 def get_device_properties(device):*
    –> 325 _lazy_init() # will define _get_device_properties and _CudaDeviceProperties
  • 326 device = _get_device_index(device, optional=True)*
  • 327 if device < 0 or device >= device_count():*

~\anaconda3\envs\ML\lib\site-packages\torch\cuda_init_.py in _lazy_init()

  • 194 raise RuntimeError(*
  • 195 "Cannot re-initialize CUDA in forked subprocess. " + msg)*
    –> 196 _check_driver()
  • 197 torch._C._cuda_init()*
  • 198 _cudart = _load_cudart()*

~\anaconda3\envs\ML\lib\site-packages\torch\cuda_init_.py in _check_driver()

  • 92 def _check_driver():*
    
  • 93     if not hasattr(torch._C, '_cuda_isDriverSufficient'):*
    

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

  • 95     if not torch._C._cuda_isDriverSufficient():*
    
  • 96         if torch._C._cuda_getDriverVersion() == 0:*
    

AssertionError: Torch not compiled with CUDA enabled


Hence, I updated my driver to CUDA11 and realised pytorch isn’t ready for CUDA 11 yet. Hence, I tried to uninstall the updates (via software uninstaller in control panel) and downgrade to 10.x version via conda install pytorch torchvision cudatoolkit=10.2 -c pytorch under the environment I created via Anaconda. As a result, it said CUDA version is conflicted with a LONG message of confliction:

_____________________________________________________________________-
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

    • argon2-cffi -> python[version=’>=2.7,<2.8.0a0|>=3.5,<3.6.0a0’]*
    • bleach -> python[version=’>=3.8,<3.9.0a0’]*
    • brotlipy -> python[version=’>=2.7,<2.8.0a0|>=3.5,<3.6.0a0’]*
    • cryptography -> python[version=’<=3.3’]*
    • cupy -> python[version=’>=2.7,<2.8.0a0|>=3.8,<3.9.0a0’]*
    • grpcio -> python[version=’>=2.7,<2.8.0a0’]*
    • jinja2 -> python[version=’>=3.8,<3.9.0a0’]*
    • keras-applications -> python[version=’>=2.7,<2.8.0a0|>=3.8,<3.9.0a0’]*
    • keras-base -> python[version=’>=2.7,<2.8.0a0|>=3.8,<3.9.0a0’]*
    • keras-preprocessing -> python[version=’>=2.7,<2.8.0a0|>=3.8,<3.9.0a0’]*
    • mkl_random -> python[version=’>=2.7,<2.8.0a0’]*
    • numba -> python=3.4*
    • oauthlib -> python[version=’>=3.8,<3.9.0a0’]*
    • packaging -> python[version=’>=3.8,<3.9.0a0’]*
    • prometheus_client -> python[version=’>=3.8,<3.9.0a0’]*
    • pygments -> python[version=’>=3.8,<3.9.0a0’]*
    • pyrsistent -> python[version=’>=3.5,<3.6.0a0’]*
    • python-dateutil -> python[version=’>=3.8,<3.9.0a0’]*
    • pytorch -> python[version=’>=2.7,<2.8.0a0’]*
    • requests-oauthlib -> python[version=’>=3.8,<3.9.0a0’]*
    • testpath -> python[version=’>=3.8,<3.9.0a0’]*
    • torchvision -> python[version=’>=2.7,<2.8.0a0’]*
    • urllib3 -> python[version=’<=3.3’]*

Your python: python=3.6

If python is on the left-most side of the chain, that’s the version you’ve asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with a past
explicit spec that is not an explicit spec in this operation (pytorch):

    • cudatoolkit=10.2*
    • pytorch -> cudatoolkit[version=’>=10.0,<10.1|>=10.1,<10.2|>=10.2,<10.3|>=9.2,<9.3|>=9.0,<9.1|>=8.0,<8.1’]*
    • pytorch -> numpy[version=’>=1.11|>=1.11.3,<2.0a0|>=1.14.6,<2.0a0’]*
    • torchvision -> cudatoolkit[version=’>=10.0,<10.1|>=10.1,<10.2|>=10.2,<10.3|>=9.2,<9.3|>=9.0,<9.1’]*
    • torchvision -> numpy[version=’>=1.11’]*
    • torchvision -> pytorch==1.6.0 -> numpy[version=’>=1.11.3,<2.0a0|>=1.14.6,<2.0a0’]*
    • torchvision -> pytorch[version=‘1.2.0|1.3.0|1.3.1|1.4.0|1.5.0|1.5.1|1.6.0|>=1.1.0|>=1.0.0|>=0.4’]*
    • torchvision -> pytorch[version=’>=1.0.0’] -> cudatoolkit[version=’>=8.0,<8.1’]*

The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package libmklml conflicts for:
tensorflow-estimator -> tensorflow-base[version=’>=2.1.0,<2.2.0a0’] -> libmklml[version=’>=2019.0.5’]
torchvision -> pytorch==1.6.0 -> libmklml
pytorch -> libmklml
tensorflow-base -> libmklml[version=’>=2018.0.3|>=2019.0.3|>=2019.0.5’]
tensorflow -> tensorflow-base==2.1.0=mkl_py37h230818c_0 -> libmklml[version=’>=2018.0.3|>=2019.0.3|>=2019.0.5’]


Shouldn’t the environment I created via anacond is different from the base? With the cudatoolkit 10.0.130 installed, I shouldn’t be using the CUDA 11. I am a totaly newbie on this. I really appreciate it if someone can help me out

Hi,

The error " AssertionError: Torch not compiled with CUDA enabled" seems to indicate that you did not installed the correct version?

Did you follow the instructions from https://pytorch.org/get-started/locally/ ?

Thank you so much for your help. It works by re-installing a new environment, pytorch via the the link you provided and a supplementary file VC_redist.x64. I might missed some packages when installing via anaconda.