setup.py error: unknown file type '.py'

137 views
Skip to first unread message

Alessandro Orro

unread,
Mar 25, 2024, 11:34:25 AM3/25/24
to pyoxidizer-users
Hi 
I have a very basic library in pure python that I install with 

python setup.py install

This is setup.py

from setuptools import setup, find_packages, Extension
from pathlib import Path    setup(
        name='myapp',
        version='0.1.0',
        ext_modules=[
            Extension('myapp', sources=["src/myapp.py"]),
        ],
    )

If I try to include it in the executable with pyoxidizer I obtain this error

building 'myapp' extension
error: unknown file type '.py' (from 'src/myapp.py')
error[PYOXIDIZER_PYTHON_EXECUTABLE]: running setup.py install
   
    Caused by:
        error running pip
       --> ./pyoxidizer.bzl:240:21
        |
    240 |     for resource in exe.setup_py_install("myapp"):
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PythonExecutable.setup_py_install()
   
   
error: running setup.py install

Caused by:
    error running pip

The relevant configurations of pyoxidizer.bzl are

dist = default_python_distribution()
policy = dist.make_python_packaging_policy()
policy.extension_module_filter = "all"
policy.resources_location_fallback = "filesystem-relative:lib"
policy.set_resource_handling_mode("files")
python_config = dist.make_python_interpreter_config()
python_config.module_search_paths = ["$ORIGIN/lib"]

    for resource in exe.pip_download(["numpy"]):
        resource.add_location = "filesystem-relative:lib"
        exe.add_python_resource(resource)

    for resource in exe.setup_py_install("myapp"):
        resource.add_location = "filesystem-relative:lib"
        exe.add_python_resource(resource)

Thanks
Alessandro


Reply all
Reply to author
Forward
0 new messages