Hi,
Thanks @bwoodsend and @Chris. Correcting the layout seems to have solved
the problem as you envisioned. But I had also to introduce a dedicated
"main" script for pyinstaller that I called pyinstmain.py and put in src.
It reuses the code of __main__.py in src/yaas, avoiding the use of relative
imports, that seems to pose problems as I found in an issue.
I also renamed things to avoid ambiguities (like my yaas.py in yaas folder
renamed to app.py).
The import error disappeared. Now I have a dll not found error (below) with
the github actions version but it is unrelated. I will investigate before
eventualy asking for help.
Best,
Gaël
Traceback (most recent call last):
File "pyinstmain.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "yaas\app.py", line 15, in <module>
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "yaas\worker.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "torch\__init__.py", line 148, in <module>
raise err
OSError: [WinError 126] Le module spécifié est introuvable. Error loading
"C:\Users\Gaël de
Chalendar\AppData\Local\Temp\_MEI191802\torch\lib\fbgemm.dll" or one of its
dependencies.
Le vendredi 23 août 2024 à 21:59:28 UTC+2, bwoodsend a écrit :
> Your project structure is somewhat defunct. Those `src/__init__.py` and
> `src/__main__.py` files imply that `src` is a package and `yaas.py` is the
> submodule `src.yaas`. That's reflected in the wheels on PyPI which are
> installing `__init__.py` et al directly into `site-packages`.
>
> I'm guessing you really want a package called `yaas` in which case you'd
> insert a `yaas` directory (e.g. `src/yaas/__init__.py`) (personally I'd
> ditch the `src` and just use `yaas/__init__.py`) then adjust all the
> internal imports to use `from yaas import worker` instead of `import
> worker`.
>
> Once you've made that change and dealt with all the collateral damage that
> the refactor causes, PyInstaller should stop objecting to your modules not
> being where they're supposed to be.
>
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyinstaller/33017c8d-1daa-4375-8091-6b4592eb3797n%40googlegroups.com.