Skip to content

Libraries packaged in unexpected location when using python installed via scoop #8023

Closed

Description

@bersbersbers

Description of the issue

The following example code fails on my system:

bug.py

# pyinstaller --onefile bug.py && dist\bug.exe
import matplotlib

The output is:

C:\Build\project>dist\bug.exe
Traceback (most recent call last):
  File "C:\Scoop\persist\python\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_mplconfig.py", line 45, in <module>
    _pyi_rthook()
  File "C:\Scoop\persist\python\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_mplconfig.py", line 31, in _pyi_rthook
    import _pyi_rth_utils  # PyInstaller's run-time hook utilities module
    ^^^^^^^^^^^^^^^^^^^^^
  File "PyInstaller\loader\pyimod02_importers.py", line 391, in exec_module
  File "PyInstaller\fake-modules\_pyi_rth_utils\__init__.py", line 23, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 391, in exec_module
  File "PyInstaller\fake-modules\_pyi_rth_utils\_win32.py", line 12, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 391, in exec_module
  File "ctypes\__init__.py", line 8, in <module>
ImportError: DLL load failed while importing _ctypes: The specified module could not be found.
[4880] Failed to execute script 'pyi_rth_mplconfig' due to unhandled exception!

Context information (for bug reports)

  • Output of pyinstaller --version: 6.1.0
  • Version of Python: 3.12.0
  • Platform: Windows
  • How you installed Python: scoop install python
  • Did you also try this on another platform? No, scoop is Windows-only.
  • try the latest development version, using the following command: same result.

libffi-8.dll seems to be packaged in the wrong location inside the MEI, see https://github.com/orgs/pyinstaller/discussions/7431#discussioncomment-7335377.

Activity

  1. rokm commented on Oct 20, 2023

    @rokm
    Member

    libffi-8.dll seems to be packaged in the wrong location inside the MEI, see https://github.com/orgs/pyinstaller/discussions/7431#discussioncomment-7335377.

    Thanks for the initial analysis! This sounds like a DLL parent path preservation bug (which seems to affect either scoop-installed python, or perhaps python without virtual environment in general). I'll look into it.

  2. added and removed
    triagePlease triage and relabel this issue
    on Oct 20, 2023
  3. bersbersbers commented on Oct 20, 2023

    @bersbersbers
    ContributorAuthor

    Beautiful, thank you! It's not the only place where scoops symlinks/junctions create problems, but I'm happy you choose to support it.

  4. locked as resolved and limited conversation to collaborators on Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions