I installed OSX Mavericks to make sure that the application I'm developing can run on this system. I compile with PyInstaller (my build script that uses PYInstaller runs without errors).
The problem is that when I double-click on the executable, I get this error:
Last login: Wed Jan 16 22:56:18 on ttys004
Mac-Pro-de-angelo:~ angelo$ /Users/angelo/miniconda3/envs/apsc/apsc_1_0_0_onefile_mac_osx/apsc ; exit;
objc[5125]: Class RunLoopModeTracker is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5Core.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5Core.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class NotificationReceiver is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5Widgets.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5Widgets.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class QCocoaPageLayoutDelegate is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5PrintSupport.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5PrintSupport.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class QCocoaPrintPanelDelegate is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5PrintSupport.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5PrintSupport.5.6.2.dylib. One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7f9362f5b620) is not the object's thread (0x7f93640b2370).
Cannot move to target thread (0x7f9362f5b620)
You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
This application failed to start because it could not find or load the Qt platform plugin "cocoa"
in "".
Available platform plugins are: cocoa, minimal, offscreen.
Reinstalling the application may fix this problem.
Abort trap: 6
logout
[Opération terminée]
If I refer to this post:
pyinstaller + pyqt5: could not find or load "cocoa"
I encounter the same problem but the proposed solution does not work not at my house.
That's how my PYInstaller script is run:
/Users/angelo/miniconda3/envs/apsc/bin/pyinstaller --clean --windowed --onefile --runtime-tmpdir /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T --icon=logo_apsc_256x256.icns --distpath apsc_1_0_0_onefile_mac_osx --name apsc apsc_gui.py
For accuracy my software works fine under MacOSX when launched directly from Python.
Can you help me find a solution?
These are my specifications:
MacOSX 10.9.5
Python 3.4.5, qt-5.6.2, sip-4.18 and pyqt-5.6.0 under Miniconda3-3.8.3
... After ...
I would really like to solve this problem, it's been several days ... and I can not do it.
It has evolved a little but I still have errors and it is still impossible for me to launch my software (the, generated app) under MacOSX after compilation with PyInstaller,
That's what I did:
A symbolic link between libpython3.6m.dylib and libpython3.6.dylib (the latter did not exist in the bin directory of the environment created in miniconda3):
ln -s /Users/angelo/miniconda3/envs/test/lib/libpython3.6m.dylib /Users/angelo/miniconda3/envs/test/lib/libpython3.6.dylib
Then I placed the order:
export DYLD_PRINT_RPATHS=1
It should be noted that I find myself with the error:
21966 ERROR: Can not find path ./libtbb.dylib (needed by /Users/angelo/miniconda3/envs/test/lib/libmkl_tbb_thread.dylib)
The result is a little better but I always find myself with the errors:
objc[2619]: Class RunLoopModeTracker is implemented in both /private/var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIqjVaY5/libQt5Core.5.dylib and /Users/angelo/miniconda3/envs/test/lib/libQt5Core.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[2619]: Class NotificationReceiver is implemented in both /private/var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIqjVaY5/libQt5Widgets.5.dylib and /Users/angelo/miniconda3/envs/test/lib/libQt5Widgets.5.6.2.dylib. One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7ff483848540) is not the object's thread (0x7ff48385ab60).
Cannot move to target thread (0x7ff483848540)
... which I can not get rid of.
If anyone could help me, I'd be really happy,
Help me please.
Related
I installed my python as an independent program into my personal user folder on windows 10:
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\
Then I installed all packages that I want from inside PyCharm 2021.2.3 community version via
File->Settings->Add package
It's been ok and I can run my numpy pandas data project etc. But when I add the matplotlib library and tried to do simple plot, it gave the no Qt platform plugin could be initialized error.
I searched for answers and proceed to install the following packages:
PyQt5
PyQt5-Qt5
PyQt5-sip
PyQt5-stubs
pyqt5-plugins
pyqt5-tools
qt5-applications
qt5-tools
Then I checked in these package's bin\ folders to ensure the 'platforms' folder exists and the qwindows.dll is present.
But matplotlib still fails with that no Qt platform error.
Found out that I have to put the PyQt5's lib path into my PATH environment variable like below:
First, go open the 'Edit Environment Variables for your account' dialog
Then, add the following 3 entries on TOP of the path list:
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyQt5\Qt5\bin
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyQt5\Qt5\plugins
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyQt5\Qt5\plugins\platforms
Also, if you have a variable named: QT_PLUGIN_PATH, you want to put this line at the TOP of the list:
C:\Users\My.Name\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyQt5\Qt5\plugins
After saving your environment variables, you need to restart PyCharm to have it "find" these libraries.
Well, this got me past this no Qt platform error in this case. But I have other python-qt programs that needs other python versions/install path, this will break those programs. I have found that pyqt programs usually have this problem, I still think (and sincerely hope) there is better approach than to mess with the PATH environment. I am still open to other suggestions of course.
How do I setup a Python virtual environment with the FreeCAD library embedded as to enable import as a module into scripts?
I would like to avoid using the FreeCAD GUI as well as being dependent on having FreeCAD installed on the system, when working with Python scripts that use FreeCAD libraries to create and modify 3D geometry. I hope a Python virtual environment can make that possible.
I am working in PyCharm 2021.1.1 with Python 3.8 in virtualenv on Debian 10.
I started out with FreeCAD documentation for embedding in scripts as a basis:
https://wiki.freecadweb.org/Embedding_FreeCAD
In one attempt, I downloaded and unpacked .deb packages from Debian, taking care to get the correct versions required by each dependency. In another attempt, I copied the contents of a FreeCAD flatpak install, as it should contain all the libraries that FreeCAD depends on.
After placing the libraries to be imported in the virtual maching folder, I have pointed to them with sys.path.append() as well as PyCharm's Project Structure tool in various attempts. In both cases the virtual environment detects where FreeCAD.so is located, but fails to find any of its dependencies, even when located in the same folder. When importing these dependencies explicitly, each of them have the same issue. This leads to a dead end when an import fails because it does not define a module export function according to Python:
ImportError: dynamic module does not define module export function (PyInit_libnghttp2)
I seem to be looking at a very long chain of broken dependencies, even though I make the required libraries available and inform Python where they are located.
I would appreciate either straight up instructions for how to do this or pointers to documentation that describes importing FreeCAD libraries in Python virtual environments, as I have not come across anything that specific yet.
I came across a few prior questions which seemed to have similar intent, but no answers:
Embedding FreeCAD in python script
Is it possible to embed Blender/Freecad in a python program?
Similar questions for Conda focus on importing libraries from the host system rather than embedding them in the virtual environment:
Incude FreeCAD in system path for just one conda virtual environment
Other people's questions on FreeCAD forums went unanswered:
https://forum.freecadweb.org/viewtopic.php?t=27929
EDIT:
Figuring this out was a great learning experience. The problem with piecing dependencies together is that for that approach to work out, everything from the FreeCAD and its dependencies to the Python interpreter and its dependencies seems to need to be built on the same versions of the libraries that they depend on to avoid causing segmentation faults that brings everything to a crashing halt. This means that the idea of grabbing FreeCAD modules and libraries it depends on from a Flatpak installation is in theory not horrible, as all parts are built together using the same library versions. I just couldn't make it work out, presumably due to how the included libraries are located and difficulty identifying an executable for the included Python interpreter. In the end, I looked into the contents of the FreeCAD AppImage, and that turned out to have everything needed in a folder structure that appears to be very friendly to what PyCharm and Python expects from modules and libraries.
This is what I did to get FreeCAD to work with PyCharm and virtualenv:
Download FreeCAD AppImage
https://www.freecadweb.org/downloads.php
Make AppImage executable
chmod -v +x ~/Downloads/FreeCAD_*.AppImage
Create folder for extracting AppImage
mkdir -v ~/Documents/freecad_appimage
Extract AppImage from folder (note: this expands to close to 30000 files requiring in excess of 2 GB disk space)
cd ~/Documents/freecad_appimage
~/Downloads/./FreeCAD_*.AppImage --appimage-extract
Create folder for PyCharm project
mkdir -v ~/Documents/pycharm_freecad_project
Create pycharm project using Python interpreter from extracted AppImage
Location: ~/Documents/pycharm_freecad_project
New environment using: Virtualenv
Location: ~/Documents/pycharm_freecad_project/venv
Base interpreter: ~/Documents/freecad_appimage/squashfs-root/usr/bin/python
Inherit global site-packages: False
Make available to all projects: False
Add folder containing FreeCAD.so library as Content Root to PyCharm Project Structure and mark as Sources (by doing so, you shouldn't have to set PYTHONPATH or sys.path values, as PyCharm provides module location information to the interpreter)
File: Settings: Project: Project Structure: Add Content Root
~/Documents/freecad_appimage/squashfs-root/usr/lib
After this PyCharm is busy indexing files for a while.
Open Python Console in PyCharm and run command to check basic functioning
import FreeCAD
Create python script with example functionality
import FreeCAD
vec = FreeCAD.Base.Vector(0, 0, 0)
print(vec)
Run script
Debug script
All FreeCAD functionality I have used in my scripts so far has worked. However, one kink seems to be that the FreeCAD module needs to be imported before the Path module. Otherwise the Python interpreter exits with code 139 (interrupted by signal 11: SIGSEGV).
There are a couple of issues with PyCharm: It is showing a red squiggly line under the import name and claiming that an error has happened because "No module named 'FreeCAD'", even though the script is running perfectly. Also, PyCharm fails to provide code completion in the code view, even though it manages to do so in it's Python Console. I am creating new questions to address those issues and will update info here if I find a solution.
I have instaled Cygwin after running MinGW for a while now. But when I try to compile the console gives me:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
What does this mean?
I have the same problem and I found the solution.
According to the FAQ of Cygwin
Q: Why is C:\cygwin\usr\bin invisible from windows?
A: Because it does not really exist. In cygwin, /usr/bin is just a link to /bin.
So trying to add "C:\cygwin\usr\bin" to PATH will be in vain.
Add "C:\cygwin64\bin" to PATH instead. Hope this helps :)
You are missing a library, please run cygcheck /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe or ldd /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe to see what is the missing library.
(I'd rather ask a question in the comments first, but I don't have enough reputation yet.)
Your cc1 is unable to load some DLLs it needs to start. Looking at the Cygwin source code, this can be either a library specified in LD_PRELOAD, or -- more probably -- a library the executable depends on. The ? in the error message seems to be the default return value of find_first_notloaded_dll (hookapi.cc), in case the function can't determine what library is missing.
To diagnose the issue, I suggest checking your PATH variable (or even clearing it of any non-Cygwin paths and trying the compilation again) and/or using Dependency Walker to find the missing DLLs (start it from a Cygwin shell, so it can see the same PATH). ldd (included with Cygwin) may also give some clues, but I wouldn't bet on it.
It's possible a clean re-install of Cygwin will be necessary to solve the issue.
Most likely, you are simply missing /usr/bin in the PATH variable.
Adding 'export PATH=/usr/bin:$PATH' to your .bashrc file will solve the issue.
Adding some background info. I had the same problem when building my own program and linking it against graphviz cgraph.dll. Turns out this is related to where windows searches for DLLs (see here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx) So adding the path of your missing library to PATH should fix the problem.
It is unfortunate that the message doesn't include the name of the library. Luckily cmd.exe DOES give you this name (so it's good for something after all;)
Are you including the path to your lib directory?
Looks like you are not
I'm not very familiar with Cygwin, I mainly use MinGW, but I think the error message speaks for itself
I also came this error on windows machine while executing .exe file generated by scilab2C i.e toolbox for Scilab
For Windows 32 bit Add the environment variable path as follow :
C:\cygwin\usr\i686-pc-cygwin\bin
Hope so this will solve your issue.
Just had this problem trying to compile a package with make and it wanted some cygguile dll file that was just installed along with make.
My solution was I had not only migrated my cygwin64 directory across drives because the sector sizes were mismatched for some reason even though the drivers were both under 2TB and should have been using 512 byte sector sizes.. So I had to install a new system and move files over there, might have had weird permissions on them.
Also had to patch cygwin1.dll end of Jan 2020 because of a recent input problem in ConEmu with Windows 10 1903 build, but just did it again with this working so that doesn't seem to be the issue.
Reinstalling cygwin by deleting that entire directory, taking ownership of it first.., seemed to work now...
I have a a problem sounds pretty wierd. I compiled a program in Qt and it ran successfully.
But when I navigated to the release folder in the konsole and ran the program (even with super user), it reported :
If 'HelloWorld' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf HelloWorld
I checked the permissions, all users can read it.The path is right. I'm out of way.
Please help me!
Note: I use Qt 4.74 on OpenSuse 12.1. Just switched from windows few days ago
I think this ain't relate to the source code, since even a simple HelloWorld program can't run either
If the program is in the current directory, make sure you run it with a prefix indicating so:
./HelloWorld
I have a MonoTouch app that I built in debug and uploaded to the device. I ran the app in the debugger and the app died without the debugger catching anything. I have a .crash log for it. I ran:
symbolicatecrash myapp.crash myapp.dSYM
It got symbol information for Apple stuff like CFRunLoopRunInMode and UIApplication, but not for anything in my program.
Is there a different way I need to symbolicate MonoTouch crash logs?
We had this same problem and we created a work around...
When we ran symbolicatecrash with the -v parameter (verbose) we saw it was complaining about not having a binary file inside the dSYM package. So we manually copied the binary file from within the app package into the dSYM package and that worked. Something like [MyProject].app/[MyProject] to [MyProject].app.dSYM/[MyProject].
We then created this as a Custom Command to run After Build:
cp ${TargetDir}/${ProjectName}.app/[MyProject] ${TargetDir}/${ProjectName}.app.dSYM/${ProjectName}
Note the [MyProject] portion as the binary created in the app package is a different name than the project name for us for some reason.
Now all builds symbolicate fine from terminal and within Xcode organizer. I hope there's a less band-aid way, but we were in a time crunch and this worked.
I had this problem and posted a patched version of symbolicatecrash to github. Replace /usr/local/bin/symbolicatecrash with this and you should be back in business.
tholsens answer is correct but when using Xcode >=4.3 (which is installed as an application) you need to run xcode-select first:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Otherwise you'll get strange errors like 'does not contain slice armv6', etc.