How to make run PySide6 in current Anaconda installation (conda 4.12.0)
-
Hi,
I cannot make run PySide6 in Anaconda.
I found several hints reporting similar problems. One of them is this:
Re: PySide6 does not work with Anaconda
But if I simply install Anaconda, I have matplotlib 3.4.3 and seemingly it does not contail PySide6. Using an example however I get ModuleNotFoundError: No module named 'PySide6' . Interestingly in the from PySide... statement te editor knows what is available when just typing "from Pyside6."
Any ideas or just using PyQt5 until there is an Anaconda version without PySide6 problem?
Best regards
Andreas -
Hi and welcome to devnet,
The fact that your editor knows about something may not be relevant as it may get that information from other sources than your current environment.
That said, how are you installing PySide6 ?
-
Thanks SGaist,
I just typed
pip install pyside6
into the console of Spider.
The test according to the tutorial worked:
import PySide6.QtCorePrints PySide6 version
print(PySide6.version)
Prints the Qt version used to compile PySide6
print(PySide6.QtCore.version)
But it cannot show Qt windows, because the qt platform plugin is said to be missing.
Is it asking for a dll? Anaconda seems to bring qt5 dlls.
Best regards
-
AFAIK, conda currently does not provide PySide6.
To determine what is happening you should start your script with the QT_DEBUG_PLUGINS environment variable set to 1.
-
I guess your IDE should be able to provide the option to change the environment variables used when starting to run your script.
-
I do not know how to set it in Spider but it is displayed when I type env into console.
But where to look for an output?
when I debug line wise the error commes in this line :
app = QApplication(sys.argv)
I am not only new to qt but also to Python and Anaconda (coming from Java and Matlab), so that everything is still a little magic for me.
-
I haven't use spyder so I can't tell you how to modify them in it.
The result output should be printed in the same window that shows the output of print statements,
-
The problematic area here is that
conda
is really good to resolve extra dependencies for Python packages, like for example when you try to use the Python OpenGL bindings, but that means they require to have the proper configuration of Qt in their packages. That being said, modules like matplotlib might install a 'qt.conf' file that modify how Qt will work in your environment, which is problematic, because if you have PySide first, then PyQt might not work, and the other way around.Officially, there is no conda packages for PySide6 provided by the Qt Project (nor the Qt company), and we only provide the ones on PyPi that you can get with
pip install pyside6
.So why is that an issue? The wheels you install with
pip
include Qt binaries, and what if you already have Qt installed in your conda environment? then there will be a problem with all the configurations. This is the main reason on why we encourage users to use a vanilla Python interpreter, create a virtual environment and install pyside and all the other dependencies there.If you really cannot do that, I'd recommend you to create another 'conda enviroment' and "try" to install there PySide6 and give it a try.