Giter VIP home page Giter VIP logo

Comments (7)

gatesn avatar gatesn commented on September 21, 2024

If you comment out the Zig tests (test { ... }), does it run then?

I think what's happened is that some releases of Miniconda ship with a statically linked Python. So while we can build the Python extension and run pytests initiated from Python, we are failing to run the Zig tests (hello.test.bin) which are bundled into standalone executables expecting to find a libpython.

from ziggy-pydust.

gatesn avatar gatesn commented on September 21, 2024

Let me know if 0.2.13 solves this for you

from ziggy-pydust.

ssteinbach avatar ssteinbach commented on September 21, 2024

I did poetry update. Now I don't get the build error, but I get this error instead:

❯ poetry update
Updating dependencies
Resolving dependencies... (0.7s)

Package operations: 0 installs, 1 update, 0 removals

  • Updating ziggy-pydust (0.2.12 -> 0.2.13)

❯ poetry run pytest
===================================== test session starts =====================================
platform darwin -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
rootdir: /private/var/tmp/ziggy-pydust-test/poetry-demo
plugins: ziggy-pydust-0.2.13
collected 1 item / 1 error

=========================================== ERRORS ============================================
_______________________________ ERROR collecting src/hello.zig ________________________________
.../opt/miniconda3/envs/poetry.3.11/lib/python3.11/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
.../opt/miniconda3/envs/poetry.3.11/lib/python3.11/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
.../opt/miniconda3/envs/poetry.3.11/lib/python3.11/site-packages/pydust/pytest_plugin.py:62: in collect
    h = TestProtocol.Header.unpack(proc.stdout)
.../opt/miniconda3/envs/poetry.3.11/lib/python3.11/site-packages/pydust/pytest_plugin.py:230: in unpack
    (tag, bytes_len) = struct.unpack("<II", buffer.read(8))
E   struct.error: unpack requires a buffer of 8 bytes
--------------------------------------- Captured stderr ---------------------------------------
dyld[79445]: Library not loaded: @rpath/libpython3.11.dylib
  Referenced from: <D72FED9A-0E06-3AAD-BE89-DEB489A71CE4> /private/var/tmp/ziggy-pydust-test/poetry-demo/zig-out/bin/hello.test.bin
  Reason: tried: '/usr/local/lib/libpython3.11.dylib' (no such file), '/usr/lib/libpython3.11.dylib' (no such file, not in dyld cache)
=================================== short test summary info ===================================
ERROR src/hello.zig - struct.error: unpack requires a buffer of 8 bytes
!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================== 1 error in 0.14s =======================================

If I look at linkage on hello.test.bin:

❯ otool -L zig-out/bin/hello.test.bin
zig-out/bin/hello.test.bin:
        @rpath/libpython3.11.dylib (compatibility version 3.11.0, current version 3.11.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)

from ziggy-pydust.

gatesn avatar gatesn commented on September 21, 2024

@ssteinbach could you attach the output of poetry run python -m sysconfig?

from ziggy-pydust.

ssteinbach avatar ssteinbach commented on September 21, 2024
❯ poetry run python -m sysconfig
Platform: "macosx-11.0-arm64"
Python version: "3.11"
Current installation scheme: "posix_prefix"

Paths:
        data = "~/opt/miniconda3/envs/poetry.3.11"
        include = "~/opt/miniconda3/envs/poetry.3.11/include/python3.11"
        platinclude = "~/opt/miniconda3/envs/poetry.3.11/include/python3.11"
        platlib = "~/opt/miniconda3/envs/poetry.3.11/lib/python3.11/site-packages"
        platstdlib = "~/opt/miniconda3/envs/poetry.3.11/lib/python3.11"
        purelib = "~/opt/miniconda3/envs/poetry.3.11/lib/python3.11/site-packages"
        scripts = "~/opt/miniconda3/envs/poetry.3.11/bin"
        stdlib = "~/opt/miniconda3/envs/poetry.3.11/lib/python3.11"

...

(+ a ton of environment variables)

from ziggy-pydust.

robert3005 avatar robert3005 commented on September 21, 2024

I managed to repro this locally and we have fixed it in #69. Please reopen if this is still an issue after 0.3.3

from ziggy-pydust.

ssteinbach avatar ssteinbach commented on September 21, 2024

Working great now, thanks again!

from ziggy-pydust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.