Key Error while installing pytorch with cuda

username: Dhruv_Vashist
cooked: <p>I am getting 2 errors. The first is Key Error and the other is Memory Error.</p>
<p>C:\Users\91781&gt;pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio===0.8.0 -f <a href="https://download.pytorch.org/whl/torch_stable.html" rel="noopener nofollow ugc">https://download.pytorch.org/whl/torch_stable.html</a><br>
Collecting torch==1.8.0+cu111<br>
Downloading <a href="https://download.pytorch.org/whl/cu111/torch-1.8.0%2Bcu111-cp38-cp38-win_amd64.whl" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu111/torch-1.8.0%2Bcu111-cp38-cp38-win_amd64.whl</a> (3055.7 MB)<br>
|████████████████████████████████| 3055.7 MB 450 bytes/s eta 0:00:12ERROR: Exception:<br>
Traceback (most recent call last):<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\resolvelib\resolvers.py”, line 171, in _merge_into_criterion<br>
crit = self.state.criteria[name]<br>
KeyError: ‘torch’</p>
<p>During handling of the above exception, another exception occurred:</p>
<p>Traceback (most recent call last):<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\cli\base_command.py”, line 189, in _main<br>
status = self.run(options, args)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\cli\req_command.py”, line 178, in wrapper<br>
return func(self, options, args)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\commands\install.py”, line 316, in run<br>
requirement_set = resolver.resolve(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\resolution\resolvelib\resolver.py”, line 121, in resolve<br>
self._result = resolver.resolve(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\resolvelib\resolvers.py”, line 453, in resolve<br>
state = resolution.resolve(requirements, max_rounds=max_rounds)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\resolvelib\resolvers.py”, line 318, in resolve<br>
name, crit = self._merge_into_criterion(r, parent=None)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\resolvelib\resolvers.py”, line 173, in _merge_into_criterion<br>
crit = Criterion.from_requirement(self._p, requirement, parent)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\resolvelib\resolvers.py”, line 82, in from_requirement<br>
if not cands:<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\resolvelib\structs.py”, line 124, in <strong>bool</strong><br>
return bool(self._sequence)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py”, line 143, in <strong>bool</strong><br>
return any(self)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py”, line 38, in _iter_built<br>
candidate = func()<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\resolution\resolvelib\factory.py”, line 167, in _make_candidate_from_link<br>
self._link_candidate_cache[link] = LinkCandidate(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\resolution\resolvelib\candidates.py”, line 300, in <strong>init</strong><br>
super().<strong>init</strong>(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\resolution\resolvelib\candidates.py”, line 144, in <strong>init</strong><br>
self.dist = self._prepare()<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\resolution\resolvelib\candidates.py”, line 226, in _prepare<br>
dist = self._prepare_distribution()<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\resolution\resolvelib\candidates.py”, line 311, in _prepare_distribution<br>
return self._factory.preparer.prepare_linked_requirement(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\operations\prepare.py”, line 457, in prepare_linked_requirement<br>
return self._prepare_linked_requirement(req, parallel_builds)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\operations\prepare.py”, line 480, in _prepare_linked_requirement<br>
local_file = unpack_url(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\operations\prepare.py”, line 230, in unpack_url<br>
file = get_http_url(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\operations\prepare.py”, line 108, in get_http_url<br>
from_path, content_type = download(link, temp_dir.path)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\network\download.py”, line 163, in <strong>call</strong><br>
for chunk in chunks:<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\cli\progress_bars.py”, line 159, in iter<br>
for x in it:<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_internal\network\utils.py”, line 64, in response_chunks<br>
for chunk in response.raw.stream(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\urllib3\response.py”, line 576, in stream<br>
data = self.read(amt=amt, decode_content=decode_content)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\urllib3\response.py”, line 519, in read<br>
data = self._fp.read(amt) if not fp_closed else b""<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 65, in read<br>
self._close()<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 52, in _close<br>
self.__callback(self._<em>buf.getvalue())<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\cachecontrol\controller.py”, line 309, in cache_response<br>
cache_url, self.serializer.dumps(request, response, body=body)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\cachecontrol\serialize.py”, line 72, in dumps<br>
return b",“.join([b"cc=4”, msgpack.dumps(data, use_bin_type=True)])<br>
File "c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\msgpack_<em>init</em></em>.py", line 35, in packb<br>
return Packer(**kwargs).pack(o)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\msgpack\fallback.py”, line 960, in pack<br>
self._pack(obj)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\msgpack\fallback.py”, line 943, in _pack<br>
return self._pack_map_pairs(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\msgpack\fallback.py”, line 1045, in _pack_map_pairs<br>
self._pack(v, nest_limit - 1)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\msgpack\fallback.py”, line 943, in _pack<br>
return self._pack_map_pairs(<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\msgpack\fallback.py”, line 1044, in _pack_map_pairs<br>
self._pack(k, nest_limit - 1)<br>
File “c:\users\91781\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\msgpack\fallback.py”, line 896, in _pack<br>
return self._buffer.write(obj)<br>
MemoryError</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/1/414317fc4d480ff3a1e5c98d3351bba567bad4b3.png" data-download-href="https://discuss.pytorch.org/uploads/default/414317fc4d480ff3a1e5c98d3351bba567bad4b3" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/4/1/414317fc4d480ff3a1e5c98d3351bba567bad4b3.png" alt="image" data-base62-sha1="9jkMyrH6wfZ7YuO9BtfAmkzHsif" width="690" height="176" data-dominant-color="1B1717"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">987×253 9.84 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>The other exception is the Memory error.</p>

username: RUSHIKESH_NARLAWAR
cooked: <p>hey everyone,<br>
i got same error while installing pytorch with cuda<br>
if anyone knows or have solved the issue do let us know</p>

username: Dhruv_Vashist
cooked: <p>Here pip tries to load pre-downloaded files.</p>
<p>Instead of using</p>
<pre><code class="lang-auto">pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio===0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
</code></pre>
<p>We use</p>
<pre><code class="lang-auto">pip --no-cache-dir install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio===0.8.0 -f https://download.pytorch.org/whl/torch_stable.html --user
</code></pre>
<p>This overrides the pre-downloaded files and starts from scratch.</p>