Import stl models PyQt3D and Pyinstaller - python-3.x

I'm trying to build my application to .exe with PyInstaller, but it seems, that PyQt3D module doesn't imports PyQt3D module.
It is impossible to build application with Qt3D with PyInstaller, or I need some extra configuration for this? I tried to add PyQt3D module in hidden-imports, but still have an error:
Traceback (most recent call last):
File "***\main.py", line 1, in <module>
from PyQt5 import QtWidgets, Qt3DCore, Qt3DExtras, Qt3DRender, QtGui, QtCore
ModuleNotFoundError: No module named 'PyQt5.Qt3DInput'
[13512] Failed to execute script main
I passed --hidden-import PyQt5.Qt3DInput to PyInstaller.
But still, I've got this:
Qt3D.Renderer.Jobs: unsupported format encountered (stl)
When I'm running my application in PyCharm everething is OK.
Maybe anyone can help with this?

Find out that to start import models with setSource() I need to add PyQt5/Qt/plugins/geometryloaders to PyQt5. So full command to build onefile PyQt3D Application is:
pyinstaller %input_file% --onefile --hidden-import PyQt5.Qt3DInput --add-data "venv/Lib/site-packages/PyQt5/Qt/plugins/geometryloaders";"PyQt5/Qt/plugins/geometryloaders"

Related

Pyinstaller Failed to execute script pyi_rth__tkinter on Mac

I'm trying to create a pyinstaller app distribution
pyinstaller --windowed --add-data "folder:folder" --icon=icon.icns MyApp.py
but I'm getting this error:
Traceback (most recent call last): File
"site-packages/PyInstaller/loader/rthooks/pyi_rth__tkinter.py", line
30, in FileNotFoundError: Tcl data directory
"/Path/MyApp.app/Contents/MacOS/tcl"
not found. [55354] Failed to execute script pyi_rth__tkinter
The strange thing is that I'm not using Tkinter anywhere in my application.
I noticed this in the logs as well:
4000 ERROR: Tcl/Tk improperly installed on this system.
And since my app doesn't rely on Tkinter anyway, I changed the pyinstaller command to this which fixed the issue:
pyinstaller --windowed --add-data "folder:folder" --exclude-module tkinter --icon=icon.icns MyApp.py
I'm still investigating how to fix my Tcl/Tk installation.

import module error python3 xubuntu 19.04

When importing PyGame using the interpreter it is successful. Using Geany it is not.
shows the error.
I have tried editing the shebang, renaming the file. making sure the PATH and version were correct, and that there were no missing Geany plugins.
import pygame
pygame.init()
Error in Geany:
Traceback (most recent call last):
File "moduleerror.py", line 3, in <module>
import pygame
ImportError: No module named pygame
I went into Build >> Set Build Commands and under Execute commands changed
python "%f"
to
python3 "%f"

PyQt4 installation on Linux

Please help to finish installation of PyQt.
So I think I successfully installed SPI and PyQt as it is mentioned in the reiverbankcomputing. (https://www.riverbankcomputing.com/software/pyqt/download)
(at least no errors where raised during installation).
However when in python shell I import PyQt, python does not recognize it:
>>> from PyQt4 import QtCore, QtGui
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4
To my opinion the issues is in PATH variable. I am not root in Linux, so installed python only for my user.
I assume I need to setup some environment variables, but don’t know which ones.
Can you please help?
P.S. My linux is not conntected to Web, so need to download all packages seperatly.

Import Error Using Pycahrm IDE

I am newbie to Python GUI using Qt libraries, I started learning PyQt development in Pycharm IDE I tried to run code-- started showing
C:\Python27\python.exe C:/Users/xxxx/PycharmProjects/initproject/helloworld 12:58, hello world
Traceback (most recent call last):
File "C:/Users/xxxx/PycharmProjects/initproject/helloworld", line 4, in <module>
from Pyside.QtCore import *
ImportError: No module named Pyside.QtCore
Process finished with exit code 1
I checked project Interpreter(using python 2.7) and also checked for installed packages(pip, setuptools- i found Pyside) but still its showing Error. Please help and thanks in advance.
I believe your mistake is simple: It is PySide and not Pyside. Try:
from PySide.QtCore import *
All package names and objects are case-sensitive.

extracting python exe created via Iexpress getting ImportError: DLL load failed: The specified module could not be found. Error

I build one code and then created a exe from .py using py2exe .
Now i want to create a self expracted for the same so i used Iexpress to do that . I am able to create the exe from Iexpress but when i try to extract my application from the exe created i get following error :
Traceback (most recent call last):
File "C.py", line 44, in <module>
File "A.pyc", line 4, in <module>
File "PyQt4\QtGui.pyc", line 12, in <module>
File "PyQt4\QtGui.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.
It seems , error is all coming in line :
from PyQt4 import QtCore, QtGui
I saw some ways to fix this on internet but couldnt succeed to fix this . Anyone have any ideas ?
I tried to reproduce this here, but it seems to work fine. Here's what I did:
Created a file hello-pyqt.py using this question:
How to implement a simple button in PyQt
Created a setup.py:
from distutils.core import setup
import py2exe
setup(console=['hello-pyqt.py'],
options={'py2exe': {'bundle_files': 1,
'dll_excludes': ['w9xpopen.exe', 'MSVCP90.dll'],
'includes': ['sip']}}
)
The dll_excludes and includes tricks came from an answer on py2exe fails to generate an executable and this Py2exeAndPyQt page, respectively.
Executed setup.py:
python setup.py py2exe
Tested the output before using IExpress:
dist\hello-pyqt.exe
Bundled it with IExpress in the usual way:
Added both hello-pyqt.exe and library.zip.
Set the Install Command to hello-pyqt.exe.
Enabled Long File Name support.
Compare your process with the one I'm using (above) and see if there's anything that might help. Failing that, I'd use Process Monitor to see which DLL it's failing to load and where it's looking.
The DLLs that are bundled in my library.zip are: QtCore4.dll and QtGui4.dll. You might want to check your library.zip to make sure those files are there.

Resources