Torch is incompatible with CUDA

username: YJimmy
cooked: <p>I have been trying to create an environment to enable tensorflow, pytorch, etc.<br>
I created a new environment &lt;new_env&gt; via Anaconda with following packages:</p>
<p>GPU: GeForce GTX 1660 Ti<br>
GPU driver: 452.06</p>
<p>python 3.6<br>
pytroch 1.4.0<br>
cudatoolkit 10.0.130<br>
cudnn 7.6.5<br>
tensorflow 2.0.0</p>
<p>However, when I try to check the availability of the CUDA on jupyter notebook the following error is shown:</p>
<blockquote>
<blockquote>
<p>torch.cuda.device_count()</p>
</blockquote>
</blockquote>
<p><em>---------------------------------------------------------------------------</em><br>
<em>AssertionError                            Traceback (most recent call last)</em><br>
<em> in </em><br>
<em>----&gt; 1 torch.cuda.get_device_name(0)</em></p>
<p><em>~\anaconda3\envs\ML\lib\site-packages\torch\cuda_<em>init</em>_.py in get_device_name(device)</em></p>
<ul>
<li>302             if :attr:<code>device</code> is <code>None</code> (default).*</li>
<li>303     “”"*<br>
<em> → 304     return get_device_properties(device).name</em></li>
<li>305 *</li>
<li>306 *</li>
</ul>
<p><em>~\anaconda3\envs\ML\lib\site-packages\torch\cuda_<em>init</em>_.py in get_device_properties(device)</em></p>
<ul>
<li>323 *</li>
<li>324 def get_device_properties(device):*<br>
<em> → 325     _lazy_init()  # will define _get_device_properties and _CudaDeviceProperties</em></li>
<li>326     device = _get_device_index(device, optional=True)*</li>
<li>327     if device &lt; 0 or device &gt;= device_count():*</li>
</ul>
<p><em>~\anaconda3\envs\ML\lib\site-packages\torch\cuda_<em>init</em>_.py in _lazy_init()</em></p>
<ul>
<li>194             raise RuntimeError(*</li>
<li>195                 "Cannot re-initialize CUDA in forked subprocess. " + msg)*<br>
<em> → 196         _check_driver()</em></li>
<li>197         torch._C._cuda_init()*</li>
<li>198         _cudart = _load_cudart()*</li>
</ul>
<p><em>~\anaconda3\envs\ML\lib\site-packages\torch\cuda_<em>init</em>_.py in _check_driver()</em></p>
<ul>
<li>
<pre><code>92 def _check_driver():*
</code></pre>
</li>
<li>
<pre><code>93     if not hasattr(torch._C, '_cuda_isDriverSufficient'):*
</code></pre>
</li>
</ul>
<p><em>—&gt; 94         raise AssertionError(“Torch not compiled with CUDA enabled”)</em></p>
<ul>
<li>
<pre><code>95     if not torch._C._cuda_isDriverSufficient():*
</code></pre>
</li>
<li>
<pre><code>96         if torch._C._cuda_getDriverVersion() == 0:*
</code></pre>
</li>
</ul>
<p><em>AssertionError: Torch not compiled with CUDA enabled</em></p>
<hr>
<p>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 <em>conda install pytorch torchvision cudatoolkit=10.2 -c pytorch</em> under the environment I created via Anaconda. As a result, it said CUDA version is conflicted with a LONG message of confliction:</p>
<p>_____________________________________________________________________-<br>
<em>UnsatisfiableError: The following specifications were found</em><br>
<em>to be incompatible with the existing python installation in your environment:</em></p>
<p><em>Specifications:</em></p>
<ul>
<li>
<ul>
<li>argon2-cffi → python[version=‘&gt;=2.7,&lt;2.8.0a0|&gt;=3.5,&lt;3.6.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>bleach → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>brotlipy → python[version=‘&gt;=2.7,&lt;2.8.0a0|&gt;=3.5,&lt;3.6.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>cryptography → python[version=‘&lt;=3.3’]*</li>
</ul>
</li>
<li>
<ul>
<li>cupy → python[version=‘&gt;=2.7,&lt;2.8.0a0|&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>grpcio → python[version=‘&gt;=2.7,&lt;2.8.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>jinja2 → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>keras-applications → python[version=‘&gt;=2.7,&lt;2.8.0a0|&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>keras-base → python[version=‘&gt;=2.7,&lt;2.8.0a0|&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>keras-preprocessing → python[version=‘&gt;=2.7,&lt;2.8.0a0|&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>mkl_random → python[version=‘&gt;=2.7,&lt;2.8.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>numba → python=3.4*</li>
</ul>
</li>
<li>
<ul>
<li>oauthlib → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>packaging → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>prometheus_client → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>pygments → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>pyrsistent → python[version=‘&gt;=3.5,&lt;3.6.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>python-dateutil → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>pytorch → python[version=‘&gt;=2.7,&lt;2.8.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>requests-oauthlib → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>testpath → python[version=‘&gt;=3.8,&lt;3.9.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>torchvision → python[version=‘&gt;=2.7,&lt;2.8.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>urllib3 → python[version=‘&lt;=3.3’]*</li>
</ul>
</li>
</ul>
<p><em>Your python: python=3.6</em></p>
<p><em>If python is on the left-most side of the chain, that’s the version you’ve asked for.</em><br>
<em>When python appears to the right, that indicates that the thing on the left is somehow</em><br>
<em>not available for the python version you are constrained to. Note that conda will not</em><br>
<em>change your python version to a different minor version unless you explicitly specify</em><br>
<em>that.</em></p>
<p><em>The following specifications were found to be incompatible with a past</em><br>
<em>explicit spec that is not an explicit spec in this operation (pytorch):</em></p>
<ul>
<li>
<ul>
<li>cudatoolkit=10.2*</li>
</ul>
</li>
<li>
<ul>
<li>pytorch → cudatoolkit[version=‘&gt;=10.0,&lt;10.1|&gt;=10.1,&lt;10.2|&gt;=10.2,&lt;10.3|&gt;=9.2,&lt;9.3|&gt;=9.0,&lt;9.1|&gt;=8.0,&lt;8.1’]*</li>
</ul>
</li>
<li>
<ul>
<li>pytorch → numpy[version=‘&gt;=1.11|&gt;=1.11.3,&lt;2.0a0|&gt;=1.14.6,&lt;2.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>torchvision → cudatoolkit[version=‘&gt;=10.0,&lt;10.1|&gt;=10.1,&lt;10.2|&gt;=10.2,&lt;10.3|&gt;=9.2,&lt;9.3|&gt;=9.0,&lt;9.1’]*</li>
</ul>
</li>
<li>
<ul>
<li>torchvision → numpy[version=‘&gt;=1.11’]*</li>
</ul>
</li>
<li>
<ul>
<li>torchvision → pytorch==1.6.0 → numpy[version=‘&gt;=1.11.3,&lt;2.0a0|&gt;=1.14.6,&lt;2.0a0’]*</li>
</ul>
</li>
<li>
<ul>
<li>torchvision → pytorch[version=‘1.2.0|1.3.0|1.3.1|1.4.0|1.5.0|1.5.1|1.6.0|&gt;=1.1.0|&gt;=1.0.0|&gt;=0.4’]*</li>
</ul>
</li>
<li>
<ul>
<li>torchvision → pytorch[version=‘&gt;=1.0.0’] → cudatoolkit[version=‘&gt;=8.0,&lt;8.1’]*</li>
</ul>
</li>
</ul>
<p><em>The following specifications were found to be incompatible with each other:</em></p>
<p><em>Output in format: Requested package → Available versions</em></p>
<p><em>Package libmklml conflicts for:</em><br>
<em>tensorflow-estimator → tensorflow-base[version=‘&gt;=2.1.0,&lt;2.2.0a0’] → libmklml[version=‘&gt;=2019.0.5’]</em><br>
<em>torchvision → pytorch==1.6.0 → libmklml</em><br>
<em>pytorch → libmklml</em><br>
<em>tensorflow-base → libmklml[version=‘&gt;=2018.0.3|&gt;=2019.0.3|&gt;=2019.0.5’]</em><br>
<em>tensorflow → tensorflow-base==2.1.0=mkl_py37h230818c_0 → libmklml[version=‘&gt;=2018.0.3|&gt;=2019.0.3|&gt;=2019.0.5’]</em></p>
<hr>
<p>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</p>

username: albanD
cooked: <p>Hi,</p>
<p>The error " <em>AssertionError: Torch not compiled with CUDA enabled</em>" seems to indicate that you did not installed the correct version?</p>
<p>Did you follow the instructions from <a href="https://pytorch.org/get-started/locally/">https://pytorch.org/get-started/locally/</a> ?</p>

username: YJimmy
cooked: <p>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.</p>