2

I was trying to pip install stanza and got this message:

ERROR: No matching distribution found for torch>=1.3.0 (from stanza)

I then ran pip install torch and got the following (the website won't let me include too much code, so here's the full error)

  ERROR: Command errored out with exit status 1:
   command: 'c:\python\python37\python.exe' ... ...
  ...  ...
  Traceback (most recent call last):
    ... ...
    File "C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\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
  ERROR: Command errored out with exit status 1:
   command: 'c:\python\python37\python.exe' ... ...
       cwd: C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\torch
  Complete output (2 lines):
  running clean
  error: [Errno 2] No such file or directory: '.gitignore'
  ----------------------------------------
  ERROR: Failed cleaning build dir for torch
DEPRECATION: Could not build wheels for torch which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python37\python.exe' ... ...
    Traceback (most recent call last):
    ... ...
      File "C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\torch\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:\python\python37\python.exe' ... ... Check the logs for full command output.
chocojunkie
  • 479
  • 2
  • 8
  • 14

2 Answers2

3

I can see that you have a Windows machine, so from this official pytorch website, you can build the command that the best for your requirements and system, try this

pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

And here, all of the torch packages are located, both Windows, MacOS, and Linux

vmemmap
  • 510
  • 4
  • 20
  • 2
    It got installed, and so did stanza. But now when I try to load the 'en' model in stanza, I get an error saying `module 'torch' has no attribute 'tensor'` – chocojunkie Aug 18 '20 at 13:46
  • @chocojunkie This is different problem. Please update your question or create another question. – vmemmap Aug 18 '20 at 13:48
  • @chocojunkie I found [this](https://stackoverflow.com/questions/47317141/pytorch-attributeerror-module-torch-has-no-attribute-tensor) question, please check if it helps you. – vmemmap Aug 18 '20 at 13:54
3

I came across the same error and realized that Python 3.9 is not supported by Pytorch yet. I created another virtual environment with Python 3.7 and the installation worked.

Sahil
  • 80
  • 4
  • this turned out to be true still in Nov 2021. in my case once i changed the interpreter to python 3.8, everything was okay – jcp Nov 05 '21 at 22:35