Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with pip install numpy - RuntimeError: Broken toolchain: cannot link a simple C program

For Docker (Alpine) and Python 3.x this worked for me:

RUN apk update
RUN apk add make automake gcc g++ subversion python3-dev

While it's ugly, it appears to work

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install --upgrade numpy

Note that if you are getting this error for a package other than numpy, (such as lxml) specify that package name instead of numpy at the end of the commnd.

I saw a similar issue someone was having with installing a gem

Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'

This is only a temporary fix, at some point the compiler options will have to be fixed


The problem is that you are unable to compile.

First, make sure that you have accepted the new Terms and Conditions with Xcode. To do this, just open up xCode and accept.

Then, try installing gcc with

brew install gcc

Finally, try to install Numpy with

pip install numpy

Hope this helps.


If you don't want to use sudo (so permissions and things like that are preserved when using venv), you can add the ARCHFLAGS declaration to your .bash_profile, and run as normal. This worked for me with Mavericks and Xcode 5.1 using with venv:

In ~/.bash_profile:

export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

Then, just run the command:

pip install --upgrade numpy


If you are running a linux distribution, you may need a C compiler, especially if you see telltale log lines like sh: gcc: command not found. You can follow the instructions here, which I've summarized below:

  • Fedora, Red Hat, CentOS, or Scientific Linux

    # yum groupinstall 'Development Tools'

  • Debian or Ubuntu Linux

    $ sudo apt-get update $ sudo apt-get install build-essential manpages-dev

Then you can try rerunning:

sudo pip install numpy