11

I'm unable to install Numba (via pip) on my OS X system.

I'm using

  • Python: 2.7.11 (Homebrew)
  • pip: 8.1.1
  • setuptools: 20.6.7
  • OS X: 10.11.4 (x86_64)
  • Xcode: 7.3
  • Xcode CLT: 7.3.0.0.1.1457485338
  • Clang: 7.3 build 703

and have installed the prerequisites (I think) with

brew install llvm
git clone https://github.com/numba/llvmlite
cd llvmlite
LLVM_CONFIG=/usr/local/opt/llvm/bin/llvm-config  python setup.py install
cd ..
rm -rf llvmlite

and also tried

brew install llvm
brew link --force llvm  # later: brew unlink llvm
cd /usr/local/Cellar/llvm/X.X.X/include/llvm/Config/ # X.X.X = 3.6.2
ln -s llvm-config.h config.h

but I then

pip install numba

gives

  Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Successfully built numba
Failed to build llvmlite
Installing collected packages: llvmlite, numba
  Running setup.py install for llvmlite ... 
  [...]        
    error: option --single-version-externally-managed not recognized

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-build-MY_vtC/llvmlite/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-yoGGZY-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-build-MY_vtC/llvmlite/

I'm stumped about how to proceed (without Conda!) and wonder if there's some simple fix I'm missing.

orome
  • 45,163
  • 57
  • 202
  • 418
  • Have you tried [with the `--egg` option](http://stackoverflow.com/questions/14296531/what-does-error-option-single-version-externally-managed-not-recognized-ind)? – alecxe Apr 03 '16 at 13:09
  • @alecxe: Same error. And there's no reason that should be the issue with latest setuptools, should it? – orome Apr 03 '16 at 13:11
  • Have you try with conda ? it's generally simpler. – B. M. Apr 04 '16 at 17:14
  • @B.M.: That's clear from the docs, But I don't use Conda (for now) and need a solution without it. – orome Apr 04 '16 at 17:18
  • As the error says, you can try setting `LLVM_CONFIG`. If you installed llvm via homebrew, the default path is `/usr/local/opt/llvm/bin/llvm-config` – Ismail Badawi Apr 04 '16 at 22:07
  • @IsmailBadawi: I get the same error in the end when I `LLVM_CONFIG=/usr/local/opt/llvm/bin/llvm-config pip install numba`. – orome Apr 04 '16 at 22:28
  • Check out `https://github.com/numba/llvmlite/issues/55`. Try `brew link llvm --force` and `ln -s /usr/local/Cellar/llvm/3.6.1/include/llvm/Config/llvm-config.h config.h` and try again? – donkey Apr 04 '16 at 23:59
  • @oasisweng: Same error (see edit). (And while `brew link` adds 159 symlinks, `brew unlink` removes 161, which is worrying.) – orome Apr 05 '16 at 12:39

3 Answers3

16

Here's what worked for me (with Homebrew Python on OS X 10.11.4):

brew install homebrew/versions/llvm37 --with-rtti
git clone https://github.com/numba/llvmlite
cd llvmlite
LLVM_CONFIG=/usr/local/Cellar/llvm37/3.7.1/bin/llvm-config-3.7 python setup.py install
LLVM_CONFIG=/usr/local/Cellar/llvm37/3.7.1/bin/llvm-config-3.7 pip install numba
rm -rf llvmlite
orome
  • 45,163
  • 57
  • 202
  • 418
  • 2
    In my case it said llvm 3.8.x is required. So I used `brew install homebrew/versions/llvm38 --with-rtti` and `LLVM_CONFIG=/usr/local/Cellar/llvm38/3.8.0/bin/llvm-config-3.8 python setup.py install` etc. But solution is the same, thx. – fdelia Aug 03 '16 at 08:20
1

Or you can use homebrew:

brew install homebrew/python/numba
Tickon
  • 1,058
  • 1
  • 16
  • 25
0

The easiest way is to install miniconda than do:

conda install numba

Works perfectly on Mac (and other platforms).

I would recommend to create a new environment first:

conda create -n my_numba_env

activate it:

source activate my_numba_env

and install numba:

conda install numba
Mike Müller
  • 82,630
  • 20
  • 166
  • 161
  • 2
    No Conda. Will mimiconda work alongside Homebrew (and Homebrew Python?) and alongside parts of the Anaconda stack installed using (Homebrew) pip? – orome Apr 05 '16 at 12:50
  • I'm aware that I can always create new environment to solve any installation problems. That's not (ever, I think) the question in these cases. – orome Apr 05 '16 at 12:52
  • I found that creating a new environment is a great time safer. No worries to break anything. Paying with a few MB of disk space is a very good trade-off here. – Mike Müller Apr 05 '16 at 12:56
  • 1
    Yes, that's well known. But it sets up an infinite regress. What about a solution that does *not* involve Conda (as stated) or setting up a new environment (which solves *every* problem)? – orome Apr 05 '16 at 13:46
  • [Can I install Conda (as miniconda) inside a regular virtualenv](http://stackoverflow.com/q/36485175/656912) and expect it to leave everything outside the virtualenv alone? – orome Apr 07 '16 at 19:14
  • Conda messes up everything else in my python setup but it works – kilojoules Mar 30 '17 at 20:02