[hotfix] fix collect_env not working when torch compile/install fails (#47752)
Summary:
fix collect env not working when pytorch compile from source failed mid-way.
```
Traceback (most recent call last):
OSError: /home/rongr/local/pytorch/torch/lib/libtorch_global_deps.so: cannot open shared object file: No such file or directory
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47752
Reviewed By: janeyx99
Differential Revision: D24888576
Pulled By: walterddr
fbshipit-source-id: 3b20daeddbb4118491fb0cca9fb59d861f683da7