question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import PySimpleGUIQt as sg: FAILURE: '--standalone', SUCCESS: '--follow-imports'.

See original GitHub issue

Hello Kay,

I think this might be related to issue #513.


This works: python -m nuitka --follow-imports test.py


This does not work (neither of them): python -m nuitka --standalone test.py

Nuitka:WARNING:Use '--plugin-enable=qt-plugins' for: Inclusion of Qt plugins.
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\nuitka\__main__.py", line 184, in <module>
    main()
  File "C:\Python35\lib\site-packages\nuitka\__main__.py", line 177, in main
    MainControl.main()
  File "C:\Python35\lib\site-packages\nuitka\MainControl.py", line 766, in main
    main_module = createNodeTree(filename=filename)
  File "C:\Python35\lib\site-packages\nuitka\MainControl.py", line 141, in createNodeTree
    Optimization.optimize(main_module.getOutputFilename())
  File "C:\Python35\lib\site-packages\nuitka\optimizations\Optimization.py", line 616, in optimize
    makeOptimizationPass(initial_pass=True)
  File "C:\Python35\lib\site-packages\nuitka\optimizations\Optimization.py", line 530, in makeOptimizationPass
    changed = optimizeModule(current_module)
  File "C:\Python35\lib\site-packages\nuitka\optimizations\Optimization.py", line 165, in optimizeModule
    optimizeShlibModule(module)
  File "C:\Python35\lib\site-packages\nuitka\optimizations\Optimization.py", line 160, in optimizeShlibModule
    Plugins.considerImplicitImports(module=module, signal_change=signalChange)
  File "C:\Python35\lib\site-packages\nuitka\plugins\Plugins.py", line 128, in considerImplicitImports
    plugin.considerImplicitImports(module, signal_change)
  File "C:\Python35\lib\site-packages\nuitka\plugins\PluginBase.py", line 173, in considerImplicitImports
    for full_name, required in self.getImplicitImports(module):
  File "C:\Python35\lib\site-packages\nuitka\plugins\standard\ImplicitImports.py", line 770, in getImplicitImports
    for used_module in module.getUsedModules():
  File "C:\Python35\lib\site-packages\nuitka\nodes\ModuleNodes.py", line 899, in getUsedModules
    self._readPyPIFile()
  File "C:\Python35\lib\site-packages\nuitka\nodes\ModuleNodes.py", line 878, in _readPyPIFile
    assert imported.endswith(")")
AssertionError

python -m nuitka --standalone --plugin-enable=qt-plugins test.py

Nuitka:INFO:Injecting plug-in based post load code for module 'PyQt5.QtCore':
Nuitka:INFO:    Setting Qt library path to distribution folder. Need to avoid loading target
Nuitka:INFO:    system Qt plug-ins, which may be from another Qt version.
Nuitka:INFO:Injecting plug-in based pre load code for module 'PyQt5':
Nuitka:INFO:    Adding dist folder to 'PATH' environment variable.
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\nuitka\__main__.py", line 184, in <module>
    main()
  File "C:\Python35\lib\site-packages\nuitka\__main__.py", line 177, in main
    MainControl.main()
  File "C:\Python35\lib\site-packages\nuitka\MainControl.py", line 766, in main
    main_module = createNodeTree(filename=filename)
  File "C:\Python35\lib\site-packages\nuitka\MainControl.py", line 141, in createNodeTree
    Optimization.optimize(main_module.getOutputFilename())
  File "C:\Python35\lib\site-packages\nuitka\optimizations\Optimization.py", line 616, in optimize
    makeOptimizationPass(initial_pass=True)
  File "C:\Python35\lib\site-packages\nuitka\optimizations\Optimization.py", line 530, in makeOptimizationPass
    changed = optimizeModule(current_module)
  File "C:\Python35\lib\site-packages\nuitka\optimizations\Optimization.py", line 165, in optimizeModule
    optimizeShlibModule(module)
  File "C:\Python35\lib\site-packages\nuitka\optimizations\Optimization.py", line 160, in optimizeShlibModule
    Plugins.considerImplicitImports(module=module, signal_change=signalChange)
  File "C:\Python35\lib\site-packages\nuitka\plugins\Plugins.py", line 128, in considerImplicitImports
    plugin.considerImplicitImports(module, signal_change)
  File "C:\Python35\lib\site-packages\nuitka\plugins\PluginBase.py", line 173, in considerImplicitImports
    for full_name, required in self.getImplicitImports(module):
  File "C:\Python35\lib\site-packages\nuitka\plugins\standard\ImplicitImports.py", line 770, in getImplicitImports
    for used_module in module.getUsedModules():
  File "C:\Python35\lib\site-packages\nuitka\nodes\ModuleNodes.py", line 899, in getUsedModules
    self._readPyPIFile()
  File "C:\Python35\lib\site-packages\nuitka\nodes\ModuleNodes.py", line 878, in _readPyPIFile
    assert imported.endswith(")")
AssertionError


test.py:

import PySimpleGUIQt as sg

This is on Windows 10 (64 bit):

python -m nuitka --version

0.6.6rc5
Python: 3.5.4 (v3.5.4:3f56838, Aug  8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)]
Executable: C:\Python35\python.exe
OS: Windows
Arch: x86_64

Here is how I installed the Python libraries:

pip install PySimpleGUIQt
pip install PySide2
pip install PyQt5
pip uninstall nuitka
pip install -U "https://nuitka.net/doc/factory.html"

Note: the pip install -U “https://nuitka.net/doc/factory.html was done on 09/18/2019.

Thanks, George Hynes 10/01/2019 4:53pm ET

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JorjMcKiecommented, Oct 3, 2019

Sorry that your path seems so much like “from Dracula to the bloodletting” (as we say in German) 😃

What you need to do is specifying the right plugins when doing standalone compiles. One more time I am recommending hinted compilation, which would take over this for you.

But anyway, when using tkinter on Windows you need to do python -m nuitka --standalone --enable-plugin=tk-inter yourscript.py. This plugin will copy the required TK/TCL data directories to your dist folder in the right way.

Easily of course, you have more than just Tkinter in your script, say numpy and/or scipy and/or matplotlib, etc… So the command line quickly becomes very long and error-prone … and the resulting dist folder very large, compile times very long …

Hinted compilation will help here in many cases. Not always, I must admit.

1reaction
JorjMcKiecommented, Mar 19, 2020

Try this command: python -m nuitka --plugin-list.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PySimpleGUIQt - PyPI
Porting your PySimpleGUI code to PySimpleGUIQt. To "port" your code from the tkinter implementation. Follow these steps: Change import PySimpleGUI to ...
Read more >
PySimpleGUI
PySimpleGUI User's Manual. Python GUI For Humans - Transforms tkinter, Qt, Remi, WxPython into portable people-friendly Pythonic interfaces. The Call Reference ...
Read more >
PySimpleGUIQt does not import inside QGIS, DLL not found
I can't get it to work, a DLL is not found. Configuration. Win10 64b, QGIS 3.16 (Python 3.7). Steps to reproduce the error....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found