# Buggy code
def find_matching_gcc_compiler_path(gxx_compiler_version):
    for path_dir, bin_file in enumerate_binaries_in_path():
        if re.match("^gcc(?:-\\d+(?:\\.\\d+)*)?$", bin_file):
            # gcc, or gcc-7, gcc-4.9, or gcc-4.8.5
            compiler = os.path.join(path_dir, bin_file)
            compiler_version = determine_gcc_version(compiler)
            if compiler_version == gxx_compiler_version:
                return compiler

    print("INFO: Unable to find gcc compiler (version %s)." % gxx_compiler_version)
    return None


# Traceback (ModuleNotFoundError)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting horovod
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/8f/d9/67e496de0e04d314bb4bf3621442880486a560ab4e682f1c24ec7bf3c9b6/horovod-0.17.0.post1.tar.gz
Requirement already satisfied: cloudpickle in /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages (from horovod) (1.1.1)
Requirement already satisfied: psutil in /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages (from horovod) (5.6.2)
Requirement already satisfied: six in /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages (from horovod) (1.12.0)
Requirement already satisfied: cffi>=1.4.0 in /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages (from horovod) (1.12.3)
Requirement already satisfied: pycparser in /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages (from cffi>=1.4.0->horovod) (2.19)
Building wheels for collected packages: horovod
Running setup.py bdist_wheel for horovod ... error
Complete output from command /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-c74kecsx/horovod/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 /tmp/pip-wheel-c74z94_t --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/horovod
copying horovod/__init__.py -> build/lib.linux-x86_64-3.7/horovod
creating build/lib.linux-x86_64-3.7/horovod/_keras
copying horovod/_keras/callbacks.py -> build/lib.linux-x86_64-3.7/horovod/_keras
copying horovod/_keras/__init__.py -> build/lib.linux-x86_64-3.7/horovod/_keras
creating build/lib.linux-x86_64-3.7/horovod/spark
copying horovod/spark/__init__.py -> build/lib.linux-x86_64-3.7/horovod/spark
creating build/lib.linux-x86_64-3.7/horovod/mxnet
copying horovod/mxnet/mpi_ops.py -> build/lib.linux-x86_64-3.7/horovod/mxnet
copying horovod/mxnet/__init__.py -> build/lib.linux-x86_64-3.7/horovod/mxnet
creating build/lib.linux-x86_64-3.7/horovod/torch
copying horovod/torch/mpi_ops.py -> build/lib.linux-x86_64-3.7/horovod/torch
copying horovod/torch/compression.py -> build/lib.linux-x86_64-3.7/horovod/torch
copying horovod/torch/__init__.py -> build/lib.linux-x86_64-3.7/horovod/torch
creating build/lib.linux-x86_64-3.7/horovod/common
copying horovod/common/util.py -> build/lib.linux-x86_64-3.7/horovod/common
copying horovod/common/basics.py -> build/lib.linux-x86_64-3.7/horovod/common
copying horovod/common/__init__.py -> build/lib.linux-x86_64-3.7/horovod/common
creating build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/task_fn.py -> build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/mpi_run.py -> build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/run.py -> build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/gloo_run.py -> build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run
creating build/lib.linux-x86_64-3.7/horovod/keras
copying horovod/keras/callbacks.py -> build/lib.linux-x86_64-3.7/horovod/keras
copying horovod/keras/__init__.py -> build/lib.linux-x86_64-3.7/horovod/keras
creating build/lib.linux-x86_64-3.7/horovod/tensorflow
copying horovod/tensorflow/mpi_ops.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow
copying horovod/tensorflow/util.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow
copying horovod/tensorflow/compression.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow
copying horovod/tensorflow/__init__.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow
creating build/lib.linux-x86_64-3.7/horovod/spark/task
copying horovod/spark/task/mpirun_exec_fn.py -> build/lib.linux-x86_64-3.7/horovod/spark/task
copying horovod/spark/task/task_service.py -> build/lib.linux-x86_64-3.7/horovod/spark/task
copying horovod/spark/task/__init__.py -> build/lib.linux-x86_64-3.7/horovod/spark/task
creating build/lib.linux-x86_64-3.7/horovod/spark/driver
copying horovod/spark/driver/driver_service.py -> build/lib.linux-x86_64-3.7/horovod/spark/driver
copying horovod/spark/driver/__init__.py -> build/lib.linux-x86_64-3.7/horovod/spark/driver
copying horovod/spark/driver/mpirun_rsh.py -> build/lib.linux-x86_64-3.7/horovod/spark/driver
copying horovod/spark/driver/job_id.py -> build/lib.linux-x86_64-3.7/horovod/spark/driver
creating build/lib.linux-x86_64-3.7/horovod/torch/mpi_lib
copying horovod/torch/mpi_lib/__init__.py -> build/lib.linux-x86_64-3.7/horovod/torch/mpi_lib
creating build/lib.linux-x86_64-3.7/horovod/torch/mpi_lib_impl
copying horovod/torch/mpi_lib_impl/__init__.py -> build/lib.linux-x86_64-3.7/horovod/torch/mpi_lib_impl
creating build/lib.linux-x86_64-3.7/horovod/run/common
copying horovod/run/common/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/common
creating build/lib.linux-x86_64-3.7/horovod/run/task
copying horovod/run/task/task_service.py -> build/lib.linux-x86_64-3.7/horovod/run/task
copying horovod/run/task/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/task
creating build/lib.linux-x86_64-3.7/horovod/run/util
copying horovod/run/util/threads.py -> build/lib.linux-x86_64-3.7/horovod/run/util
copying horovod/run/util/cache.py -> build/lib.linux-x86_64-3.7/horovod/run/util
copying horovod/run/util/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/util
copying horovod/run/util/network.py -> build/lib.linux-x86_64-3.7/horovod/run/util
creating build/lib.linux-x86_64-3.7/horovod/run/rendezvous
copying horovod/run/rendezvous/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/rendezvous
copying horovod/run/rendezvous/http_server.py -> build/lib.linux-x86_64-3.7/horovod/run/rendezvous
creating build/lib.linux-x86_64-3.7/horovod/run/driver
copying horovod/run/driver/driver_service.py -> build/lib.linux-x86_64-3.7/horovod/run/driver
copying horovod/run/driver/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/driver
creating build/lib.linux-x86_64-3.7/horovod/run/common/service
copying horovod/run/common/service/task_service.py -> build/lib.linux-x86_64-3.7/horovod/run/common/service
copying horovod/run/common/service/driver_service.py -> build/lib.linux-x86_64-3.7/horovod/run/common/service
copying horovod/run/common/service/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/common/service
creating build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/env.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/secret.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/codec.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/timeout.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/safe_shell_exec.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/settings.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/host_hash.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/network.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
creating build/lib.linux-x86_64-3.7/horovod/tensorflow/keras
copying horovod/tensorflow/keras/callbacks.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow/keras
copying horovod/tensorflow/keras/__init__.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow/keras
running build_ext
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -std=c++11 -fPIC -O2 -Wall -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/include -I/home/wyz/.pyenv/versions/3.7.2/include/python3.7m -c build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.cc -o build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.o
gcc -pthread -shared -L/home/wyz/.pyenv/versions/3.7.2/lib -L/home/wyz/.pyenv/versions/3.7.2/lib build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.o -o build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.so
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/include -I/home/wyz/.pyenv/versions/3.7.2/include/python3.7m -c build/temp.linux-x86_64-3.7/test_compile/test_link_flags.cc -o build/temp.linux-x86_64-3.7/test_compile/test_link_flags.o
gcc -pthread -shared -L/home/wyz/.pyenv/versions/3.7.2/lib -L/home/wyz/.pyenv/versions/3.7.2/lib -Wl,--version-script=horovod.lds build/temp.linux-x86_64-3.7/test_compile/test_link_flags.o -o build/temp.linux-x86_64-3.7/test_compile/test_link_flags.so
INFO: Unable to build TensorFlow plugin, will skip it.

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 72, in check_tf_version
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1375, in build_extensions
build_tf_extension(self, options)
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 851, in build_tf_extension
check_tf_version()
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 79, in check_tf_version
'import tensorflow failed, is it installed?\n\n%s' % traceback.format_exc())
distutils.errors.DistutilsPlatformError: import tensorflow failed, is it installed?

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 72, in check_tf_version
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'


gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -std=c++11 -fPIC -O2 -Wall -I/usr/local/include -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,--enable-new-dtags -L/usr/local/lib -lmpi -I/usr/local/include -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,--enable-new-dtags -L/usr/local/lib -lmpi -Ithird_party/HTTPRequest/include -Ithird_party/boost/assert/include -Ithird_party/boost/config/include -Ithird_party/boost/core/include -Ithird_party/boost/detail/include -Ithird_party/boost/iterator/include -Ithird_party/boost/lockfree/include -Ithird_party/boost/mpl/include -Ithird_party/boost/parameter/include -Ithird_party/boost/predef/include -Ithird_party/boost/preprocessor/include -Ithird_party/boost/static_assert/include -Ithird_party/boost/type_traits/include -Ithird_party/boost/utility/include -Ithird_party/eigen -Ithird_party/flatbuffers/include -Ithird_party/lbfgs/include -Ithird_party/gloo -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages/torch/include -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages/torch/include/TH -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/include -I/home/wyz/.pyenv/versions/3.7.2/include/python3.7m -c build/temp.linux-x86_64-3.7/test_compile/test_torch_cuda.cc -o build/temp.linux-x86_64-3.7/test_compile/test_torch_cuda.o
gcc -pthread -shared -L/home/wyz/.pyenv/versions/3.7.2/lib -L/home/wyz/.pyenv/versions/3.7.2/lib build/temp.linux-x86_64-3.7/test_compile/test_torch_cuda.o -o build/temp.linux-x86_64-3.7/test_compile/test_torch_cuda.so
/bin/sh: 1: /usr/lib/gcc: Permission denied
INFO: Unable to determine version of the compiler /usr/lib/gcc.
Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 767, in determine_gcc_version
shell=True, universal_newlines=True).split('\n')
File "/home/wyz/.pyenv/versions/3.7.2/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/home/wyz/.pyenv/versions/3.7.2/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '/usr/lib/gcc -dM -E - </dev/null' returned non-zero exit status 126.

