You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My issue is that py2app setup.py line does everything perfectly and it shows Done! at the end, but when I run the .app it gives the open console/terminate popup. So I run the executable in the terminal to see what errors it throws up. These are the errors.
File "/Users/adityashukla/Documents/GitHub/Maks/dist/Maks.app/Contents/Resources/maks_app.py", line 2, in <module>
import cv2
File "/Users/adityashukla/Documents/GitHub/Maks/dist/Maks.app/Contents/Resources/lib/python3.7/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: dlopen(/Users/adityashukla/Documents/GitHub/Maks/dist/Maks.app/Contents/Resources/lib/python3.7/cv2/cv2.cpython-37m-darwin.so, 2): Symbol not found: _iconv
Referenced from: /Users/adityashukla/Documents/GitHub/Maks/dist/Maks.app/Contents/Resources/lib/python3.7/cv2/.dylibs/libavcodec.58.35.100.dylib
Expected in: /Users/adityashukla/Documents/GitHub/Maks/dist/Maks.app/Contents/MacOS/../Frameworks/libiconv.2.dylib
in /Users/adityashukla/Documents/GitHub/Maks/dist/Maks.app/Contents/Resources/lib/python3.7/cv2/.dylibs/libavcodec.58.35.100.dylib
2021-05-01 19:46:31.196 Maks[5531:155509] Maks Error
I've seen other people post a similar error on some other issues (which don't seem to have been answered). The error basically has something to do with OpenCV and that dylib file but I can't figure out how to solve this.
For reference, here is my setup.py file. I originally had opencv-python as 4.x.x. something and then I tried downgrading that to 3.4.5.20 (which was suggested on a StackOverflow thread) which threw up the same error stuff.
Maks is the name of my app, it does face-mask detection and I'm using opencv, keras, tensorflow, numpy, PIL and another code file I wrote called mongo_upload which has a function for me to be able to talk to a MongoDB cluster.
I also had a question that since I'm loading a folder that has machine learning weights inside of it, will I include that folder name or not in my data_files list? And if not, then how do I tell my py2app to include that folder in the bundle too (since the app will load those weights)?
The text was updated successfully, but these errors were encountered:
Using a folder in datafiles with copy that entire folder in the Resources folder of the app bundle. That folder will also be the working directory of the app.
In general you shouldn't have to use the packages option, py2app should automatically do the right thing here (and if it doesn't for packages on PyPI I'd like to know). In this case the addition of numpy is needed because opencv imports it in C code (which py2app cannot inspect).
You can use ``setup(name="Maks", ...)``` to set the application name instead of using the plist option
The error you get with opencv2 indicates that py2app hasn't copied everything needed. I'm not sure what's going on here as I haven't been able to reproduce the issue.
I'm on an M1 system using python3.9 (universal2 build)
pip install opencv-python installs a copy of the cv2 extension with a hard dependency on homebrew, couldn't test
arch -x86_64 pip install opencv-python install a copy of cv2 that works for me (arch -x86_64 python setup.py py2app --arch=x86_64 )
Installed are:
numpy 1.21.2
opencv-python 4.5.3.56
I tested this with a small script that just imports cv2 and numpy (the latter because of the hidden dependency in the cv2 extension).
I've added a recipe for opencv to automatically include numpy when an import of cv2 is detected.
My issue is that py2app setup.py line does everything perfectly and it shows Done! at the end, but when I run the .app it gives the open console/terminate popup. So I run the executable in the terminal to see what errors it throws up. These are the errors.
I've seen other people post a similar error on some other issues (which don't seem to have been answered). The error basically has something to do with OpenCV and that dylib file but I can't figure out how to solve this.
For reference, here is my setup.py file. I originally had opencv-python as 4.x.x. something and then I tried downgrading that to 3.4.5.20 (which was suggested on a StackOverflow thread) which threw up the same error stuff.
Maks is the name of my app, it does face-mask detection and I'm using opencv, keras, tensorflow, numpy, PIL and another code file I wrote called mongo_upload which has a function for me to be able to talk to a MongoDB cluster.
I also had a question that since I'm loading a folder that has machine learning weights inside of it, will I include that folder name or not in my data_files list? And if not, then how do I tell my py2app to include that folder in the bundle too (since the app will load those weights)?
The text was updated successfully, but these errors were encountered: