
Ich versuche mit Python Zincbase zu arbeiten und muss dafür PyTorch unter Windows installieren. Bei der Ausführung
pip install torch
Ich erhalte die Fehlermeldung
ERROR: Command errored out with exit status 1:
command: 'c:\data-nobackup\development\im-099329-
gremlintest\env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\104172\\AppData\\Local\\Temp\\pip-install-5go0i_r_\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\104172\\AppData\\Local\\Temp\\pip-install-5go0i_r_\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\104172\AppData\Local\Temp\pip-wheel-bk0m_2ck' --python-tag cp36
cwd: C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\
Complete output (30 lines):
running bdist_wheel
running build
running build_deps
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\setup.py", line 265, in <module>
description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
File "c:\data-nobackup\development\im-099329-gremlintest\env\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\customsoftware\python3.6\Lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\data-nobackup\development\im-099329-gremlintest\env\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "c:\customsoftware\python3.6\Lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\customsoftware\python3.6\Lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\customsoftware\python3.6\Lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\setup.py", line 51, in run
from tools.nnwrap import generate_wrappers as generate_nn_wrappers
ModuleNotFoundError: No module named 'tools.nnwrap'
ERROR: Failed building wheel for torch
Wie kann ich Pytorch installieren?
Antwort1
Sie können einfach die PyTorch-Website unter besuchenpytorch.org
Gehen Sie dann auf die Seite „Erste Schritte“. Dort sehen Sie ein interessantes Online-Tool, in dem Sie verschiedene Optionen auswählen können und das einen entsprechenden Befehl zur Installation von „Torch“ bereitstellt.
Genau wie auf dem folgenden Bild:
Wie man bei der obigen Auswahl sehen kann, wäre folgender Befehl zur Torch-Installation das Ergebnis:
pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
Antwort2
Anders als bei anderen Bibliotheken können wir PyTorch nicht einfach lokal mit dem Befehl „pip install torch“ installieren.
Gehe zuhttps://pytorch.orgWebsite und wählen Sie Ihre Maschine und Umgebung aus. Anschließend wird Ihnen der auszuführende Befehl angezeigt, etwa so:
pip3 install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html
Für Python 3.7 -
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision