Repository: pytorch/benchmark
Issue: Segfault with `collect-only` on Ubuntu 20.04 with numpy 1.17.5
Root cause: External Dependency Breakage

Segafult on Ubuntu 20.04 with Python 3.8.10 without even running any tests (even with `collect-only`) -

Interestingly, when `text` and `vision` are built, `Vision` uses numpy 1.17.5 & Pillow 8.2.0 on Ubuntu 20.04,
but numpy 1.19.5 & Pillow 8.3.1 are used on Ubuntu 18.04 with Python 3.8.11.
numpy 1.21 is thus uninstalled by either, and PyTorch has to be built again.
This issue isn't happening on Ubuntu 18.04, though.
Even on Ubuntu 20.04, this issue wasn't happening more than a month ago, so I guess there's some weird dependency issue.

```
user@node-0:/external/benchmark$ pytest test.py --cpu_only --ignore_machine_config --collect-only
================================================================== test session starts ===================================================================
platform linux -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /external/benchmark
plugins: benchmark-3.4.1, hypothesis-6.14.1
collecting ... Fatal Python error: Segmentation fault

Current thread 0x00007ff88f3a9740 (most recent call first):
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1166 in create_module
  File "<frozen importlib._bootstrap>", line 556 in module_from_spec
  File "<frozen importlib._bootstrap>", line 657 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/usr/local/lib/python3.8/dist-packages/PIL/ImageFont.py", line 48 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 848 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/external/vision/torchvision/utils.py", line 7 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 848 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/external/vision/torchvision/__init__.py", line 10 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 848 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/external/benchmark/torchbenchmark/models/Background_Matting/functions.py", line 3 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 848 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/external/benchmark/torchbenchmark/models/Background_Matting/__init__.py", line 11 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 848 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 1014 in _gcd_import
  File "/usr/lib/python3.8/importlib/__init__.py", line 127 in import_module
  File "/external/benchmark/torchbenchmark/__init__.py", line 91 in list_models
  File "/external/benchmark/test.py", line 83 in _load_tests
  File "/external/benchmark/test.py", line 88 in <module>
  File "/usr/local/lib/python3.8/dist-packages/_pytest/assertion/rewrite.py", line 170 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 1014 in _gcd_import
  File "/usr/lib/python3.8/importlib/__init__.py", line 127 in import_module
  File "/usr/local/lib/python3.8/dist-packages/_pytest/pathlib.py", line 524 in import_path
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 578 in _importtestmodule
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 500 in _getobj
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 291 in obj
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 516 in _inject_setup_module_fixture
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 503 in collect
  File "/usr/local/lib/python3.8/dist-packages/_pytest/runner.py", line 341 in <lambda>
  File "/usr/local/lib/python3.8/dist-packages/_pytest/runner.py", line 311 in from_call
  File "/usr/local/lib/python3.8/dist-packages/_pytest/runner.py", line 341 in pytest_make_collect_report
  File "/usr/local/lib/python3.8/dist-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/local/lib/python3.8/dist-packages/pluggy/manager.py", line 84 in <lambda>
  File "/usr/local/lib/python3.8/dist-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/local/lib/python3.8/dist-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/local/lib/python3.8/dist-packages/_pytest/runner.py", line 458 in collect_one_node
  File "/usr/local/lib/python3.8/dist-packages/_pytest/main.py", line 808 in genitems
  File "/usr/local/lib/python3.8/dist-packages/_pytest/main.py", line 634 in perform_collect
  File "/usr/local/lib/python3.8/dist-packages/_pytest/main.py", line 333 in pytest_collection
  File "/usr/local/lib/python3.8/dist-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/local/lib/python3.8/dist-packages/pluggy/manager.py", line 84 in <lambda>
  File "/usr/local/lib/python3.8/dist-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/local/lib/python3.8/dist-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/local/lib/python3.8/dist-packages/_pytest/main.py", line 322 in _main
  File "/usr/local/lib/python3.8/dist-packages/_pytest/main.py", line 269 in wrap_session
  File "/usr/local/lib/python3.8/dist-packages/_pytest/main.py", line 316 in pytest_cmdline_main
  File "/usr/local/lib/python3.8/dist-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/local/lib/python3.8/dist-packages/pluggy/manager.py", line 84 in <lambda>
  File "/usr/local/lib/python3.8/dist-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/local/lib/python3.8/dist-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/local/lib/python3.8/dist-packages/_pytest/config/__init__.py", line 162 in main
  File "/usr/local/lib/python3.8/dist-packages/_pytest/config/__init__.py", line 185 in console_main
  File "/usr/local/bin/pytest", line 8 in <module>
Segmentation fault (core dumped)
```

```
Collecting environment information...
PyTorch version: 1.10.0a0+gitd773a77
Is debug build: False

OS: Ubuntu 20.04 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
CMake version: version 3.16.3
Libc version: glibc-2.31

Python version: 3.8.10 (default, Jun  2 2021, 10:49:15)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.4.0-77-generic-x86_64-with-glibc2.29

Versions of relevant libraries:
[pip3] bert-pytorch==0.0.1a4
[pip3] numpy==1.17.5
[pip3] torch==1.10.0a0+gitd773a77
[pip3] torch-struct==0.4
[pip3] torchfile==0.1.0
[pip3] torchtext==0.11.0a0+0d7b9e2
[pip3] torchvision==0.11.0a0+8541c21
[pip3] torchviz==0.0.2
```

Closed as this is not relevant anymore.