11

I'm completely new to Python, I'm trying to install NLTK based on http://nltk.org/install.html

I've got everything installed except for numpy (it says numpy is optional but when I try to import nltk, it says there's an error because it couldn't find the numpy module)

after I run sudo pip install -U numpy

I'm running on a Mac with Mountain Lion, python v2.7.3

I get the following error (I only included the end of log):

File "/private/tmp/pip-build/numpy/numpy/core/setup.py", line 696, in get_mathlib_info

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

RuntimeError: Broken toolchain: cannot link a simple C program


Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/numpy

Has anyone seen this happen?

Community
  • 1
  • 1
Art
  • 223
  • 2
  • 8
  • Does it act happy enough about compiling the programs? i.e. Do you have a compiler installed and configured properly? – mgilson Oct 26 '12 at 18:49
  • 4
    If you use the OS X system Python 2.7 (`/usr/bin/python2.7`), Apple already includes versions of `setuptools` and `numpy` with it so you wouldn't need to install them with that Python. – Ned Deily Oct 26 '12 at 18:54

3 Answers3

2

If you open a command prompt and type gcc does it run without error? If not, you may need to install XCode (available on the appstore) and then the command line tools (it looks similar to this post) so that you can complete the install for numpy.

Community
  • 1
  • 1
AlG
  • 14,697
  • 4
  • 41
  • 54
2

Recently I had been seeing this along with:

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

See here to fix:

clang error: unknown argument: '-mno-fused-madd' (python package installation failure)

Community
  • 1
  • 1
JTE
  • 1,301
  • 12
  • 14
1

Looks to me like this question has already been answered here: Problems with pip install numpy - RuntimeError: Broken toolchain: cannot link a simple C program

Setting ARCHFLAGS enabled me to install numpy (running Mavericks with Command Line tools 5.1.1):

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

Community
  • 1
  • 1
Nate
  • 629
  • 6
  • 10