IT TIP

pip install numpy 관련 문제-RuntimeError : Broken toolchain : cannot link a simple C program

itqueen 2020. 10. 18. 19:53
반응형

pip install numpy 관련 문제-RuntimeError : Broken toolchain : cannot link a simple C program


virturalenv에 numpy (및 scipy 및 matplotlib)를 설치하려고합니다.

그래도 이러한 오류가 계속 발생합니다.

RuntimeError: Broken toolchain: cannot link a simple C program

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1

xcode 용 명령 줄 도구가 설치되어 있습니다.

$ which gcc
/usr/bin/gcc
$ which cc
/usr/bin/cc

저는 Mac OSX 10.9에서 brew 설치된 Python을 사용하고 있습니다.

편집
예, pip로 설치하려고합니다.
전체 역 추적은 거대합니다 (> 400 줄).

다음은 그 섹션입니다.

C compiler: cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe



compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c'

cc: _configtest.c

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

failure.

removing: _configtest.c _configtest.o

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/Users/bdhammel/Documents/research_programming/julia_env/build/numpy/setup.py", line 192, in <module>

    setup_package()

  File "/Users/bdhammel/Documents/research_programming/julia_env/build/numpy/setup.py", line 185, in setup_package

    configuration=configuration )

  File "/Users/bdhammel/Documents/research_programming/julia_env/build/numpy/numpy/distutils/core.py", line 169, in setup

    return old_setup(**new_attr)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands

    self.run_command(cmd)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/Users/bdhammel/Documents/research_programming/julia_env/build/numpy/numpy/distutils/command/egg_info.py", line 10, in run

    self.run_command("build_src")

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command

    self.distribution.run_command(command)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/Users/bdhammel/Documents/research_programming/julia_env/build/numpy/numpy/distutils/command/build_src.py", line 153, in run

    self.build_sources()

  File "/Users/bdhammel/Documents/research_programming/julia_env/build/numpy/numpy/distutils/command/build_src.py", line 164, in build_sources

    self.build_library_sources(*libname_info)

  File "/Users/bdhammel/Documents/research_programming/julia_env/build/numpy/numpy/distutils/command/build_src.py", line 299, in build_library_sources

    sources = self.generate_sources(sources, (lib_name, build_info))

  File "/Users/bdhammel/Documents/research_programming/julia_env/build/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources

    source = func(extension, build_dir)

  File "numpy/core/setup.py", line 674, in get_mathlib_info

    raise RuntimeError("Broken toolchain: cannot link a simple C program")

RuntimeError: Broken toolchain: cannot link a simple C program

추악하지만 작동하는 것처럼 보입니다.

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

numpy 이외의 패키지 (예 : lxml)에 대해이 오류가 발생하는 경우 명령 numpy대신 해당 패키지 이름을 지정 하십시오.

누군가가 gem을 설치하는 것과 비슷한 문제를 보았습니다.

Ruby Gem 설치 Json이 Mavericks 및 Xcode 5.1에서 실패-알 수없는 인수 : '-multiply_definedsuppress'

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


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

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

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


I simply had to open XCode and accept the agreement and let it install the tools. I then went back to PyCharm and installed numpy again with no issues.


For fedora users that are having a similar problem try installing these packeges:

(if not using python3 use python-devel and pip instead of pip3)

sudo dnf install python3-devel
sudo dnf install make automake gcc gcc-c++ gcc-gfortran
sudo dnf install redhat-rpm-config
sudo dnf install subversion

then try

sudo pip3 install 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

In some cases after OS X upgrades XCode, XCode will require the user (with administrative privileges) to accept a new license. Until the license is accepted, clang and gcc will issue an error when attempting to compile and link code. Or at least python packages.

If you launch XCode and accept the license, the errors no longer appear.

At least, this was the case for me.


The above worked for me only after installing python3-dev.


This means it can't find your C compiler. Try installing the gcc compiler if linking other compiler fails.


On Fedora 22 this was resolved by updating pip itself: sudo pip install --upgrade pip

참고URL : https://stackoverflow.com/questions/22388519/problems-with-pip-install-numpy-runtimeerror-broken-toolchain-cannot-link-a

반응형