Repository: pytorch
Issue: ModuleNotFoundError when installing PyTorch via pip on aarch64 environment
Labels: module: binaries,triaged,module: arm

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->
Couldn't install PyTorch via pip. It's critical.

## To Reproduce

Steps to reproduce the behavior:

1. ` python3 -m pip install --no-binary torch torch`

Here's output.
```
root@pynq:~# python3 -m pip install --no-binary torch torch
Collecting torch
  Using cached torch-0.1.2.post2.tar.gz (128 kB)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (from torch) (3.12)
Skipping wheel build for torch, due to binaries being disabled for it.
Installing collected packages: torch
    Running setup.py install for torch ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fh45j_29/torch/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fh45j_29/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-857uyf6r/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/torch
         cwd: /tmp/pip-install-fh45j_29/torch/
    Complete output (23 lines):
    running install
    running build_deps
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-fh45j_29/torch/setup.py", line 265, in <module>
        description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
      File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-fh45j_29/torch/setup.py", line 99, in run
        self.run_command('build_deps')
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-fh45j_29/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: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fh45j_29/torch/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fh45j_29/torch/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-857uyf6r/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/torch Check the logs for full command output.
```

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->
Install succeeds.

## Environment

Please copy and paste the output from our
[environment collection script](https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py)
(or fill out the checklist below manually).

You can get the script and run it with:
```
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

Collecting environment information...
Traceback (most recent call last):
  File "collect_env.py", line 429, in <module>
    main()
  File "collect_env.py", line 424, in main
    output = get_pretty_env_info()
  File "collect_env.py", line 419, in get_pretty_env_info
    return pretty_str(get_env_info())
  File "collect_env.py", line 276, in get_env_info
    if torch.version.hip is None:  # cuda version
NameError: name 'torch' is not defined
```

 - PyTorch Version (e.g., 1.0): latest
 - OS (e.g., Linux): Linux pynq 4.19.0-xilinx-v2019.1 #1 SMP Sat Oct 12 00:54:10 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
 - How you installed PyTorch (`conda`, `pip`, source): pip
 - Build command you used (if compiling from source): N/A
 - Python version: Python 3.6.5
 - CUDA/cuDNN version: N/A
 - GPU models and configuration: N/A
 - Any other relevant information: Ultra96-V2 board

## Additional context

<!-- Add any other context about the problem here. -->


cc @ezyang @seemethere @malfet @walterddr