thmahe / poetry-pyinstaller-plugin

Poetry plugin to build and/or bundle binaries with PyInstaller
https://pypi.org/project/poetry-pyinstaller-plugin/
MIT License
12 stars 6 forks source link

ModuleNotFoundError #14

Open damufo opened 1 week ago

damufo commented 1 week ago

Very thanks for poetry-pyinstaller-plugin

Ubuntu 22.04 Python 3.10 (virtualenv) poetry-pyinstaller-plugin: v1.1.11

File project.toml


[tool.poetry]
name = "clasaua"
version = "0.4.7"
description = ""
authors = ["Dani MF <dani@damufo.eu>"]
repository = "https://github.com/damufo/clasaua/"
license = "GPLv3"
readme = "README.md"
packages = [
    {include = "clasaua"},
    ]

[tool.poetry.dependencies]
python = ">=3.8.0,<3.13"
odfpy = "^1.4.1"
reportlab = "^4.2.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
clasauaa = "clasaua.launcher:clasaua"

[tool.poetry-pyinstaller-plugin]
# Pyinstaller version (Optional, latest if not set)
# Does not support version constraint (eg: ^6.4)
version = "6.7.0"
No module named 
# Disable UPX compression
disable-upx = true

[tool.poetry-pyinstaller-plugin.scripts]
myclas = { source = "clasaua/launcher.py", type = "onedir", bundle = false }

[tool.poetry-pyinstaller-plugin.collect]
# Collect all submodules, data files & binaries for 'package_A' and 'package_B'
all = ['odf', 'reportlab']

Terminal result $poetry build

Preparing PyInstaller 6.7.0 environment /home/damufo/dev/clasaua/.venv
  - Installing odfpy (>=1.4.1,<2.0.0)
  - Installing reportlab (>=4.2.0,<5.0.0)
Building binaries with PyInstaller Python 3.10 [manylinux_2_35_x86_64]
  - Building myclas DIRECTORY
  - Built myclas -> 'dist/pyinstaller/manylinux_2_35_x86_64/myclas'
Building clasaua (0.4.7)
  - Building sdist
  - Built clasaua-0.4.7.tar.gz
  - Building wheel
  - Built clasaua-0.4.7-py3-none-any.whl

File clasaua/launcher.py

#!/home/damufo/dev/clasaua_pypitest/.venv/bin/python3
# -*- coding: utf-8 -*-

import os
import re
import sys
from clasaua.lib.clasaua import Clasaua

def clasaua():
    print("Hello, world!")

Terminal error

/clasaua/dist/pyinstaller/manylinux_2_35_x86_64/myclas
± |master U:3 ?:5 ✗| → ./myclas 
Traceback (most recent call last):
  File "clasaua/launcher.py", line 8, in <module>
ModuleNotFoundError: No module named 'clasaua'
[2547408] Failed to execute script 'launcher' due to unhandled exception!

Project source https://github.com/damufo/clasaua/

damufo commented 4 days ago

Python 3.10 (virtualenv) poetry-pyinstaller-plugin: v1.1.112 Tested windows10 and Ubuntu 22.04

[tool.poetry]
name = "myclass"
...
packages = [
    {include = "myclass"},
    ]
...
[tool.poetry-pyinstaller-plugin]
# Pyinstaller version (Optional, latest if not set)
# Does not support version constraint (eg: ^6.4)
version = "6.7.0"

# Disable UPX compression
disable-upx = true

# Disable [tool.poetry.include] and use plugin settings instead
#exclude-include = true  # has effect ???

[tool.poetry-pyinstaller-plugin.scripts]
myclass = { source = "myclass/launcher.py", type = "onedir", bundle = false, console = false, windowed = false }

[tool.poetry-pyinstaller-plugin.collect]
# Collect all submodules, data files & binaries for 'package_A' and 'package_B'
all = ['odf', 'reportlab']

No add package folder myclass for myclass_internal folder ./myclass Fail.

Exacutable work if the package folder is manually added:

[tool.poetry-pyinstaller-plugin.include]
"myclass" = "myclass"

For me ending the folder / ("myclass/" = "myclass") does not work on windows for python 3.8.