Getting python Numba working on Ubuntu 14.10 or Fedora 21 with python 2.7

 ̄綄美尐妖づ 提交于 2019-11-27 14:26:35

问题


Recently, I have had a frustrating time to get python Numba working on Ubuntu or Fedora Linux. The main problem has been with the compilation of llvmlite. What do I need to install for these to compile properly?


回答1:


The versions I got working at the end were numba-0.17.0 (also 0.18.2) and llvmlite-0.2.2 (also 0.4.0). Here are the relevant dependencies and configuration options on Ubuntu and Fedora.

For Ubuntu 14.04 *Trusty)

sudo apt-get install zlib1g zlib1g-dev libedit libedit-dev llvm-3.8 llvm-3.8-dev llvm-dev
sudo pip install enum34 funcsigs
LLVM_CONFIG=/usr/bin/llvm-config-3.8 pip install llvmlite --user
LLVM_CONFIG=/usr/bin/llvm-config-3.8 pip install numba --user

For Ubuntu 14.10

sudo apt-get install zlib1g zlib1g-dev libedit libedit-dev llvm-3.5 llvm-3.5-dev llvm-dev
pip install enum34 funcsigs
LLVM_CONFIG=/usr/bin/llvm-config-3.5 pip install llvmlite
LLVM_CONFIG=/usr/bin/llvm-config-3.5 pip install numba

For Ubuntu 15.04

sudo apt-get install zlib1g zlib1g-dev libedit2 libedit-dev llvm-3.6 llvm-3.6-dev llvm-dev
pip install enum34 funcsigs
LLVM_CONFIG=/usr/bin/llvm-config-3.6 pip install llvmlite
LLVM_CONFIG=/usr/bin/llvm-config-3.6 pip install numba

For Fedora 21

yum install zlib zlib-devel libstdc++-devel libstdc++ libstdc++-static llvm-3.5.0 llvm-devel-3.5.0 libedit libedit-devel
pip install enum34 funcsigs
LLVM_CONFIG=/usr/bin/llvm-config pip install llvmlite
LLVM_CONFIG=/usr/bin/llvm-config pip install numba

Note: this was originally posted by the OP in the question—moved here to keep this fit for SO.




回答2:


For ubuntu 15.10

fisrt check that pip has the correct version:

pip install --upgrade pip
pip install --upgrade wheel

pip >= 8.1

$ pip --version
pip 8.1.1 from
$ wheel version
wheel 0.29.0

apt-get install llvm stuff:

sudo apt-get install zlib1g zlib1g-dev libedit2 libedit-dev
sudo apt-get install llvm-3.7 llvm-3.7-dev llvm-dev

and then with pip (warning llvmlite work only with llvm 3.7):

pip install enum34 funcsigs
LLVM_CONFIG=/usr/bin/llvm-config-3.7 pip install llvmlite
LLVM_CONFIG=/usr/bin/llvm-config-3.7 pip install numba



回答3:


Ubuntu 15.10 using Python 3.4.3+

llvmlite version 0.9 or newer (I installed 0.10)

As stated in llvmlite's GitHub Page:

As of version 0.9, llvmlite requires LLVM 3.7. It does not support earlier or later versions of LLVM.

My solution, similar to the ones in other answers (but regarding python3):

To meet the dependencies: (like libedit and compression libraries)

sudo apt-get install zlib1g zlib1g-dev libedit2 libedit-dev
sudo pip3 install enum34 funcsigs

llvm-3.7 (Other answers included llvm package, which nowadays installs version 3.6, not working)

sudo apt-get install llvm-3.7 llvm-3.7-dev llvm-3.7-runtime llvm-3.7-tools

Trying to install llvmlite from pip:

sudo pip3 install llvmlite

(If it works, skip this) If it doesn't work, like in my case, build the last master branch from their repository:

git clone https://github.com/numba/llvmlite
cd llvmlite/
sudo ch -c "LLVM_CONFIG=/usr/bin/config-3.7 python3 setup.py build
sudo sh -c "LLVM_CONFIG=/usr/bin/llvm-config-3.7 python3 setup.py install"

Finally, install numba:

sudo pip3 install numba



回答4:


There was a change in llvmlite. Since version llvmlite-0.6.0 llvm-3.6 is required. The correct installation is now:

sudo apt-get install zlib1g zlib1g-dev libedit2 libedit-dev llvm-3.6 llvm-3.6-dev llvm-dev
pip install enum34 funcsigs
LLVM_CONFIG=/usr/bin/llvm-config-3.6 pip install llvmlite
LLVM_CONFIG=/usr/bin/llvm-config-3.6 pip install numba



回答5:


Initially I didn't get it working with the comments here and then I found out: 1. meanwhile llvm 3.6 instead of 3.5 is needed and 2. for me the LLVM_CONFIG env variable doesn't work. So I installed numba like this:

sudo apt-get install zlib1g zlib1g-dev libedit-dev llvm-3.6 llvm-3.6-dev llvm-3.6-runtime llvm-3.6-tools
sudo pip install enum34 funcsigs
sudo mv /usr/bin/llvm-config /usr/bin/llvm-config_bak
sudo ln -s /usr/bin/llvm-config-3.6 /usr/bin/llvm-config
sudo pip install llvmlite
sudo pip install numba
sudo mv /usr/bin/llvm-config_bak /usr/bin/llvm-config

(Tried on Ubuntu 14.04.)




回答6:


For Fedora 23

First check that you have the latest pip version:

pip install -U pip
pip install -U wheel

Then install the following pacakges:

dnf install zlib zlib-devel libstdc++-devel libstdc++ libstdc++-static llvm-3.7.0 llvm-devel-3.7.0 libedit libedit-devel
pip install enum34 funcsigs

Then download and unzip llvmlite from the GIT repository. Suppose that you are downloading to /usr/local/llvmlite then:

git clone <address-for-llvmlite.git> /usr/local/llvmlite
cd /usr/local/llvmlite

Build source as described here:

LLVM_CONFIG=/usr/bin/llvm-config python setupy.py build

Refresh terminal session and install built llvmlite

reset
LLVM_CONFIG=/usr/bin/llvm-config python setup.py install

Finally download and install numba by

pip install numba    



回答7:


For Ubuntu 16.04:

LLVM_CONFIG=/usr/bin/llvm-config-3.7 pip install llvmlite



回答8:


For Ubuntu 16.04

sudo pip3 install llvmlite

explicitly requests llvm version 3.9.

But in the official packages, there is (currently) only llvm up to version 3.8. The solution is to install it like this

Then you can run LLVM_CONFIG=/usr/bin/llvm-config-3.9 sudo pip3 install llvmlite




回答9:


In case anyone else recently had this problem, according to their github page...

"llvmlite works with Python 2.7 and Python 3.4 or greater. As of version 0.17.0, llvmlite requires LLVM 4.0. It does not support earlier or later versions of LLVM.

They have a compatibility table of what works with what. All recent packages can be gotten from their webpage.




回答10:


For Ubuntu 14.04 I managed to install with this:

export LDFLAGS="-std=gnu++11 -fPIC"

LLVM_CONFIG=/usr/bin/llvm-config-7 pip install llvmlite

LLVM_CONFIG=/usr/bin/llvm-config-7 pip install numba


来源:https://stackoverflow.com/questions/28782512/getting-python-numba-working-on-ubuntu-14-10-or-fedora-21-with-python-2-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!