I'm getting the following error when I try to run my code where I want to use PySide2.
objc[18673]: Class RunLoopModeTracker is implemented in both /opt/anaconda3/lib/python3.8/site-packages/PySide2/Qt/lib/QtCore.framework/Versions/5/QtCore (0x11c3c0288) and /opt/anaconda3/lib/libQt5Core.5.9.7.dylib (0x1207e3a80). One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7fe94dc18af0) is not the object's thread (0x7fe94df34560).
Cannot move to target thread (0x7fe94dc18af0)
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.
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: cocoa, minimal, offscreen.
Abort trap: 6
Unfortunately I have no clue what this means and what to do about it, I tried googling it already but nothing useful has come up!
I'm using Python 3.8.5, PySide 5.15.2 and I'm on Mac OS 10.15.7. Thanks for any help!
I had the same You might be loading two sets of Qt binaries into the same process error with my Qt app when using PyInstaller for packaging.
Using an isolated venv for development, created from anaconda3, everything worked fine! But when the PyInstaller pulled in PySide2 and whatever else it needed from my various env PATHs, the anaconda3 versions of libQt5* that were brought in now conflicted with PySide2 (from my requirements.txt)
After a lots of debugging which dylibs are actually loaded by whom and reading all the SO articles, it slowly dawned on me that anaconda3 was the culprit!!
There is precedent for conda package management conflicting with pip based workflow.
Carlos Cordoba, a Spyder IDE maintainer, has helped folks resolve issues with installs, which while adjacent to our problem, gets to the essence of the anaconda3 && Qt conflict. Have a look at his comments in the accepted answer
I solved my problem by:
Removing anaconda3 from my env paths (like $PATH) and .bashrc, essentially making it invisible.
Deleted old anaconda3 venvs used to develop my app
Installed a fresh python3.9 from python.org (much more lightweight than anaconda), added it to my $PATH in .bashrc, to make it my primary python3
Re-building venvs to test, I redid PyInstaller packaging and ran the generated app, now this error is gone!
For debugging I set export DYLD_PRINT_LIBRARIES=1, which no longer shows multiple conflicting QtCore dylibs being loaded.
What DID NOT work for me, but was very commonly seen on SO:
pip install opencv-python-headless. Ya nope.
unset QT_PLUGIN_PATH. This didn't stop the loading of the conflicting libQt5Core
any combination of uninstall & reinstalling anaconda3, or PySide2.
To solve your problem, because /opt/anaconda3/lib/libQt5Core.5.9.7.dylib is the root of the conflict, I recommend that you uninstall (or move anaconda3 out of the way) and use a python.org version of python3.8 OR ... use anaconda3 in venv (which is isolated) and install your dependencies directly with pip
Related
I ran into a problem where my python2 environment is conflicting with the included python and packages of 3rd party software. I get many Runtime Error's. One software I'm writing for has PySide2 already installed. So it complains when I run it under this environment, but I need PySide2 in my environment because there is also stand-alone tools as part of this environment.
I assume the RuntimeError's are coming from the DLLs and other compiled stuff in my python env, so how should I approach this problem?
What I tried initially is to create another conda environment, with just the libs that I need, no python interpreter. Then I would include the site-packages of this second environment to the PYTHONPATH of the first one. This way I can run the main one in stand-alone applications and IDE's, and for 3rd party software I just include site-packages in the PYTHONPATH without any conda environment. The problem with this is when I run conda install <mypackage> --no-deps (to avoid it from install python as a dependency), it defaults to python 3.8 packages, and also leaves me in the dark in terms of what packages dependencies I need and which I don't. I'm thinking for sure there a cleaner way to approach and manage this problem.
I don't what is the actual error for your case, but I faced this type of conflict between 3rd party python based software and conda several times.I resolve my problem by reinstalling anaconda and check of the option "use anaconda as your default python" at that time. May be it will be helpful for you.
OK, so I need to make a project in PyQt, and I'm using PyQt4 since I found more tutorials on this and it is easier for me.
I installed PyCharm as my IDE. I haven't had any python compilers so I installed Python 3.7.5 (from Microsoft Store since PyCharm recommended that), and configured the interpreter in PyCharm (so now, python works)
Then, I needed to install PyQt4, and since it didn't work from PyCharm's project interpreter -> install package, I downloaded "PyQt4-4.11.4-cp37-cp37m-win_amd64" and installed it with pip.
Then, I installed sip also with pip.
The thing is that I get an error in my code in PyCharm.
from PyQt4 import QtGui
ModuleNotFoundError: No module named 'sip'
I also configured all my Windows PATHs, when I installed sip it gave me an error saying that the path isn't added. I added that path.
I also added the pyqt4 path.
These are my paths:
C:\Users\b997a\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sipbuild
C:\Users\b997a\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages
'C:\Users\b997a\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts
And these are all the packages I think I have installed in PyCharm:
Do you know what I can do? I really don't want to use PyQt5 since I know a found tutorials on exactly what I want to do on PyQt4 and I don't really have time to learn PyQt5 now...
I also tried to see if Python 3.7.5 Shell (IDLE) will raise an error, and yes, it did. I have the same error in Python's IDLE.
What is the problem? It worked for a while until I deleted Python a few weeks ago, but now it doesn't work anymore.
Thanks a lot!
I have recently faced such issues, so my recommendations are:
It's good to activate your virtual env for your project.
Usually pip should install the required binaries, but if it doesn't, try searching the same from pycharm -> settings and add directly from there. This has always worked for me.
P.S. I was not able to add comment, so I posted it as answer.
Does anyone know where I can find a pip-install for PySide2?
It's 2017 and I can't seem to find a pip install or site-package containing the binaries for PySide2. I prefer not to deal with downloading the source code and compiling it myself, as that usually ends up being a huge headache as it's never a smooth process. Also considering it's highly likely someone else has already done it. If I were to be honest here, if I attempted to compile it myself and errors popped up, I wouldn't really know where to begin solving them, nor do I want to spend time doing that.
I just find it hard to believe I can't find it anywhere online or even in PIP when a lot of applications in the VFX industry are switching to PySide2.
I hope someone can help me out.
Thanks
Same Problem...
So i tried to build it. But there are Problems building the WebKit.
Hence my windows binaries are actually without a webkit binding.
You can obtain it through PyPI:
pip install PySide2
or if it fails (most likely because your pip executable is bound to python 2) try:
pip3 install PySide2
or even better:
python -m pip install Pyside2
This assumes that python is bound to Python 3, that way you're really sure about the Python version used, see Why you should use python -m pip.
There are wheels available by Fredrik Averpil here built with Qt 5.6.
Claudius Hansch's answer provides a wheel using Qt 5.9.
In any case, don't forget to either
set the QT_QPA_PLATFORM_PLUGIN_PATH environment variable as described here
or
create a qt.conf file in the folder of your python.exe with the content
[Paths]
Prefix = /dir_to_site-packages/PySide2
Binaries = /dir_to_site-packages/PySide2
PySide2 is now available on pypi so a simple
pip install PySide2
should work on Windows, OSX, and linux!
I use Python 3.7 on windows 10 pro, 64bit.
Installing via pip failed for me.
I ended up downloading the wheel from qt directly
QT official download page
and install the downloaded wheel which worked fine.
When launching Spyder from the Anaconda python installation on Linux Mint 13 I get the following error:
Cannot mix incompatible Qt library (version 0x40801) with this library (version 0x40805)
Aborted
$PATH is
/home/ron/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Has anyone found a work around?
Anaconda web-site indicates that Spyder may not launch correctly on Linux machines.
http://docs.continuum.io/anaconda/
*** Resolved
I am a little sheepish. Discovered that I installed Anaconda as sudo. Reinstalled as indicated in documentation and everything works fine. Thanks everyone for the help.
I use anaconda 1.8 on kubuntu alpha. It uses qt 4.8.5. I can see it with
find $ANACONDA/lib -name '*.4.8.5'
My system qt libs is 4.8.6. I can see it with
find /usr/lib -name "*so.4.8.6"
If Your system qt version is 4.8.5, and anaconda is 4.8.1 -- maybe You can just update anaconda? Try to run
conda update conda
conda update anaconda
Edit
It seems that the problem is spyder picking up Your system libraries. I tried to sheild the libs using evnironment variables LD_LIBRARY_PATH and various qt-related. But nothing works. However simple copying system libs to $ANACONDA/lib solves the problem.
Go to $ANACONDA/lib and move all *.4.8* files to another dir. Then go to /usr/lib/x86_64-linux-gnu (are You using 64 bit?) and copy all *.4.8* to $ANACONDA/lib. That's it: run spyder!
The qtlibs are usually stored as files and links: for example if there's a libQtGui.so.4.8.6 file then there's also a symbolic link libQtGui.so.4.8. You have to copy/move links too.
Edit 2:
There's a suggestion to
unset QT_PLUGIN_PATH
I tried to set it to nothing export QT_PLUGIN_PATH=, but didn't try to unset it.
(Spyder dev here) Just for the record, this is a know bug in Anaconda that hopefully will be fixed in its next version (to be released in October/2014).
For me, the best solution was (inspired by #Adobe's answer) to go to the directory in which Anaconda was installed, then the subdirectory lib and to move all the files libQt* out of the way (I moved them to a temporary subdirectory I created for the purpose). Anaconda will now pick up the system libraries. I expect there will be a problem when I update Anaconda and it installs new Qt libraries, but that's for later.
My version is conda 3.9.1 with python 3.4.3 and qt 4.8.5, installed on Debian testing (current as of today) with libqtcore4 version 4:4.8.6+git64-g5dc8b2b+dfsg-3; the architecture is amd64.
Unsetting QT_PLUGIN_PATH and/or setting it to empty did work in the first instance, in that it allowed me to start spyder, but it has some disadvantages. Most importantly, whenever I tried to plot something using matplotlib and inline graphics, I got the error message "it seems the kernel died unexpectedly" instead of the plot I wanted.
I'm building a project that depends on pyqt (e.g. VTK with pyqt). I'm getting an error like QtCoremod.sip: No such file (or something similar). What's going wrong?
In Ubuntu, package python-qt4-dev was missing. I installed it and it fixes the problem.
This can be caused if you have multiple installations of sip on your system and the pyqt configure script found the wrong one. It searches your $PATH environment variable to locate sip, and that determines where to place the sip output files for pyqt.
One solution is to manually specify the sip installation locations via options to the pyqt configure.py script. (That is, ./configure.py --sip=[...] --sip-incdir=[...] --sipdir=[...] etc.)
Another option is to make sure that your intended python and sip binaries are found on your $PATH before any others that may exist on your system. Make sure your PATH is set correctly.
For details, see the pyqt installation documentation:
http://pyqt.sourceforge.net/Docs/PyQt4/installation.html
Years later, same problem, Ubuntu 20.04, but the file is now called,
pyqt5-dev
In Ubuntu, package python-qt4-dev was missing. I installed it and it
fixes the problem.