添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Mac M4 - Python 3.12.8 - KeyError: ‘LLVMPY_AddSymbol’ & Reason: tried: '/usr/local/lib//libz.1.dylib' (no such file) #1118

Closed
@twopirllc

Description

Reporting a bug

  • I have tried using the latest released version of Numba (most recent is
    visible in the release notes
    ( https://numba.readthedocs.io/en/stable/release-notes-overview.html ).
  • I have included a self contained code sample to reproduce the problem.
    i.e. it's possible to run as 'python bug.py'.
  • Description

    Upon migrating to a new M4 Mac Pro, Sequoia 15.2, for development of the Python library Pandas TA , I have run into the following issue when importing, pandas_ta using ipython . (See below)

    I have come across the issue numba/numba#9812 KeyError: ‘LLVMPY_AddSymbol’ but wish to avoid both brew and anaconda at all costs.

    I have also tried sym linking libz, sudo ln -s /usr/lib/libz.1.2.12.dylib /usr/local/lib/libz.1.dylib , but no dice. 🤷🏼‍♂️

    Please let me know if any additional information is needed to help solve this.

    Thank you for your time and consideration of this hopefully minor issue. Keep up the good work team! 😎

    Virtualenv Package List

    Package list prior to numba install.

    (.venv) Mac :: wormhole/project/pandas-ta ‹development*› % pip list      1 ↵
    Package                   Version        Editable project location
    ------------------------- -------------- ------------------------------------
    anyio                     4.7.0
    appnope                   0.1.4
    argon2-cffi               23.1.0
    argon2-cffi-bindings      21.2.0
    arrow                     1.3.0
    asttokens                 3.0.0
    async-lru                 2.0.4
    attrs                     24.3.0
    babel                     2.16.0
    beautifulsoup4            4.12.3
    bleach                    6.2.0
    certifi                   2024.12.14
    cffi                      1.17.1
    charset-normalizer        3.4.0
    comm                      0.2.2
    debugpy                   1.8.11
    decorator                 5.1.1
    defusedxml                0.7.1
    executing                 2.1.0
    fastjsonschema            2.21.1
    fqdn                      1.5.1
    frozendict                2.4.6
    h11                       0.14.0
    html5lib                  1.1
    httpcore                  1.0.7
    httpx                     0.28.1
    idna                      3.10
    ipykernel                 6.29.5
    ipython                   8.31.0
    isoduration               20.11.0
    jedi                      0.19.2
    Jinja2                    3.1.5
    json5                     0.10.0
    jsonpointer               3.0.0
    jsonschema                4.23.0
    jsonschema-specifications 2024.10.1
    jupyter_client            8.6.3
    jupyter_core              5.7.2
    jupyter-events            0.11.0
    jupyter-lsp               2.2.5
    jupyter_server            2.15.0
    jupyter_server_terminals  0.5.3
    jupyterlab                4.3.4
    jupyterlab_pygments       0.3.0
    jupyterlab_server         2.27.3
    llvmlite                  0.42.0
    lxml                      5.3.0
    MarkupSafe                3.0.2
    matplotlib-inline         0.1.7
    mistune                   3.0.2
    multitasking              0.0.11
    nbclient                  0.10.2
    nbconvert                 7.16.4
    nbformat                  5.10.4
    nest-asyncio              1.6.0
    notebook_shim             0.2.4
    numpy                     1.26.4
    overrides                 7.7.0
    packaging                 24.2
    pandas                    2.2.3
    pandas-datareader         0.10.0
    pandas_ta                 0.4.21b0       /Users/kj/wormhole/project/pandas-ta
    pandocfilters             1.5.1
    parso                     0.8.4
    peewee                    3.17.8
    pexpect                   4.9.0
    pip                       24.3.1
    platformdirs              4.3.6
    prometheus_client         0.21.1
    prompt_toolkit            3.0.48
    psutil                    6.1.1
    ptyprocess                0.7.0
    pure_eval                 0.2.3
    pyarrow                   18.1.0
    pycparser                 2.22
    Pygments                  2.18.0
    python-dateutil           2.9.0.post0
    python-json-logger        3.2.1
    pytz                      2024.2
    PyYAML                    6.0.2
    pyzmq                     26.2.0
    referencing               0.35.1
    requests                  2.32.3
    rfc3339-validator         0.1.4
    rfc3986-validator         0.1.1
    rpds-py                   0.22.3
    scipy                     1.14.1
    Send2Trash                1.8.3
    setuptools                75.6.0
    six                       1.17.0
    sniffio                   1.3.1
    soupsieve                 2.6
    stack-data                0.6.3
    terminado                 0.18.1
    tinycss2                  1.4.0
    tornado                   6.4.2
    traitlets                 5.14.3
    types-python-dateutil     2.9.0.20241206
    typing_extensions         4.12.2
    tzdata                    2024.2
    uri-template              1.3.0
    urllib3                   2.3.0
    wcwidth                   0.2.13
    webcolors                 24.11.1
    webencodings              0.5.1
    websocket-client          1.8.0

    Numba v0.60.0 Install

    (.venv) Mac :: wormhole/project/pandas-ta ‹development*› % pip install numba
    Collecting numba
      Using cached numba-0.60.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (2.7 kB)
    Collecting llvmlite<0.44,>=0.43.0dev0 (from numba)
      Using cached llvmlite-0.43.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (4.8 kB)
    Requirement already satisfied: numpy<2.1,>=1.22 in ./.venv/lib/python3.12/site-packages (from numba) (1.26.4)
    Using cached numba-0.60.0-cp312-cp312-macosx_11_0_arm64.whl (2.7 MB)
    Using cached llvmlite-0.43.0-cp312-cp312-macosx_11_0_arm64.whl (28.8 MB)
    Installing collected packages: llvmlite, numba
      Attempting uninstall: llvmlite
        Found existing installation: llvmlite 0.42.0
        Uninstalling llvmlite-0.42.0:
          Successfully uninstalled llvmlite-0.42.0
    Successfully installed llvmlite-0.43.0 numba-0.60.0

    Importing Pandas TA (and Pandas) with Ipython

    Verification of necessary packages import properly when using Ipython.

    (.venv) Mac :: wormhole/project/pandas-ta ‹development*
    
    
    
    
        
    › % ipython
    Python 3.12.8 (v3.12.8:2dc476bcb91, Dec  3 2024, 14:43:19) [Clang 13.0.0 (clang-1300.0.29.30)]
    Type 'copyright', 'credits' or 'license' for more information
    IPython 8.31.0 -- An enhanced Interactive Python. Type '?' for help.
    In [1]: import pandas as pd
    In [2]: import pandas_ta as ta
    ---------------------------------------------------------------------------
    KeyError                                  Traceback (most recent call last)
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:136, in _lib_wrapper.__getattr__(self, name)
        135 try:
    --> 136     return self._fntab[name]
        137 except KeyError:
        138     # Lazily wraps new functions as they are requested
    KeyError: 'LLVMPY_AddSymbol'
    During handling of the above exception, another exception occurred:
    OSError                                   Traceback (most recent call last)
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:117, in _lib_wrapper._load_lib(self)
        114 with _suppress_cleanup_errors(_importlib_resources_path(
        115         __name__.rpartition(".")[0],
        116         get_library_name())) as lib_path:
    --> 117     self._lib_handle = ctypes.CDLL(str(lib_path))
        118     # Check that we can look up expected symbols.
    File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ctypes/__init__.py:379, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
        378 if handle is None:
    --> 379     self._handle = _dlopen(self._name, mode)
        380 else:
    OSError: dlopen(/Users/kj/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/libllvmlite.dylib, 0x0006): Library not loaded: @rpath/libz.1.dylib
      Referenced from: <12FC8981-20F3-38D0-9FAE-A920E2AAFAF2> /Users/kj/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/libllvmlite.dylib
      Reason: tried: '/usr/local/lib//libz.1.dylib' (no such file)
    The above exception was the direct cause of the following exception:
    OSError                                   Traceback (most recent call last)
    Cell In[2], line 1
    ----> 1 import pandas_ta as ta
    File ~/wormhole/project/pandas-ta/pandas_ta/__init__.py:8
          6 # Dictionaries and version
          7 from pandas_ta.maps import EXCHANGE_TZ, RATE, Category, Imports, version
    ----> 8 from pandas_ta.utils import *
          9 from pandas_ta.utils import __all__ as utils_all
         11 # Flat Structure. Supports ta.ema() or ta.overlap.ema() calls.
    File ~/wormhole/project/pandas-ta/pandas_ta/utils/__init__.py:2
          1 # -*- coding: utf-8 -*-
    ----> 2 from ._candles import *
          3 from ._core import *
          4 from ._math import *
    File ~/wormhole/project/pandas-ta/pandas_ta/utils/_candles.py:3
          1 # -*- coding: utf-8 -*-
          2 from pandas import Series
    ----> 3 from pandas_ta.utils._core import non_zero_range
          5 __all__ = ["candle_color", "high_low_range", "real_body"]
          9 def candle_color(open_: Series, close: Series) -> Series:
    File ~/wormhole/project/pandas-ta/pandas_ta/utils/_core.py:9
          6 from sys import float_info as sflt
          8 from numpy import argmax, argmin, float64
    ----> 9 from numba import njit
         10 from pandas import DataFrame, Series
         12 from pandas_ta._typing import Array, Int, IntFloat, ListStr, Union
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/numba/__init__.py:73
         69 del get_versions
         70 del generate_version_info
    ---> 73 from numba.core import config
         74 from numba.core import types, errors
         76 # Re-export typeof
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/numba/core/config.py:17
         13 except ImportError:
         14     _HAVE_YAML = False
    ---> 17 import llvmlite.binding as ll
         20 IS_WIN32 = sys.platform.startswith('win32')
         21 IS_OSX = sys.platform.startswith('darwin')
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/__init__.py:4
          1 """
          2 Things that rely on the LLVM library
          3 """
    ----> 4 from .dylib import *
          5 from .executionengine import *
          6 from .initfini import *
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/dylib.py:36
         30             raise RuntimeError(str(outerr))
         32 # ============================================================================
         33 # FFI
    ---> 36 ffi.lib.LLVMPY_AddSymbol.argtypes = [
         37     c_char_p,
         38     c_void_p,
         41 ffi.lib.LLVMPY_SearchAddressOfSymbol.argtypes = [c_char_p]
         42 ffi.lib.LLVMPY_SearchAddressOfSymbol.restype = c_void_p
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:139, in _lib_wrapper.__getattr__(self, name)
        136     return self._fntab[name]
        137 except KeyError:
        138     # Lazily wraps new functions as they are requested
    --> 139     cfn = getattr(self._lib, name)
        140     wrapped = _lib_fn_wrapper(self._lock, cfn)
        141     self._fntab[name] = wrapped
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:131, in _lib_wrapper._lib(self)
        127 @property
        128 def _lib(self):
        129     # Not threadsafe.
        130     if not self._lib_handle:
    --> 131         self._load_lib()
        132     return self._lib_handle
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:125, in _lib_wrapper._load_lib(self)
        119         _ = self._lib_handle.LLVMPY_GetVersionInfo()
        120 except (OSError, AttributeError) as e:
        121     # OSError may be raised if the file cannot be opened, or is not
        122     # a shared library.
        123     # AttributeError is raised if LLVMPY_GetVersionInfo does not
        124     # exist.
    --> 125     raise OSError("Could not find/load shared object file") from e
    OSError: Could not find/load shared object file
    (.venv) Mac :: wormhole/project/pandas-ta ‹development*› % ipython
    Python 3.12.8 (v3.12.8:2dc476bcb91, Dec  3 2024, 14:43:19) [Clang 13.0.0 (clang-1300.0.29.30)]
    Type 'copyright', 'credits' or 'license' for more information
    IPython 8.31.0 -- An enhanced Interactive Python. Type '?' for help.
    In [1]: import pandas as pd
    In [2]: import pandas_ta as ta
    ---------------------------------------------------------------------------
    KeyError                                  Traceback (most recent call last)
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:136, in _lib_wrapper.__getattr__(self, name)
        135 try:
    --> 136     return self._fntab[name]
        137 except KeyError:
        138     # Lazily wraps new functions as they are requested
    KeyError: 'LLVMPY_AddSymbol'
    During handling of the above exception, another exception occurred:
    OSError                                   Traceback (most recent call last)
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:117, in _lib_wrapper._load_lib(self)
        114 with _suppress_cleanup_errors(_importlib_resources_path(
        115         __name__.rpartition(".")[0],
        116         get_library_name())) as lib_path:
    --> 117     self._lib_handle = ctypes.CDLL(str(lib_path))
        118     # Check that we can look up expected symbols.
    File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ctypes/__init__.py:379, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
        378 if handle is None:
    --> 379     self._handle = _dlopen(self._name, mode)
        380 else:
    OSError: dlopen(/Users/kj/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/libllvmlite.dylib, 0x0006): Library not loaded: @rpath/libz.1.dylib
      Referenced from: <12FC8981-20F3-38D0-9FAE-A920E2AAFAF2> /Users/kj/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/libllvmlite.dylib
      Reason: tried: '/usr/local/lib//libz.1.dylib' (no such file)
    The above exception was the direct cause of the following exception:
    OSError                                   Traceback (most recent call last)
    Cell In[2], line 1
    ----> 1 import pandas_ta as ta
    File ~/wormhole/project/pandas-ta/pandas_ta/__init__.py:8
          6 # Dictionaries and version
          7 from pandas_ta.maps import EXCHANGE_TZ, RATE, Category, Imports, version
    ----> 8 from pandas_ta.utils import *
          9 from pandas_ta.utils import __all__ as utils_all
         11 #
    
    
    
    
        
     Flat Structure. Supports ta.ema() or ta.overlap.ema() calls.
    File ~/wormhole/project/pandas-ta/pandas_ta/utils/__init__.py:2
          1 # -*- coding: utf-8 -*-
    ----> 2 from ._candles import *
          3 from ._core import *
          4 from ._math import *
    File ~/wormhole/project/pandas-ta/pandas_ta/utils/_candles.py:3
          1 # -*- coding: utf-8 -*-
          2 from pandas import Series
    ----> 3 from pandas_ta.utils._core import non_zero_range
          5 __all__ = ["candle_color", "high_low_range", "real_body"]
          9 def candle_color(open_: Series, close: Series) -> Series:
    File ~/wormhole/project/pandas-ta/pandas_ta/utils/_core.py:9
          6 from sys import float_info as sflt
          8 from numpy import argmax, argmin, float64
    ----> 9 from numba import njit
         10 from pandas import DataFrame, Series
         12 from pandas_ta._typing import Array, Int, IntFloat, ListStr, Union
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/numba/__init__.py:73
         69 del get_versions
         70 del generate_version_info
    ---> 73 from numba.core import config
         74 from numba.core import types, errors
         76 # Re-export typeof
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/numba/core/config.py:17
         13 except ImportError:
         14     _HAVE_YAML = False
    ---> 17 import llvmlite.binding as ll
         20 IS_WIN32 = sys.platform.startswith('win32')
         21 IS_OSX = sys.platform.startswith('darwin')
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/__init__.py:4
          1 """
          2 Things that rely on the LLVM library
          3 """
    ----> 4 from .dylib import *
          5 from .executionengine import *
          6 from .initfini import *
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/dylib.py:36
         30             raise RuntimeError(str(outerr))
         32 # ============================================================================
         33 # FFI
    ---> 36 ffi.lib.LLVMPY_AddSymbol.argtypes = [
         37     c_char_p,
         38     c_void_p,
         41 ffi.lib.LLVMPY_SearchAddressOfSymbol.argtypes = [c_char_p]
         42 ffi.lib.LLVMPY_SearchAddressOfSymbol.restype = c_void_p
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:139, in _lib_wrapper.__getattr__(self, name)
        136     return self._fntab[name]
        137 except KeyError:
        138     # Lazily wraps new functions as they are requested
    --> 139     cfn = getattr(self._lib, name)
        140     wrapped = _lib_fn_wrapper(self._lock, cfn)
        141     self._fntab[name] = wrapped
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:131, in _lib_wrapper._lib(self)
        127 @property
        128 def _lib(self):
        129     # Not threadsafe.
        130     if not self._lib_handle:
    --> 131         self._load_lib()
        132     return self._lib_handle
    File ~/wormhole/project/pandas-ta/.venv/lib/python3.12/site-packages/llvmlite/binding/ffi.py:125, in _lib_wrapper._load_lib(self)
        119         _ = self._lib_handle.LLVMPY_GetVersionInfo()
        120 except (OSError, AttributeError) as e:
        121     # OSError may be raised if the file cannot be opened, or is not
        122     # a shared library.
        123     # AttributeError is raised if LLVMPY_GetVersionInfo does not
        124     # exist.
    --> 125     raise OSError("Could not find/load shared object file") from e
    OSError: Could not find/load shared object file
    In [3]:

    Kind Regards,
    KJ