INFO: Unable to build PyTorch plugin, will skip it.

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1389, in build_extensions
build_torch_extension_v2(self, options, torch_version)
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1274, in build_torch_extension_v2
find_matching_gcc_compiler_path(candidate_compiler_version)
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 801, in find_matching_gcc_compiler_path
if compiler_version == gxx_compiler_version:
File "/home/wyz/.pyenv/versions/3.7.2/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/home/wyz/.pyenv/versions/3.7.2/lib/python3.7/distutils/version.py", line 335, in _cmp
if self.version == other.version:
AttributeError: 'NoneType' object has no attribute 'version'

-- The CXX compiler identification is GNU 7.4.0
-- The C compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found MPI_C: /usr/local/lib/libmpi.so (found version "3.1")
-- Found MPI_CXX: /usr/local/lib/libmpi.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- MPI include path: /usr/local/include
-- MPI libraries: /usr/local/lib/libmpi.so
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-c74kecsx/horovod/build/temp.linux-x86_64-3.7/gloo/mxnet
Scanning dependencies of target gloo
[  6%] Building CXX object gloo/CMakeFiles/gloo.dir/allgatherv.cc.o
[  6%] Building CXX object gloo/CMakeFiles/gloo.dir/allgather.cc.o
[  9%] Building CXX object gloo/CMakeFiles/gloo.dir/algorithm.cc.o
[ 12%] Building CXX object gloo/CMakeFiles/gloo.dir/allreduce.cc.o
[ 15%] Building CXX object gloo/CMakeFiles/gloo.dir/allreduce_local.cc.o
[ 18%] Building CXX object gloo/CMakeFiles/gloo.dir/barrier.cc.o
[ 21%] Building CXX object gloo/CMakeFiles/gloo.dir/broadcast.cc.o
[ 24%] Building CXX object gloo/CMakeFiles/gloo.dir/context.cc.o
[ 27%] Building CXX object gloo/CMakeFiles/gloo.dir/gather.cc.o
[ 30%] Building CXX object gloo/CMakeFiles/gloo.dir/reduce.cc.o
[ 36%] Building CXX object gloo/CMakeFiles/gloo.dir/scatter.cc.o
[ 36%] Building CXX object gloo/CMakeFiles/gloo.dir/types.cc.o
[ 39%] Building CXX object gloo/CMakeFiles/gloo.dir/common/linux.cc.o
[ 42%] Building CXX object gloo/CMakeFiles/gloo.dir/common/logging.cc.o
[ 45%] Building CXX object gloo/CMakeFiles/gloo.dir/mpi/context.cc.o
[ 48%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/context.cc.o
[ 51%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/file_store.cc.o
In file included from /tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/mpi/context.cc:16:0:
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/mpi/context.cc: In destructor ‘gloo::mpi::MPIScope::~MPIScope()’:
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/common/logging.h:141:58: warning: throw will always call terminate() [-Wterminate]
r.get_message_and_free(MakeString(__VA_ARGS__))); \
^
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/common/logging.h:150:3: note: in expansion of macro ‘GLOO_ENFORCE_THAT_IMPL’
GLOO_ENFORCE_THAT_IMPL(Equals((x), (y)), #x " == " #y, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/mpi/context.cc:43:3: note: in expansion of macro ‘GLOO_ENFORCE_EQ’
GLOO_ENFORCE_EQ(rv, MPI_SUCCESS);
^~~~~~~~~~~~~~~
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/common/logging.h:141:58: note: in C++11 destructors default to noexcept
r.get_message_and_free(MakeString(__VA_ARGS__))); \
^
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/common/logging.h:150:3: note: in expansion of macro ‘GLOO_ENFORCE_THAT_IMPL’
GLOO_ENFORCE_THAT_IMPL(Equals((x), (y)), #x " == " #y, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/mpi/context.cc:43:3: note: in expansion of macro ‘GLOO_ENFORCE_EQ’
GLOO_ENFORCE_EQ(rv, MPI_SUCCESS);
^~~~~~~~~~~~~~~
[ 54%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/hash_store.cc.o
[ 57%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/prefix_store.cc.o
[ 60%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/store.cc.o
[ 63%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/address.cc.o
[ 66%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/buffer.cc.o
[ 69%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/context.cc.o
[ 72%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/device.cc.o
[ 75%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/pair.cc.o
[ 78%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/unbound_buffer.cc.o
[ 81%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/address.cc.o
[ 84%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/buffer.cc.o
[ 87%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/context.cc.o
[ 90%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/device.cc.o
[ 93%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/pair.cc.o
[ 96%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/unbound_buffer.cc.o
[100%] Linking CXX static library /tmp/pip-install-c74kecsx/horovod/build/temp.linux-x86_64-3.7/lib/mxnet/libgloo.a
[100%] Built target gloo
INFO: Unable to build MXNet plugin, will skip it.

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 88, in check_mx_version
import mxnet as mx
ModuleNotFoundError: No module named 'mxnet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1403, in build_extensions
build_mx_extension(self, options)
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1000, in build_mx_extension
check_mx_version()
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 95, in check_mx_version
'import mxnet failed, is it installed?\n\n%s' % traceback.format_exc())
distutils.errors.DistutilsPlatformError: import mxnet failed, is it installed?

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 88, in check_mx_version
import mxnet as mx
ModuleNotFoundError: No module named 'mxnet'


error: None of TensorFlow, PyTorch, or MXNet plugins were built. See errors above.

----------------------------------------
Failed building wheel for horovod
Running setup.py clean for horovod
Failed to build horovod
Installing collected packages: horovod
Running setup.py install for horovod ... error
Complete output from command /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-c74kecsx/horovod/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-zuqdc9ob/install-record.txt --single-version-externally-managed --compile --install-headers /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/include/site/python3.7/horovod:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/horovod
copying horovod/__init__.py -> build/lib.linux-x86_64-3.7/horovod
creating build/lib.linux-x86_64-3.7/horovod/_keras
copying horovod/_keras/callbacks.py -> build/lib.linux-x86_64-3.7/horovod/_keras
copying horovod/_keras/__init__.py -> build/lib.linux-x86_64-3.7/horovod/_keras
creating build/lib.linux-x86_64-3.7/horovod/spark
copying horovod/spark/__init__.py -> build/lib.linux-x86_64-3.7/horovod/spark
creating build/lib.linux-x86_64-3.7/horovod/mxnet
copying horovod/mxnet/mpi_ops.py -> build/lib.linux-x86_64-3.7/horovod/mxnet
copying horovod/mxnet/__init__.py -> build/lib.linux-x86_64-3.7/horovod/mxnet
creating build/lib.linux-x86_64-3.7/horovod/torch
copying horovod/torch/mpi_ops.py -> build/lib.linux-x86_64-3.7/horovod/torch
copying horovod/torch/compression.py -> build/lib.linux-x86_64-3.7/horovod/torch
copying horovod/torch/__init__.py -> build/lib.linux-x86_64-3.7/horovod/torch
creating build/lib.linux-x86_64-3.7/horovod/common
copying horovod/common/util.py -> build/lib.linux-x86_64-3.7/horovod/common
copying horovod/common/basics.py -> build/lib.linux-x86_64-3.7/horovod/common
copying horovod/common/__init__.py -> build/lib.linux-x86_64-3.7/horovod/common
creating build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/task_fn.py -> build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/mpi_run.py -> build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/run.py -> build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/gloo_run.py -> build/lib.linux-x86_64-3.7/horovod/run
copying horovod/run/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run
creating build/lib.linux-x86_64-3.7/horovod/keras
copying horovod/keras/callbacks.py -> build/lib.linux-x86_64-3.7/horovod/keras
copying horovod/keras/__init__.py -> build/lib.linux-x86_64-3.7/horovod/keras
creating build/lib.linux-x86_64-3.7/horovod/tensorflow
copying horovod/tensorflow/mpi_ops.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow
copying horovod/tensorflow/util.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow
copying horovod/tensorflow/compression.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow
copying horovod/tensorflow/__init__.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow
creating build/lib.linux-x86_64-3.7/horovod/spark/task
copying horovod/spark/task/mpirun_exec_fn.py -> build/lib.linux-x86_64-3.7/horovod/spark/task
copying horovod/spark/task/task_service.py -> build/lib.linux-x86_64-3.7/horovod/spark/task
copying horovod/spark/task/__init__.py -> build/lib.linux-x86_64-3.7/horovod/spark/task
creating build/lib.linux-x86_64-3.7/horovod/spark/driver
copying horovod/spark/driver/driver_service.py -> build/lib.linux-x86_64-3.7/horovod/spark/driver
copying horovod/spark/driver/__init__.py -> build/lib.linux-x86_64-3.7/horovod/spark/driver
copying horovod/spark/driver/mpirun_rsh.py -> build/lib.linux-x86_64-3.7/horovod/spark/driver
copying horovod/spark/driver/job_id.py -> build/lib.linux-x86_64-3.7/horovod/spark/driver
creating build/lib.linux-x86_64-3.7/horovod/torch/mpi_lib
copying horovod/torch/mpi_lib/__init__.py -> build/lib.linux-x86_64-3.7/horovod/torch/mpi_lib
creating build/lib.linux-x86_64-3.7/horovod/torch/mpi_lib_impl
copying horovod/torch/mpi_lib_impl/__init__.py -> build/lib.linux-x86_64-3.7/horovod/torch/mpi_lib_impl
creating build/lib.linux-x86_64-3.7/horovod/run/common
copying horovod/run/common/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/common
creating build/lib.linux-x86_64-3.7/horovod/run/task
copying horovod/run/task/task_service.py -> build/lib.linux-x86_64-3.7/horovod/run/task
copying horovod/run/task/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/task
creating build/lib.linux-x86_64-3.7/horovod/run/util
copying horovod/run/util/threads.py -> build/lib.linux-x86_64-3.7/horovod/run/util
copying horovod/run/util/cache.py -> build/lib.linux-x86_64-3.7/horovod/run/util
copying horovod/run/util/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/util
copying horovod/run/util/network.py -> build/lib.linux-x86_64-3.7/horovod/run/util
creating build/lib.linux-x86_64-3.7/horovod/run/rendezvous
copying horovod/run/rendezvous/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/rendezvous
copying horovod/run/rendezvous/http_server.py -> build/lib.linux-x86_64-3.7/horovod/run/rendezvous
creating build/lib.linux-x86_64-3.7/horovod/run/driver
copying horovod/run/driver/driver_service.py -> build/lib.linux-x86_64-3.7/horovod/run/driver
copying horovod/run/driver/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/driver
creating build/lib.linux-x86_64-3.7/horovod/run/common/service
copying horovod/run/common/service/task_service.py -> build/lib.linux-x86_64-3.7/horovod/run/common/service
copying horovod/run/common/service/driver_service.py -> build/lib.linux-x86_64-3.7/horovod/run/common/service
copying horovod/run/common/service/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/common/service
creating build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/env.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/secret.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/codec.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/timeout.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/__init__.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/safe_shell_exec.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/settings.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/host_hash.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
copying horovod/run/common/util/network.py -> build/lib.linux-x86_64-3.7/horovod/run/common/util
creating build/lib.linux-x86_64-3.7/horovod/tensorflow/keras
copying horovod/tensorflow/keras/callbacks.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow/keras
copying horovod/tensorflow/keras/__init__.py -> build/lib.linux-x86_64-3.7/horovod/tensorflow/keras
running build_ext
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -std=c++11 -fPIC -O2 -Wall -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/include -I/home/wyz/.pyenv/versions/3.7.2/include/python3.7m -c build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.cc -o build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.o
gcc -pthread -shared -L/home/wyz/.pyenv/versions/3.7.2/lib -L/home/wyz/.pyenv/versions/3.7.2/lib build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.o -o build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.so
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/include -I/home/wyz/.pyenv/versions/3.7.2/include/python3.7m -c build/temp.linux-x86_64-3.7/test_compile/test_link_flags.cc -o build/temp.linux-x86_64-3.7/test_compile/test_link_flags.o
gcc -pthread -shared -L/home/wyz/.pyenv/versions/3.7.2/lib -L/home/wyz/.pyenv/versions/3.7.2/lib -Wl,--version-script=horovod.lds build/temp.linux-x86_64-3.7/test_compile/test_link_flags.o -o build/temp.linux-x86_64-3.7/test_compile/test_link_flags.so
INFO: Unable to build TensorFlow plugin, will skip it.

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 72, in check_tf_version
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1375, in build_extensions
build_tf_extension(self, options)
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 851, in build_tf_extension
check_tf_version()
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 79, in check_tf_version
'import tensorflow failed, is it installed?\n\n%s' % traceback.format_exc())
distutils.errors.DistutilsPlatformError: import tensorflow failed, is it installed?

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 72, in check_tf_version
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'


gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -std=c++11 -fPIC -O2 -Wall -I/usr/local/include -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,--enable-new-dtags -L/usr/local/lib -lmpi -I/usr/local/include -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,--enable-new-dtags -L/usr/local/lib -lmpi -Ithird_party/HTTPRequest/include -Ithird_party/boost/assert/include -Ithird_party/boost/config/include -Ithird_party/boost/core/include -Ithird_party/boost/detail/include -Ithird_party/boost/iterator/include -Ithird_party/boost/lockfree/include -Ithird_party/boost/mpl/include -Ithird_party/boost/parameter/include -Ithird_party/boost/predef/include -Ithird_party/boost/preprocessor/include -Ithird_party/boost/static_assert/include -Ithird_party/boost/type_traits/include -Ithird_party/boost/utility/include -Ithird_party/eigen -Ithird_party/flatbuffers/include -Ithird_party/lbfgs/include -Ithird_party/gloo -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages/torch/include -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages/torch/include/TH -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/include -I/home/wyz/.pyenv/versions/3.7.2/include/python3.7m -c build/temp.linux-x86_64-3.7/test_compile/test_torch_cuda.cc -o build/temp.linux-x86_64-3.7/test_compile/test_torch_cuda.o
gcc -pthread -shared -L/home/wyz/.pyenv/versions/3.7.2/lib -L/home/wyz/.pyenv/versions/3.7.2/lib build/temp.linux-x86_64-3.7/test_compile/test_torch_cuda.o -o build/temp.linux-x86_64-3.7/test_compile/test_torch_cuda.so
/bin/sh: 1: /usr/lib/gcc: Permission denied
INFO: Unable to determine version of the compiler /usr/lib/gcc.
Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 767, in determine_gcc_version
shell=True, universal_newlines=True).split('\n')
File "/home/wyz/.pyenv/versions/3.7.2/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/home/wyz/.pyenv/versions/3.7.2/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '/usr/lib/gcc -dM -E - </dev/null' returned non-zero exit status 126.

INFO: Unable to build PyTorch plugin, will skip it.

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1389, in build_extensions
build_torch_extension_v2(self, options, torch_version)
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1274, in build_torch_extension_v2
find_matching_gcc_compiler_path(candidate_compiler_version)
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 801, in find_matching_gcc_compiler_path
if compiler_version == gxx_compiler_version:
File "/home/wyz/.pyenv/versions/3.7.2/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/home/wyz/.pyenv/versions/3.7.2/lib/python3.7/distutils/version.py", line 335, in _cmp
if self.version == other.version:
AttributeError: 'NoneType' object has no attribute 'version'

-- The CXX compiler identification is GNU 7.4.0
-- The C compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found MPI_C: /usr/local/lib/libmpi.so (found version "3.1")
-- Found MPI_CXX: /usr/local/lib/libmpi.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- MPI include path: /usr/local/include
-- MPI libraries: /usr/local/lib/libmpi.so
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-c74kecsx/horovod/build/temp.linux-x86_64-3.7/gloo/mxnet
Scanning dependencies of target gloo
[  6%] Building CXX object gloo/CMakeFiles/gloo.dir/allreduce.cc.o
[  6%] Building CXX object gloo/CMakeFiles/gloo.dir/allgather.cc.o
[  9%] Building CXX object gloo/CMakeFiles/gloo.dir/algorithm.cc.o
[ 12%] Building CXX object gloo/CMakeFiles/gloo.dir/allgatherv.cc.o
[ 15%] Building CXX object gloo/CMakeFiles/gloo.dir/allreduce_local.cc.o
[ 18%] Building CXX object gloo/CMakeFiles/gloo.dir/barrier.cc.o
[ 21%] Building CXX object gloo/CMakeFiles/gloo.dir/broadcast.cc.o
[ 24%] Building CXX object gloo/CMakeFiles/gloo.dir/context.cc.o
[ 27%] Building CXX object gloo/CMakeFiles/gloo.dir/gather.cc.o
[ 30%] Building CXX object gloo/CMakeFiles/gloo.dir/reduce.cc.o
[ 33%] Building CXX object gloo/CMakeFiles/gloo.dir/scatter.cc.o
[ 36%] Building CXX object gloo/CMakeFiles/gloo.dir/types.cc.o
[ 39%] Building CXX object gloo/CMakeFiles/gloo.dir/common/linux.cc.o
[ 42%] Building CXX object gloo/CMakeFiles/gloo.dir/common/logging.cc.o
[ 45%] Building CXX object gloo/CMakeFiles/gloo.dir/mpi/context.cc.o
[ 48%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/context.cc.o
[ 51%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/file_store.cc.o
In file included from /tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/mpi/context.cc:16:0:
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/mpi/context.cc: In destructor ‘gloo::mpi::MPIScope::~MPIScope()’:
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/common/logging.h:141:58: warning: throw will always call terminate() [-Wterminate]
r.get_message_and_free(MakeString(__VA_ARGS__))); \
^
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/common/logging.h:150:3: note: in expansion of macro ‘GLOO_ENFORCE_THAT_IMPL’
GLOO_ENFORCE_THAT_IMPL(Equals((x), (y)), #x " == " #y, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/mpi/context.cc:43:3: note: in expansion of macro ‘GLOO_ENFORCE_EQ’
GLOO_ENFORCE_EQ(rv, MPI_SUCCESS);
^~~~~~~~~~~~~~~
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/common/logging.h:141:58: note: in C++11 destructors default to noexcept
r.get_message_and_free(MakeString(__VA_ARGS__))); \
^
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/common/logging.h:150:3: note: in expansion of macro ‘GLOO_ENFORCE_THAT_IMPL’
GLOO_ENFORCE_THAT_IMPL(Equals((x), (y)), #x " == " #y, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~
/tmp/pip-install-c74kecsx/horovod/third_party/gloo/gloo/mpi/context.cc:43:3: note: in expansion of macro ‘GLOO_ENFORCE_EQ’
GLOO_ENFORCE_EQ(rv, MPI_SUCCESS);
^~~~~~~~~~~~~~~
[ 54%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/hash_store.cc.o
[ 57%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/prefix_store.cc.o
[ 60%] Building CXX object gloo/CMakeFiles/gloo.dir/rendezvous/store.cc.o
[ 63%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/address.cc.o
[ 66%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/buffer.cc.o
[ 69%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/context.cc.o
[ 72%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/device.cc.o
[ 75%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/pair.cc.o
[ 78%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/unbound_buffer.cc.o
[ 81%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/address.cc.o
[ 84%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/buffer.cc.o
[ 87%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/context.cc.o
[ 90%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/device.cc.o
[ 93%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/pair.cc.o
[ 96%] Building CXX object gloo/CMakeFiles/gloo.dir/transport/tcp/unbound_buffer.cc.o
[100%] Linking CXX static library /tmp/pip-install-c74kecsx/horovod/build/temp.linux-x86_64-3.7/lib/mxnet/libgloo.a
[100%] Built target gloo
INFO: Unable to build MXNet plugin, will skip it.

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 88, in check_mx_version
import mxnet as mx
ModuleNotFoundError: No module named 'mxnet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1403, in build_extensions
build_mx_extension(self, options)
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 1000, in build_mx_extension
check_mx_version()
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 95, in check_mx_version
'import mxnet failed, is it installed?\n\n%s' % traceback.format_exc())
distutils.errors.DistutilsPlatformError: import mxnet failed, is it installed?

Traceback (most recent call last):
File "/tmp/pip-install-c74kecsx/horovod/setup.py", line 88, in check_mx_version
import mxnet as mx
ModuleNotFoundError: No module named 'mxnet'


error: None of TensorFlow, PyTorch, or MXNet plugins were built. See errors above.

----------------------------------------
Command "/home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-c74kecsx/horovod/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-zuqdc9ob/install-record.txt --single-version-externally-managed --compile --install-headers /home/wyz/.pyenv/versions/3.7.2/envs/env-3.7.2/include/site/python3.7/horovod" failed with error code 1 in /tmp/pip-install-c74kecsx/horovod/

# Fixed code
def find_matching_gcc_compiler_path(gxx_compiler_version):
    for path_dir, bin_file in enumerate_binaries_in_path():
        if re.match("^gcc(?:-\\d+(?:\\.\\d+)*)?$", bin_file):
            # gcc, or gcc-7, gcc-4.9, or gcc-4.8.5
            compiler = os.path.join(path_dir, bin_file)
            compiler_version = determine_gcc_version(compiler)
            if compiler_version and compiler_version == gxx_compiler_version:
                return compiler

    print("INFO: Unable to find gcc compiler (version %s)." % gxx_compiler_version)
    return None