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

Exception: Qt plugin directory '/plugins' does not exist! - PySide6 #7463

Closed
aaroncpascua opened this issue Feb 24, 2023 · 9 comments
Closed

Comments

@aaroncpascua
Copy link

aaroncpascua commented Feb 24, 2023

PyInstaller version 5.8.0

Python version 3.9.13

Platform: Windows (NA)

Installed python through python.org/downloads

I have not tried this on another platform.

I have uninstalled/reinstalled PySide6 6.4.2 and PyInstaller and have used the PyInstaller developer package.

I'm not much of a developer and saw that people were editing the ~\venv\Lib\site-packages\Pyinstaller\utils\hooks\Qt.py, but I can't seem to find that file anywhere? I also noticed that this person had a very similar problem, but their issue was a character encoding problem. I noticed that their path was an actual full path however. Here, my path is just '/plugins' and nothing else. I tried sifting through the stacktrace, but I can't make anything of it. The path also very much exists here ...\venv\Lib\site-pacakges\PySide6\plugins

Stacktrace / full error message

27633 INFO: Loading module hook 'hook-PySide6.QtGui.py' from '...\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
File ...\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File ...\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "...\venv\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "...\venv\lib\site-packages\PyInstaller\__main__.py", line 194, in _console_script_run
    run()
  File "...\venv\lib\site-packages\PyInstaller\__main__.py", line 180, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "...\venv\lib\site-packages\PyInstaller\__main__.py", line 61, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "...\venv\lib\site-packages\PyInstaller\building\build_main.py", line 979, in main
    build(specfile, distpath, workpath, clean_build)
  File "...\venv\lib\site-packages\PyInstaller\building\build_main.py", line 901, in build
    exec(code, spec_namespace)
  File "Main.spec", line 7, in <module>
    a = Analysis(
  File "...\venv\lib\site-packages\PyInstaller\building\build_main.py", line 414, in __init__
    self.__postinit__()
  File "...\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
    self.assemble()
  File "...\venv\lib\site-packages\PyInstaller\building\build_main.py", line 583, in assemble
    self.graph.process_post_graph_hooks(self)
  File "...\venv\lib\site-packages\PyInstaller\depend\analysis.py", line 330, in process_post_graph_hooks
    module_hook.post_graph(analysis)
  File "...\venv\lib\site-packages\PyInstaller\depend\imphook.py", line 448, in post_graph
    self._load_hook_module(keep_module_ref=True)
  File "...\venv\lib\site-packages\PyInstaller\depend\imphook.py", line 388, in _load_hook_module
    self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename)
  File "...\venv\lib\site-packages\PyInstaller\compat.py", line 612, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 529, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1029, in load_module
  File "<frozen importlib._bootstrap_external>", line 854, in load_module
  File "<frozen importlib._bootstrap>", line 274, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 711, in _load
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "...\venv\lib\site-packages\PyInstaller\hooks\hook-PySide2.QtGui.py", line 14, in <module>
    hiddenimports, binaries, datas = add_qt5_dependencies(__file__)
  File "...\venv\lib\site-packages\PyInstaller\utils\hooks\qt\__init__.py", line 839, in add_qt_dependencies
    return qt_info.collect_module(module_name)
  File "...\venv\lib\site-packages\PyInstaller\utils\hooks\qt\__init__.py", line 416, in collect_module
    binaries += self.collect_plugins(plugin_type)
  File "...\venv\lib\site-packages\PyInstaller\utils\hooks\qt\__init__.py", line 480, in collect_plugins
    raise Exception(f"Qt plugin directory '{plugin_src_dir}' does not exist!")
Exception: Qt plugin directory '/plugins' does not exist!
@rokm
Copy link
Member

rokm commented Feb 24, 2023

What is the output if you run the following snippet in your environment?

import PySide2
from PySide2 import QtCore

app = QtCore.QCoreApplication([])
info = QtCore.QLibraryInfo()
print("Package paths:", PySide2.__path__)
print("Prefix path:", info.location(QtCore.QLibraryInfo.PrefixPath))
print("Binaries path:", info.location(QtCore.QLibraryInfo.BinariesPath))
print("Plugins path:", info.location(QtCore.QLibraryInfo.PluginsPath))

@aaroncpascua
Copy link
Author

What is the output if you run the following snippet in your environment?

import PySide2
from PySide2 import QtCore

app = QtCore.QCoreApplication([])
info = QtCore.QLibraryInfo()
print("Package paths:", PySide2.__path__)
print("Prefix path:", info.location(QtCore.QLibraryInfo.PrefixPath))
print("Binaries path:", info.location(QtCore.QLibraryInfo.BinariesPath))
print("Plugins path:", info.location(QtCore.QLibraryInfo.PluginsPath))

Here's my output:

Package paths: ['...\\venv\\lib\\site-packages\\PySide2']
Prefix path:
Binaries path: /bin
Plugins path: /plugins

@aaroncpascua aaroncpascua changed the title Exception: Qt plugin directory '/plugins' does not exist! - PySide2 Exception: Qt plugin directory '/plugins' does not exist! - PySide6 Feb 25, 2023
@aaroncpascua
Copy link
Author

What is the output if you run the following snippet in your environment?

import PySide2
from PySide2 import QtCore

app = QtCore.QCoreApplication([])
info = QtCore.QLibraryInfo()
print("Package paths:", PySide2.__path__)
print("Prefix path:", info.location(QtCore.QLibraryInfo.PrefixPath))
print("Binaries path:", info.location(QtCore.QLibraryInfo.BinariesPath))
print("Plugins path:", info.location(QtCore.QLibraryInfo.PluginsPath))

FYI, I decided to change my project to PySide6 just to upgrade in the meantime. I have adjusted your code snippet:

import PySide6
from PySide6 import QtCore

app = QtCore.QCoreApplication([])
info = QtCore.QLibraryInfo()
print("Package paths:", PySide6.__path__)
print("Prefix path:", info.path(QtCore.QLibraryInfo.PrefixPath))
print("Binaries path:", info.path(QtCore.QLibraryInfo.BinariesPath))
print("Plugins path:", info.path(QtCore.QLibraryInfo.PluginsPath))

And here's the output:

Package paths: ['...\\venv\\lib\\site-packages\\PySide6']
Prefix path:
Binaries path: /bin
Plugins path: /plugins

@rokm
Copy link
Member

rokm commented Feb 25, 2023

This looks like paths being incorrectly reported by your PySide installation...

How did you install PySide2/PySide6? Are these standard PyPI wheels (e.g., pip install pyside6), or something else?

@aaroncpascua
Copy link
Author

This looks like paths being incorrectly reported by your PySide installation...

How did you install PySide2/PySide6? Are these standard PyPI wheels (e.g., pip install pyside6), or something else?

I just used pip3 install pyside6

@rokm
Copy link
Member

rokm commented Feb 25, 2023

Hmm, how about this?

import PySide6
from PySide6 import QtCore

app = QtCore.QCoreApplication([])
info = QtCore.QLibraryInfo()
print("Package paths:", PySide6.__path__)
print("Prefix path:", info.path(QtCore.QLibraryInfo.PrefixPath))
print("Binaries path:", info.path(QtCore.QLibraryInfo.BinariesPath))
print("Library executables path:", info.path(QtCore.QLibraryInfo.LibraryExecutablesPath))
print("Plugins path:", info.path(QtCore.QLibraryInfo.PluginsPath))
print("")

# Check if PySide installed embedded qt.conf at run-time
embedded_qt_conf = QtCore.QFile(":/qt/etc/qt.conf")
if embedded_qt_conf.open(QtCore.QIODevice.ReadOnly):
    data = embedded_qt_conf.readAll()
    print("Embedded qt.conf data:", data)
else:
    print("No embedded qt.conf available!")

Is your PySide using embedded qt.conf at the run-time or not?

For the reference, the expected output when embedded qt.conf properly sets the paths is:

Package paths: ['C:\\Users\\Rok\\Development\\pyi-pyside6\\venv\\lib\\site-packages\\PySide6']
Prefix path: C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/.
Binaries path: C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/bin
Library executables path: C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/.
Plugins path: C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/plugins

Embedded qt.conf data: b'[Paths]\nPrefix = C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/.\nLibraryExecutables = C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/.\n'

@aaroncpascua
Copy link
Author

Hmm, how about this?

import PySide6
from PySide6 import QtCore

app = QtCore.QCoreApplication([])
info = QtCore.QLibraryInfo()
print("Package paths:", PySide6.__path__)
print("Prefix path:", info.path(QtCore.QLibraryInfo.PrefixPath))
print("Binaries path:", info.path(QtCore.QLibraryInfo.BinariesPath))
print("Library executables path:", info.path(QtCore.QLibraryInfo.LibraryExecutablesPath))
print("Plugins path:", info.path(QtCore.QLibraryInfo.PluginsPath))
print("")

# Check if PySide installed embedded qt.conf at run-time
embedded_qt_conf = QtCore.QFile(":/qt/etc/qt.conf")
if embedded_qt_conf.open(QtCore.QIODevice.ReadOnly):
    data = embedded_qt_conf.readAll()
    print("Embedded qt.conf data:", data)
else:
    print("No embedded qt.conf available!")

Is your PySide using embedded qt.conf at the run-time or not?

For the reference, the expected output when embedded qt.conf properly sets the paths is:

Package paths: ['C:\\Users\\Rok\\Development\\pyi-pyside6\\venv\\lib\\site-packages\\PySide6']
Prefix path: C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/.
Binaries path: C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/bin
Library executables path: C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/.
Plugins path: C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/plugins

Embedded qt.conf data: b'[Paths]\nPrefix = C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/.\nLibraryExecutables = C:/Users/Rok/Development/pyi-pyside6/venv/lib/site-packages/PySide6/.\n'

Here's the output:

Package paths: ['...\\venv\\lib\\site-packages\\PySide6']
Prefix path:
Binaries path: /bin
Library executables path:
Plugins path: /plugins

Embedded qt.conf data: b'[Paths]\nPrefix = .../venv/lib/site-packages/PySide6/.\nLibraryExecutables = .../venv/lib/site-packages/PySide6/.\n'

@rokm
Copy link
Member

rokm commented Feb 27, 2023

I'm running out of ideas, then, and cannot reproduce this - based on the above outputs I'd say that this is either a bug in PySide or an issue in your environment.

Is there anything special about the part of the path that you are not showing us (the ...)? Does it contain non-ASCII characters, or symbols in the directory names? Is the path located on a non-local drive, perhaps?

Do you get proper paths by the above snippet if you create a new virtual environment somewhere on the primary hard drive?

@aaroncpascua
Copy link
Author

I'm running out of ideas, then, and cannot reproduce this - based on the above outputs I'd say that this is either a bug in PySide or an issue in your environment.

Is there anything special about the part of the path that you are not showing us (the ...)? Does it contain non-ASCII characters, or symbols in the directory names? Is the path located on a non-local drive, perhaps?

Do you get proper paths by the above snippet if you create a new virtual environment somewhere on the primary hard drive?

Yeah, I'm not sure what's happening. The ... is a OneDrive, so the string is like OneDrive - Company. What I find really weird is that it worked one my OneDrive before, I just moved it to my Desktop on the OneDrive because my previous path was starting to get too long for some file names. But when I moved it, there was no problem.

I decided to truly use my local C: drive and it works. So something weird is going on there that I don't understand. I'll close the forum, but unfortunately could never find a true answer.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants