pythonpytorchhorovod

pip install horovod fails on conda + OSX 10.14


Running pip install horovod in a conda environment with pytorch installed resulted in

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

where the root problem near the top of stdout is

ld: library not found for -lstdc++ clang: error: linker command failed with exit code 1 (use -v to see invocation) INFO: Unable to build PyTorch plugin, will skip it.


Solution

  • CFLAGS=-mmacosx-version-min=10.9 pip install horovod, inspired from this seemingly unrelated Horovod issue.

    This issue thread from pandas has a nice explanation:

    The compiler standard library defaults to either libstdc++ or libc++, depending on the targetted macOS version - libstdc++ for 10.8 and below, and libc++ for 10.9 and above. This is determined by the environment variable MACOSX_DEPLOYMENT_TARGET or the compiler option-mmacosx-version-min, defaulting to the system version otherwise.

    When distuils builds extensions on macOS, it setsMACOSX_DEPLOYMENT_TARGET to the version that python was compiled with, even if the host system / Xcode is newer.

    Recent macOS versions of python have a 64-bit only variant built for 10.9 (python.org), and a universal 64/32-bit variant built for 10.6 (python.org) or 10.7 (conda). I am running the conda universal variant, so distutils targets macOS 10.7, despite my system being 10.14, with Xcode 10 which doesn't install libstdc++.