Installing Pytorch with pip fails

Alex_Dima: <p>Hello everyone! I am trying to install Pytorch with pip ( I want to create a Unity ML agents environment) and it fails. I tried:</p>
<pre><code class="lang-auto">(venv) C:\Users\Alexandra\Documents\Unity ML agents_first&gt;pip install torch===1.7.1+cu110 torchvision===0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch===1.7.1+cu110
ERROR: No matching distribution found for torch===1.7.1+cu110
</code></pre>
<p>and also simply :</p>
<pre><code class="lang-auto">(venv) C:\Users\Alexandra\Documents\Unity ML agents_first&gt;pip install torch
Collecting torch
  Using cached torch-0.1.2.post2.tar.gz (128 kB)
Requirement already satisfied: pyyaml in c:\users\alexandra\documents\unity ml agents_first\venv\lib\site-packages (from torch) (5.4.1)
WARNING: The candidate selected for download or install is a yanked version: 'torch' candidate (version 0.1.2.post2 at https://files.pythonhosted.org/packages/f8/02/880b468bd382dc79896eaecbeb8ce95e9c4b99a24902874a2cef0b562cea/torch-0.1.2.post2.tar.gz#sha256=a43e37f8f927c5b18f80cd163daaf6a1920edafcab5102e02e3e14bb97d9c874 (from https://pypi.org/simple/torch/))
Reason for being yanked: 0.1.2 is past it's support date and confuses users on unsupported platforms
Using legacy 'setup.py install' for torch, since package 'wheel' is not installed.
Installing collected packages: torch
    Running setup.py install for torch ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\alexandra\documents\unity ml agents_first\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Alexandra\\AppData\\Local\\Temp\\pip-install-n1q74mey\\torch_1eaaa35250fe429f91804a5735444e40\\setup.py'"'"'; __file__='"'"'C:\\Users\\Alexandra\\AppData\\Local\\Temp\\pip-install-n1q74mey\\torch_1eaaa35250fe429f91804a5735444e40\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Alexandra\AppData\Local\Temp\pip-record-2ocx9o87\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\alexandra\documents\unity ml agents_first\venv\include\site\python3.8\torch'
         cwd: C:\Users\Alexandra\AppData\Local\Temp\pip-install-n1q74mey\torch_1eaaa35250fe429f91804a5735444e40\
    Complete output (23 lines):
    running install
    running build_deps
    Traceback (most recent call last):
      File "&lt;string&gt;", line 1, in &lt;module&gt;
      File "C:\Users\Alexandra\AppData\Local\Temp\pip-install-n1q74mey\torch_1eaaa35250fe429f91804a5735444e40\setup.py", line 225, in &lt;module&gt;
        setup(name="torch", version="0.1.2.post2",
      File "c:\users\alexandra\documents\unity ml agents_first\venv\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\Alexandra\AppData\Local\Programs\Python\Python38-32\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\Alexandra\AppData\Local\Programs\Python\Python38-32\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\Alexandra\AppData\Local\Programs\Python\Python38-32\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Alexandra\AppData\Local\Temp\pip-install-n1q74mey\torch_1eaaa35250fe429f91804a5735444e40\setup.py", line 99, in run
        self.run_command('build_deps')
      File "C:\Users\Alexandra\AppData\Local\Programs\Python\Python38-32\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\Alexandra\AppData\Local\Programs\Python\Python38-32\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Alexandra\AppData\Local\Temp\pip-install-n1q74mey\torch_1eaaa35250fe429f91804a5735444e40\setup.py", line 51, in run
        from tools.nnwrap import generate_wrappers as generate_nn_wrappers
    ModuleNotFoundError: No module named 'tools.nnwrap'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\alexandra\documents\unity ml agents_first\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Alexandra\\AppData\\Local\\Temp\\pip-install-n1q74mey\\torch_1eaaa35250fe429f91804a5735444e40\\setup.py'"'"'; __file__='"'"'C:\\Users\\Alexandra\\AppData\\Local\\Temp\\pip-install-n1q74mey\\torch_1eaaa35250fe429f91804a5735444e40\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Alexandra\AppData\Local\Temp\pip-record-2ocx9o87\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\alexandra\documents\unity ml agents_first\venv\include\site\python3.8\torch' Check the logs for full command output.
</code></pre>
<p>I also tried to use pip3 but it gives me the same errors. I am using Python 3.8.6 on Windows 10 (64 bit) . Does anyone have any suggestions on how to solve this, or any workaround to be able to use Unity ML agents?</p>
<p>Thank you!<br>
A.</p>

tom: <p>I think the triple equal === should be double equal ==.<br>
I’ll try to ping the PyTorch team about it.</p>

peterjc123: <p><a class="mention" href="/u/tom">@tom</a> Triple equal is not fully equivalent with double equal. For example, with <code>===1.7.1</code> we will get the package version with 1.7.1. But with <code>==1.7.1</code>, you may get any one of the following version: <code>1.7.1</code>, <code>1.7.1+cpu</code>, <code>1.7.1+cu101</code>, <code>1.7.1+cu102</code>, <code>1.7.1+cu110</code>. More details can be seen in <a href="https://www.python.org/dev/peps/pep-0440/#id53" rel="noopener nofollow ugc">PEP 440</a>. Here we use triple equality signs on purpose, so this is not a bug.</p>
<p><a class="mention" href="/u/alex_dima">@Alex_Dima</a> The path <code>C:\Users\Alexandra\AppData\Local\Programs\Python\Python38-32</code> can be seen in the log. The 64-bit Python is not used. If you are sure <code>python</code> refers to x64 Python distribution, then you can do <code>python -m pip install torch===1.7.1+cu110 torchvision===0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html</code>.</p>

tom: <p><a class="mention" href="/u/peterjc123">@peterjc123</a> Thank you for correcting me!</p>