Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marshal error of WindowsPath in find_binary_dependencies() #8081

Closed
2 of 6 tasks
henzef opened this issue Nov 8, 2023 · 6 comments · Fixed by #8086
Closed
2 of 6 tasks

Marshal error of WindowsPath in find_binary_dependencies() #8081

henzef opened this issue Nov 8, 2023 · 6 comments · Fixed by #8086
Labels

Comments

@henzef
Copy link

henzef commented Nov 8, 2023

Description of the issue

I am trying to package a python project that is based on PySide6 in a windows executable, but PyInstaller fails with an exception.

The value of the "output" variable (see stacktrace below) was:

(['my_venv\\lib\\site-packages\\numpy\\.libs', WindowsPath('my_venv/Lib/site-packages/shiboken6')], ['my_venv\\Lib\\site-packages\\PySide6'])

Context information (for bug reports)

  • Output of pyinstaller --version: 6.1.0

  • Version of Python: 3.9.13 (64-bit)

  • Platform: Windows 10

  • How you installed Python: python.org/downloads

  • Did you also try this on another platform? Not tried

  • try the latest development version: done, same result

  • follow all the instructions in our "If Things Go Wrong" Guide
    (https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong): done

Make sure everything is packaged correctly

  • start with clean installation
  • use the latest development version
  • Run your frozen program from a command window (shell) — instead of double-clicking on it
  • Package your program in --onedir mode
  • Package without UPX, say: use the option --noupx or set upx=False in your .spec-file
  • Repackage you application in verbose/debug mode. For this, pass the option --debug to pyi-makespec or pyinstaller or use EXE(..., debug=1, ...) in your .spec file.

A minimal example program which shows the error

Sorry, can't generate minimal example :-/

Stacktrace / full error message

Traceback (most recent call last):
  File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "my_venv\lib\site-packages\PyInstaller\__main__.py", line 209, in <module>
    run()
  File "my_venv\lib\site-packages\PyInstaller\__main__.py", line 189, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "my_venv\lib\site-packages\PyInstaller\__main__.py", line 61, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "my_venv\lib\site-packages\PyInstaller\building\build_main.py", line 1042, in main
    build(specfile, distpath, workpath, clean_build)
  File "my_venv\lib\site-packages\PyInstaller\building\build_main.py", line 982, in build
    exec(code, spec_namespace)
  File "my_project\build.spec", line 14, in <module>
    a = Analysis(['main.py'],
  File "my_venv\lib\site-packages\PyInstaller\building\build_main.py", line 468, in __init__
    self.__postinit__()
  File "my_venv\lib\site-packages\PyInstaller\building\datastruct.py", line 184, in __postinit__
    self.assemble()
  File "my_venv\lib\site-packages\PyInstaller\building\build_main.py", line 800, in assemble
    self.binaries.extend(find_binary_dependencies(self.binaries, collected_packages))
  File "my_venv\lib\site-packages\PyInstaller\building\build_main.py", line 217, in find_binary_dependencies
    added_dll_directories, added_path_directories = child.call(process_search_paths)
  File "my_venv\lib\site-packages\PyInstaller\isolated\_parent.py", line 319, in call
    raise RuntimeError(f"Child process call to {function.__name__}() failed with:\n" + output)
RuntimeError: Child process call to process_search_paths() failed with:
  File "my_venv\lib\site-packages\PyInstaller\isolated\_child.py", line 67, in run_next_command
    marshalled = dumps((True, output))
ValueError: unmarshallable object
@henzef henzef added the triage Please triage and relabel this issue label Nov 8, 2023
@henzef
Copy link
Author

henzef commented Nov 8, 2023

Maybe related to #7515

@rokm
Copy link
Member

rokm commented Nov 8, 2023

Maybe related to #7515

Similar, but with different origin.

If you look at lines printed above the error, that offending WindowsPath is probably also printed in the line that starts with "Extra DLL search directories (AddDllDirectory): ...

@rokm rokm added bug and removed triage Please triage and relabel this issue labels Nov 8, 2023
@rokm
Copy link
Member

rokm commented Nov 8, 2023

Ah, nevermind, those lines would have been printed after the problematic part.

@rokm
Copy link
Member

rokm commented Nov 8, 2023

Can you try changing this line:

dll_directories = os._added_dll_directories

into

dll_directories = [str(path) for path in os._added_dll_directories]

@henzef
Copy link
Author

henzef commented Nov 8, 2023

That seems to fix it. The log output now contains:

INFO: Extra DLL search directories (AddDllDirectory): ['my_venv\\lib\\site-packages\\numpy\\.libs', 'my_venv\\Lib\\site-packages\\shiboken6']
INFO: Extra DLL search directories (PATH): ['my_venv\\Lib\\site-packages\\PySide6']

@rokm
Copy link
Member

rokm commented Nov 8, 2023

Thanks for confirming!

@rokm rokm closed this as completed in #8086 Nov 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants