Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with CPython 3.13 and llvmlite #1107

Open
Alpengreis opened this issue Dec 5, 2024 · 7 comments
Open

Problems with CPython 3.13 and llvmlite #1107

Alpengreis opened this issue Dec 5, 2024 · 7 comments

Comments

@Alpengreis
Copy link

Since I could successfuly install the numba/llvmlite combo v0.61.0rc1/v0.44.0rc1 within CPython v3.13, I tried to run my related code (I had no problem with v0.60.0/0.43.0 and CPython v3.12.7):

# Import the required module(s)
import ctypes
import msvcrt
import re
import sys
import time
import colorama
from numba import jit


# Initialize ANSI escape sequences for console
colorama.init(convert=True)

# Clear console screen (CLS)
print(colorama.ansi.clear_screen(), end="")

# Find program version and set result as variable
file_lines = []
with open("11_ABOUT.txt", mode="r", encoding="utf-8") as about_file:
    for each_file_line in about_file:
        file_lines.append(each_file_line.rstrip("\n"))
prg_ver = re.compile(":             (.*)")
match_result = prg_ver.search(str(file_lines[4]))
prg_ver_var = match_result.group(1)

# Set window title
window_title = "Count to one billion v" + prg_ver_var
ctypes.windll.kernel32.SetConsoleTitleW(window_title)


def main_menu():
    """Main menu to choose the main options"""
    print("\nThe Python speed experiment!")
    while True:
        # Choice
        try:
            print("\nPlease enter (q = Quit, n = Normal methode, j = JIT methode:", end=" ", flush=True)
            key = msvcrt.getch()
        except (TypeError, ValueError) as main_menu_exception:
            print("Unallowed input: ", main_menu_exception.args[0])
            continue
        if key == b"q":
            print("\n\nYou pressed the key \"q\"...")
            sys.exit(0)
        elif key == b"n":
            print("\n\nPlease wait...")
            normal_methode()
            break
        elif key == b"j":
            print("\n\nPlease wait...")
            jit_methode()
            break
        else:
            print("\n")
            print("Unallowed input!")


def normal_methode():
    """Normal methode"""

    def counter_to_test_speed():
        """Variant with range"""
        count = 0
        for _ in range(0, 1000000000):
            count += 1
        print(count)
    start = time.time()
    counter_to_test_speed()
    end = time.time()
    print(end - start, "second(s)")
    main_menu()


def jit_methode():
    """JIT methode"""

    @jit(nopython=True)
    def counter_to_test_speed():
        """Variant with range"""
        count = 0
        for _ in range(0, 1000000000):
            count += 1
        print(count)
    start = time.time()
    counter_to_test_speed()
    end = time.time()
    print(end - start, "second(s)")
    main_menu()


if __name__ == "__main__":
    main_menu()

Now I can't run this code anymore and the following appears:

Traceback (most recent call last):
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\llvmlite\binding\ffi.py", line 141, in __getattr__
    return self._fntab[name]
           ~~~~~~~~~~~^^^^^^
KeyError: 'LLVMPY_AddSymbol'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\llvmlite\binding\ffi.py", line 122, in _load_lib
    self._lib_handle = ctypes.CDLL(str(lib_path))
                       ~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "c:\Users\ag-usr\AppData\Local\Programs\Python\Python313\Lib\ctypes\__init__.py", line 390, in __init__
    self._handle = _dlopen(self._name, mode)
                   ~~~~~~~^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\llvmlite\binding\llvmlite.dll' (or one of its dependencies). Try using the full path with constructor syntax.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "d:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\count_to_one_billion.py", line 40, in <module>
    from numba import jit
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\numba\__init__.py", line 73, in <module>
    from numba.core import config
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\numba\core\config.py", line 17, in <module>
    import llvmlite.binding as ll
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\llvmlite\binding\__init__.py", line 4, in <module>
    from .dylib import *
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\llvmlite\binding\dylib.py", line 36, in <module>
    ffi.lib.LLVMPY_AddSymbol.argtypes = [
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\llvmlite\binding\ffi.py", line 144, in __getattr__
    cfn = getattr(self._lib, name)
                  ^^^^^^^^^
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\llvmlite\binding\ffi.py", line 136, in _lib
    self._load_lib()
    ~~~~~~~~~~~~~~^^
  File "D:\_D-Alpen\Multimedia\PC\py\py_proj\ul\count_to_one_billion\.venv\Lib\site-packages\llvmlite\binding\ffi.py", line 130, in _load_lib
    raise OSError("Could not find/load shared object file") from e
OSError: Could not find/load shared object file

Can I do there anything or have I to wait for the new release numba/llvmlite for Python 3.13?

Greetings
Alpengreis

@seibert
Copy link
Contributor

seibert commented Dec 5, 2024

This is likely the same issue as numba/numba#9825 due to a missing symbol in the windows build of LLVM used in the wheel. There will be another release candidate with a fix, likely next week.

@Alpengreis
Copy link
Author

@seibert

Ahhhh, VERY good and sorry for posting here then!

Thank you very much for your response!

@esc
Copy link
Member

esc commented Dec 5, 2024

Indeed, @Alpengreis please follow numba/numba#9825 -- I'll close this and flag as a duplicate. Thank you very much reporting, it's good to see the issue happens elsewhere too. Can you confirm that it is only Python 3.13, or have you tried the other supported versions too?

@esc esc closed this as completed Dec 5, 2024
@esc esc added the duplicate label Dec 5, 2024
@Alpengreis
Copy link
Author

@esc

Yes, I can confirm that's the case with Python 3.13 only. Thank you!

@esc
Copy link
Member

esc commented Dec 10, 2024

Decided to re-open this issue and close numba/numba#9825 -- the problem is with the windows wheels for llvmlite and not Numba.

@esc
Copy link
Member

esc commented Dec 10, 2024

This should fix it: #1108

@Alpengreis
Copy link
Author

Alpengreis commented Dec 13, 2024

@esc

I can confirm that it is now running (with llvmlite v0.44.0rc2). Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants