Skip to content

Local build fails to produce usable wheel on Windows x64 #485

@IainRistMDASpace

Description

@IainRistMDASpace

Found this while installing using uv.

Installing with the command:

uv add "git+https://github.com/bastibe/python-soundfile"

uv builds the wheel locally when installing from github. The build succeed and the wheel installs but the wheel is missing _soundfile_data\libsndfile_x64.dll which results in the following error when python-soundfile is imported:

OSError: cannot load library 'c:\Repos\5g-obp\low-phy\phase-2-channelizer-app\main\.venv\Lib\site-packages\_soundfile_data\libsndfile_x64.dll': error 0x7e

setup.py detects platform and architecture0 if environment variables PYSOUNDFILE_PLATFORM and PYSOUNDFILE_ARCHITECTURE are not present. On Windows, architecture0 = platform.architecture()[0] returns '64bit' or '32bit'.

architecture0 is used directly to construct the library name libname. This results in libname == 'libsndfile_64bit.dll' or libname == 'libsndfile_32bit.dll'. This does not correspond to the files libsndfile_x86.dll and libsndfile_x64.dll under __soundfile_data/_, therefore the locally built wheel does not contain the libsndfile DLL.

Fix for uv is to add the following to my uv.toml but this is only a temporary work around:

extra-build-variables = { soundfile = { PYSOUNDFILE_PLATFORM = "win32", PYSOUNDFILE_ARCHITECTURE = "x64" } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions