pythonanacondatravis-cipytestfaulthandler

Anaconda failed building wheel for faulthandler on TravisCI for python 2.7


I'm using TravisCI to run my unit tests for python 2.7, 3.4, 3.5 and 3.6. My .travis.yml file includes the line - pip install pytest-faulthandler, which until 2 days ago gave me no issues. Then, yesterday, for no apparent reason, this line started causing the Travis build to crash with error:

The command "pip install pytest-faulthandler" failed and exited with 1 during .

This in turn seems to stem from a bad path to gcc (set by anaconda?):

unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory

Detailed error log below. As far as I can tell I haven't changed anything to my configuration (travis.yml, setup.cfg, setup.py) that could influence this. The problem only happens for python 2.7, for 3.4-3.6 travis builds the environment without any issues.

I've tried searching online to see if anyone's experienced/solved this issue already, but no luck. Any suggestions/advice would be most welcome. Thanks!

Travis error log below, the complete build log can be found here.

Collecting pytest-faulthandler
  Downloading pytest_faulthandler-1.3.1-py2.py3-none-any.whl
Collecting pytest>=2.6 (from pytest-faulthandler)
  Downloading pytest-3.2.2-py2.py3-none-any.whl (187kB)
    100% |████████████████████████████████| 194kB 4.7MB/s 
Collecting faulthandler; python_version == "2.6" or python_version == "2.7" (from pytest-faulthandler)
  Downloading faulthandler-3.0.tar.gz (55kB)
    100% |████████████████████████████████| 61kB 8.7MB/s 
Requirement already satisfied: setuptools in /home/travis/miniconda/envs/test-environment/lib/python2.7/site-packages (from pytest>=2.6->pytest-faulthandler)
Collecting py>=1.4.33 (from pytest>=2.6->pytest-faulthandler)
  Using cached py-1.4.34-py2.py3-none-any.whl
Building wheels for collected packages: faulthandler
  Running setup.py bdist_wheel for faulthandler ... error
  Complete output from command /home/travis/miniconda/envs/test-environment/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wI1YGd/faulthandler/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/tmpyGVM8Opip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_ext
  building 'faulthandler' extension
  creating build
  creating build/temp.linux-x86_64-2.7
  x86_64-conda_cos6-linux-gnu-gcc -pthread -fno-strict-aliasing -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/travis/miniconda/envs/test-environment/include/python2.7 -c faulthandler.c -o build/temp.linux-x86_64-2.7/faulthandler.o
  unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory
  error: command 'x86_64-conda_cos6-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for faulthandler
  Running setup.py clean for faulthandler
Failed to build faulthandler
Installing collected packages: py, pytest, faulthandler, pytest-faulthandler
  Running setup.py install for faulthandler ... error
    Complete output from command /home/travis/miniconda/envs/test-environment/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wI1YGd/faulthandler/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-lKAMMU-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'faulthandler' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    x86_64-conda_cos6-linux-gnu-gcc -pthread -fno-strict-aliasing -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/travis/miniconda/envs/test-environment/include/python2.7 -c faulthandler.c -o build/temp.linux-x86_64-2.7/faulthandler.o
    unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory
    error: command 'x86_64-conda_cos6-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/travis/miniconda/envs/test-environment/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wI1YGd/faulthandler/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-lKAMMU-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-wI1YGd/faulthandler/
The command "pip install pytest-faulthandler" failed and exited with 1 during .
Your build has been stopped.

Solution

  • After additional searching I found this related post, following which I replaced the miniconda version in .travis.yml to Miniconda2-4.3.21-Linux-x86_64.sh for Python 2 and Miniconda3-4.3.21-Linux-x86_64.sh for Python 3, and prevented conda from updating by commenting out - conda update -q conda. This time my environment built correctly for all python versions, problem fixed.

    As noted in the linked post, this seems like a bug in the installation script for Anaconda (and miniconda) 4.3.27, and the solution is to use an earlier version (e.g. 4.3.21) and prevent conda from updating.