marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.36k stars 220 forks source link

The pyarrow installation is not built with support for 'dataset' #2133

Closed sumersao closed 12 months ago

sumersao commented 1 year ago

Describe the bug When running my binarized python script I get the following error. ImportError: The pyarrow installation is not built with support for 'dataset' (No module named 'pyarrow.vendored.version')

To Reproduce The parent library that's causing this issue is the python lancedb library. Just importing it causes this issue. I binarize via python setup.py build and my setup script is very simple:

import os
import sys

from cx_Freeze import Executable, setup

build_exe_options = {
    "build_exe": "relatent_backend",
    "excludes": ["sympy", "torch", "scipy"],
    "include_files": [
        os.path.join(os.getcwd(), "config.json"),
    ],
}

# base="Win32GUI" should be used only for Windows GUI app
base = "Win32GUI" if sys.platform == "win32" else None

setup(
    name="relatent",
    version="0.1",
    description="lorem ipsum",
    options={"build_exe": build_exe_options},
    executables=[
        Executable("main.py", base=base),
    ],
)

Expected behavior The code should run.

Desktop (please complete the following information):

Additional context I also tried binarizing with pyinstaller (it ultimately surfaced the same error message). Does this mean it's a pyarrow issue maybe? I couldn't find anything in their github. When I comment out this import, the rest of my code runs fine.

marcelotduarte commented 12 months ago

Use includes in your build_exe_options dict. "includes": ["pyarrow.vendored.version"]

If this does not work, try: "packages": ["pyarrow.vendored"]

Give me feedback, so I can make a hook to solve this without using includes/packages options.

sumersao commented 12 months ago

Adding "includes": ["pyarrow.vendored.version"] worked!

Following this pattern I also was able to solve issues with "anyio._backends._asyncio" not being included, and "tiktoken_ext.openai_public" needing to be included for tiktoken (i saw a pyinstaller issue about this as well here).

marcelotduarte commented 12 months ago

Please test the new hooks (without using includes=...). You can test the patch in the latest development build: pip install --force --no-cache --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze For conda-forge the command is: conda install -y --no-channel-priority -S -c https://marcelotduarte.github.io/packages/conda cx_Freeze

sumersao commented 12 months ago

That worked! Thanks

marcelotduarte commented 11 months ago

Release 6.15.11 is out!