Skip to content

Trouble loading binary libraries #519

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

Closed
waldotf opened this issue Apr 27, 2025 · 2 comments
Closed

Trouble loading binary libraries #519

waldotf opened this issue Apr 27, 2025 · 2 comments

Comments

@waldotf
Copy link
Contributor

waldotf commented Apr 27, 2025

I've been trying to get my plugin working with the new 3.13-based SP releases without luck. Most dependencies work fine after upgrading to whatever pip3.13 chooses. psycopg2, which is a compiled library (i.e. Python wrappers around a .so), does not. When my plugin loads, I get:

[Source.Python]
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/plugins/command.py", line 164, in load_plugin
    plugin = self.manager.load(plugin_name)
  File "../addons/source-python/packages/source-python/plugins/manager.py", line 209, in load
    plugin._load()
    ~~~~~~~~~~~~^^
  File "../addons/source-python/packages/source-python/plugins/instance.py", line 84, in _load
    self.module.load()
    ~~~~~~~~~~~~~~~~^^
  File "../addons/source-python/plugins/tempus_loader/tempus/tempus/addon.py", line 24, in load
    Tempus = import_module('tempus.mapmodules.jump').Tempus
             ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "../addons/source-python/plugins/tempus_loader/tempus/tempus/mapmodules/jump.py", line 9, in <module>
    from tempus.db.jump import Database
  File "../addons/source-python/plugins/tempus_loader/tempus/tempus/db/jump.py", line 11, in <module>
    import psycopg2
  File "../addons/source-python/plugins/tempus_loader/tempus/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
    ...<10 lines>...
    )

ModuleNotFoundError: No module named 'psycopg2._psycopg'

which implies to me that the embedded Python interpreter doesn't recognize the provided psycopg2/_psycopg.cpython-313-i386-linux-gnu.so as a valid/usable library. I've tried rebuilding this library in a few configurations (different OS, building psycopg2 against libpq5 vs the prebuilt psycopg2-binary) without any obvious difference in behavior. Basic inspection of the .so looks like it should be fine:

# file psycopg2/_psycopg.cpython-313-i386-linux-gnu.so
psycopg2/_psycopg.cpython-313-i386-linux-gnu.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=956847b7b57740ce2b621cb781b46aa88e331480, stripped

Probably not a Source.Python bug per se, but I assume there's a discrepancy between my "plugin build environment" and the build server for SP that I need to fix.

@jordanbriere
Copy link
Contributor

You should have _psycopg.cpython-313-x86_64-linux-gnu.so not _psycopg.cpython-313-i386-linux-gnu.so.

Ayuto added a commit that referenced this issue Apr 27, 2025
@Ayuto
Copy link
Member

Ayuto commented Apr 27, 2025

Yes, looks like you installed the 64 bit package. To make things easier I have now included that package. A new release will be ready in a few minutes.

@Ayuto Ayuto closed this as completed Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants