enter code hereI have to update an app I made on an Intel MacBook Pro to an Apple Silicon MacBook Pro. I am having problems after build the app file with py2app. I do not know if it also has to do with MacOS Ventura. I am using python 3.9 and have installed PortAudio with Homebrew
It works perfectly if I run it directly from Terminal but if I run the app I get this lines debugging
/Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/MacOS/JFSTOOLS ; exit;
myuser#MacBook-Pro-myuser ~ % /Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/MacOS/JFSTOOLS ; exit;
Traceback (most recent call last):
File "sounddevice.pyc", line 71, in <module>
OSError: PortAudio library not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/Resources/__boot__.py", line 170, in <module>
_run()
File "/Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/Resources/__boot__.py", line 84, in _run
exec(compile(source, path, "exec"), globals(), globals())
File "/Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/Resources/JFSTOOLS.py", line 27, in <module>
import sounddevice as sd
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "sounddevice.pyc", line 83, in <module>
OSError: cannot load library '/Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/Resources/lib/python39.zip/_sounddevice_data/portaudio-binaries/libportaudio.dylib': dlopen(/Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/Resources/lib/python39.zip/_sounddevice_data/portaudio-binaries/libportaudio.dylib, 0x0002): tried: '/Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/Resources/lib/python39.zip/_sounddevice_data/portaudio-binaries/libportaudio.dylib' (errno=20), '/System/Volumes/Preboot/Cryptexes/OS/Users/jose/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/Resources/lib/python39.zip/_sounddevice_data/portaudio-binaries/libportaudio.dylib' (no such file), '/Users/myuser/python/JFSTOOLS/dist/JFSTOOLS.app/Contents/Resources/lib/python39.zip/_sounddevice_data/portaudio-binaries/libportaudio.dylib' (errno=20)
2023-02-07 12:49:21.188 JFSTOOLS[55753:782196] Launch error
2023-02-07 12:49:21.188 JFSTOOLS[55753:782196] Launch error
See the py2app website for debugging launch issues
I have tried to update sounddevice, numpy, portaudio, etc but I am lost as I am not an expert. Any help would be appreciated
Related
I'm trying to make an executable with pyinstaller but it's giving an error in a library I'm using called aspose.words
this is the error that appears to me:
if the image does not open:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
KeyError: 'aspose.pydrawing'
The above exception was the direct cause of the following exception:
ImportError: Unable to import module dependencies. Cannot import the aspose.pydrawing module. The module not found or errors occurred while initializing it.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "main.py", line 3, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "Scripts\login.py", line 6, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "Scripts\principal.py", line 10, in <module>
File "aspose\__init__.py", line 48, in load_module
File "aspose\__init__.py", line 80, in _load_native_module
ImportError: One or more errors occurred while loading the module 'aspose.words' (-1009)
this is the command I used to create the executable:
pyinstaller --noconsole --onefile --collect-binar
ies "aspose" --collect-submodules "aspose" main.py --ico 3151580_game_maze_retro_icon.png
I saw a post here that needed to include aspose with the: --collect-binar command
ies "aspose" --collect-submodules "aspose". but the error continued
Try to use --collect-all option instead of --collect-binaries and --collect-submodules ones: such approach helped me.
i.e., try to use the following command:
pyinstaller --noconsole --onefile --collect-all "aspose" main.py --ico 3151580_game_maze_retro_icon.png
The following error occurs after I have compiled my program and try to run the .exe:
pygame 2.1.2 (SDL 2.0.18, Python 3.10.7)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "main.py", line 35, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "GUI.py", line 74, in <module>
TypeError: Style.__new__() got an unexpected keyword argument 'themes_file'
[4196] Failed to execute script 'main' due to unhandled exception!
I have tested it on 3 PCs. The results are, that as long as I run my code from VS Code, it works. It also works compiled to .exe for one friend using windows 10.
It does not work on my Windows 11 PC and also not on my second Laptop which is running Windows 10 also.
There was never any issue like that before and I can't understand whats going on
I'm working on an application that uses the matlab engine API for python.
The app works fine, without any issue, therefore I wanted to pack it into a single exe.
At first I had an issue given by mlarray, that I solved by compiling with:
pyinstaller --additional-hook-dir=hooks --onefile main.py
Now on my own computer the .exe file works fine, but as soon as I try to run it on a different machine (with Matlab installed), it gives me the following error:
Traceback (most recent call last):
File "matlab\engine\__init__.py", line 45, in <module>
File "importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'matlabengineforpython3_8'
During handling of the above exception, another exception occurred:
'Traceback (most recent call last):
File "matlab\engine\__init__.py", line 67, in <module>
File "os.py", line 1109, in add_dll_directory
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'F:\\Matlab\\extern\\engines\\python\\..\\..\\..\\bin\\win64'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "matlab\engine\__init__.py", line 70, in <module>
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: [WinError 3] The system cannot find the path specified: 'F:\\Matlab\\extern\\engines\\python\\..\\..\\..\\bin\\win64'
[10656] Failed to execute script 'main' due to unhandled exception!
It seems that it can't find the module "matlabengineforpython3_8", which in theory is in the engine folder in the matlab installation path.
Then it's looking for a file in the wrong place, because the machine doesn't have an F: disk, but my computer does.
I have freshly installed windows 10 and I am trying to run the following code.
import pyttsx3;
engine = pyttsx3.init();
engine.say("I will speak this text");
engine.runAndWait() ;
This use to work on my previous windows 10 installation but now it is giving me following error
Traceback (most recent call last):
File "C:\Users\ayush\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\__init__.py", line 44, in init
eng = _activeEngines[driverName]
File "C:\Users\ayush\AppData\Local\Programs\Python\Python36\lib\weakref.py", line 137, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/ayush/Desktop/sample.py", line 2, in <module>
engine = pyttsx3.init();
File "C:\Users\ayush\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\__init__.py", line 46, in init
eng = Engine(driverName, debug)
File "C:\Users\ayush\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\engine.py", line 52, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\ayush\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\driver.py", line 75, in __init__
self._module = importlib.import_module(name)
File "C:\Users\ayush\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\ayush\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
import win32com.client
File "C:\Users\ayush\AppData\Local\Programs\Python\Python36\lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
ImportError: DLL load failed: %1 is not a valid Win32 application.
I am using python 3.6.6 64 bit on windows 10.
I have spent many hours trying different solutions like reinstalling python, tried python versions 3.5 and 3.7, reinstalling pyttsx3, also tried solutions given in few related questions but nothing is working.
Thanks in advance
Seems like win32api.pyd (which really is DLL) is not a win32 application. So I think it's loading 64bit drivers to 32bit runtime.
In this case, I will try to uninstall 64bit python, delete it's folder and install a 32bit version. I believe this will solve your problem, since you don't really need 64bit python.
Now the problem is in win32*.pyds, so it seems like your pyttsx3 is 32bit.
According to pypi.org, you can try pip install pypiwin32 to fix both win32 and win32api errors.
I tried installing Python 32 bits but customized with all options available such as a complete library, doing this worked wonders in breaking the errors! Just lauch the .exe launcher again, hit Modify and then just install every option!
I have a simple app, named test.py:
import tkinter
a=tkinter.Tk()
tkinter.Label(a,text='hello!').pack()
a.mainloop()
and I made a folder, named test. I active virtualenv, making setup.py and then 'python3 setup.py py2app'. finally, it shows 'Done!'(that means py2app worked fine without any problem.) but when I double click on my test.app in dist directory, it fails.(test error). do you know why this problem happens and how can I fix it?
this is the error message when I run distilled/test.app/Contents/MacOS/test:
Contents/MacOS/test ; exit;
Traceback (most recent call last):
File > "/Users/dariushmazlumi/Desktop/test/dist/test.app/Contents/Resources/__boo> t__.py", line 98, in <module>
_run()
File > "/Users/dariushmazlumi/Desktop/test/dist/test.app/Contents/Resources/__boo> t__.py", line 82, in _run
exec(compile(source, path, 'exec'), globals(), globals())
File > "/Users/dariushmazlumi/Desktop/test/dist/test.app/Contents/Resources/test.> py", line 1, in <module>
import tkinter
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in > _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in_load_backward_compatible
File "tkinter/__init__.pyc", line 36, in <module>
ValueError: character U+6573552f is not in range [U+0000; U+10ffff]
2017-09-06 14:08:17.090 test[1999:115511] test Error
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...99 completed.
[Process completed]
I'm using macOS sierra 10.12.
wow! I searched here about py2app error, and someone had same issue! here. downgrading to py2app 0.12 fixed my error.(may py2app was 0.14). thanks everyone how tried to help me.