llvmlite: Installer doesn't create llvmlite/binding/libllvmlite.so library in venv

My setup: Python 3.5.2, virtualenv, Ubuntu xenial, llvm 4.0, newest pip and distutils:

(env) skodajan@jan:/tmp$ LLVM_CONFIG=/usr/bin/llvm-config-4.0 pip install llvmlite
Collecting llvmlite
  Using cached llvmlite-0.17.0.tar.gz
Installing collected packages: llvmlite
  Running setup.py install for llvmlite ... done
Successfully installed llvmlite-0.17.0
(env) skodajan@jan:/tmp$ ls env/lib/python3.5/site-packages/llvmlite/binding/
analysis.py  dylib.py            ffi.py       __init__.py  module.py       options.py       __pycache__                            targets.py     value.py
common.py    executionengine.py  initfini.py  linker.py    object_file.py  passmanagers.py  _stub.cpython-35m-x86_64-linux-gnu.so  transforms.py

Once I install numba, the import numba fails:

(env) skodajan@jan:/tmp$ pip install numba
Collecting numba
Collecting numpy (from numba)
  Using cached numpy-1.12.1-cp35-cp35m-manylinux1_x86_64.whl
Requirement already satisfied: llvmlite in ./env/lib/python3.5/site-packages (from numba)
Installing collected packages: numpy, numba
Successfully installed numba-0.32.0 numpy-1.12.1
(env) skodajan@jan-skoda:/tmp$ python -c 'import numba'
Traceback (most recent call last):
  File "/tmp/env/lib/python3.5/site-packages/llvmlite/binding/ffi.py", line 42, in <module>
    lib = ctypes.CDLL(os.path.join(_lib_dir, _lib_name))
  File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /tmp/env/lib/python3.5/site-packages/llvmlite/binding/libllvmlite.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/env/lib/python3.5/site-packages/numba/__init__.py", line 9, in <module>
    from . import config, errors, runtests, types
  File "/tmp/env/lib/python3.5/site-packages/numba/config.py", line 11, in <module>
    import llvmlite.binding as ll
  File "/tmp/env/lib/python3.5/site-packages/llvmlite/binding/__init__.py", line 6, in <module>
    from .dylib import *
  File "/tmp/env/lib/python3.5/site-packages/llvmlite/binding/dylib.py", line 4, in <module>
    from . import ffi
  File "/tmp/env/lib/python3.5/site-packages/llvmlite/binding/ffi.py", line 47, in <module>
    lib = ctypes.CDLL(_lib_name)
  File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libllvmlite.so: cannot open shared object file: No such file or directory

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I have a similar problem with the following setup: MacOS 10.11.3, Python 3.6.0 virtual environment, explicitly specified environment variables LLVM_CONFIG and MACOSX_DEPLOYMENT_TARGET. Running pip install llvmlite --upgrade attempts to install llvm 0.17.1, but then throws the following error:

Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/k9/mxm_jrl50m75kmgvdk9_wlh00000gp/T/pip-build-1bk4oqiv/llvmlite/setup.py", line 175, in <module>
      ext_modules=[ext_stub] if not sys.platform.startswith('win32') else [],
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/private/var/folders/k9/mxm_jrl50m75kmgvdk9_wlh00000gp/T/pip-build-1bk4oqiv/llvmlite/setup.py", line 119, in run
      raise RuntimeError("missing {}".format(path))
  RuntimeError: missing llvmlite/binding/libllvmlite.dylib

(installation then proceeds to install llvmlite, however the installed module is not usable)

@leftys , I am temporarily hosting the wheel on anaconda.org. You need to install it with the following command:

pip install -i https://pypi.anaconda.org/sklam/simple llvmlite

If you can confirm it working, I will move it to PyPI.

(Note: I have to stage it in anaconda.org because PyPI won’t allow a file to be re-uploaded)

@s-sajid-ali I’m not sure how you are building llvmlite or numba, but: OSError: /home/sajid/packages/spack/opt/spack/linux-centos7-x86_64/gcc-8.1.0/py-llvmlite-0.23.0-lkunh6e6xynqv3vzacjxeipgpftpkjwc/lib/python3.6/site-packages/llvmlite/binding/libllvmlite.so: undefined symbol: LLVMInitializeInstCombine suggests that the patch here: https://github.com/numba/llvmlite/blob/master/conda-recipes/0001-Transforms-Add-missing-header-for-InstructionCombini.patch has not been applied to LLVM.

The following patch seems to work here: https://gist.github.com/pitrou/d9cd92c461bf0d2eaff161a5cc8d9bb7

(I tested using pip wheel .)

Somehow, the wheel build path is not picking up the libllvmlite file. I can workaround this for OSX by uploading the wheel package for osx. I have to workaround the problem by running:

python setup.py build   # <--- workaround
python setup.py bdist_wheel

It should be fixed now with 0.17.1 release.