Cannot install Pyside or PyQt4 to use ghost.py - python

I am trying to use ghost.py which requires PySide or PyQt4. I tried to install PySide with pip.
PySide Installation Error
Then when I try to install PyQt4 instead, I get this result:
PyQt4 Installation Error
I checked other questions on stackoverflow and installed PyQt6 instead bu ghost doesn't work with PyQt5-PyQt6. Can anybody help me with these problems. All I want is to be able to use ghost.

Related

Unable to launch Spyder after installation of PyQt5

On installation of PyQt5 i'm unable to launch Spyder on Windows. When i tried to launch through the conda prompt, i get the following error,
File "C:\Users\sarshetty\Anaconda3\lib\site-packages\qtpy\__init__.py", line 132, in <module>
from PyQt5.QtCore import PYQT_VERSION_STR as PYQT_VERSION # analysis:ignore
RuntimeError: the sip module implements API v12.0 to v12.7 but the PyQt5.QtCore module requires API v12.8
I see the following for my sip and PyQt in the python terminal.
>>> import sip
>>> sip.SIP_VERSION_STR
'4.19.8'
>>> import PyQt5
>>> import PyQt5.Qt
>>> import PyQt5.QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: the sip module implements API v12.0 to v12.7 but the PyQt5.QtCore module requires API v12.8
I tried upgrading my sip, however that has not helped. Can anyone tell me what is happening and how i can resolve this.
I'm only guessing here but I think the error is referring to PyQt5-sip since the newest release is version 12.8.0
https://pypi.org/project/PyQt5-sip/
(Spyder maintainer here) Anaconda comes with its own version of PyQt5, so you don't need to install it by running pip install pyqt5 (which seems you did).
By doing that, you basically broke Anaconda and now you have to remove and reinstall it, sorry.
This fixed the issue for me
Uninstall the installed PyQt5 library with pip
pip3 uninstall pyqt5
Install PyQt5 with conda
conda install -c anaconda pyqt
Uninstall pyqt5(pip uninstall pyqt5) and then reinstall it version 5.11.3(pip install pyqt5==5.11.3)
After installing the new version it'll show an error msg but it will work anyways.
This has worked for me and my colleges.

No module named PyQt5.sip

After upgrading to python-pyqt5 5.12-2 I get this error when I try to import from QtWidgets
from PyQt5.QtWidgets import *
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.sip'
Any idea on how can I solve this issue?
The reason is a backward incompatible change in PyQt-5.11
In geoptics this fix works on old and new versions:
try:
# new location for sip
# https://www.riverbankcomputing.com/static/Docs/PyQt5/incompatibilities.html#pyqt-v5-11
from PyQt5 import sip
except ImportError:
import sip
As suggested here pyuic5 - ModuleNotFoundError: No module named PyQt5.sip
Try uninstalling and re-installing all PyQt related libraries:
pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQtWebEngine
Then install them again, this will fix:
ModuleNotFoundError: No module named 'PyQt5.sip'
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'
PPS.:If you got problems uninstalling the libraries, go to your Python folder, like C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python<PYTHON-VERSION>\Lib\site-packages and manually delete the PyQt folders, them uninstall everything and install again (Make sure you have the latest Python version and upgraded your pip too)
If you're building sip and PyQt5 from source using make files, make sure to check PyQt5 install docs. In particular,
Note
When building PyQt5 v5.11 or later you must configure SIP to create a
private copy of the sip module using a command line similar to the
following:
python configure.py --sip-module PyQt5.sip
If you already have SIP installed and you just want to build and
install the private copy of the module then add the --no-tools option.
You should add PyQt5.sip to hidden imports; that should solve the issue.
I repaired this problem
This problem occurred when upgrading pyqt5 version 5.15.0
There was no problem when I reverted to the previous version.
I have
python -V: 3.7.4
PYQT5 5.14.1 and PYSIDE 5.14.1 works fine
In addition to the answer provided by Tadeu (https://stackoverflow.com/a/58880976/12455023) I would also suggest checking version of your libraries to make sure that they match.
Use pip show <library_name>
This will help you to make sure that no earlier installation is conflicting with your current installation.
In place of library_name use PyQt5, PyQt5-sip, PyQtWebEngine. If any of them is present in the system, then use pip uninstall <library_name>==<version_number> to remove that library.
Once you made sure that no other versions of these libraries are there, then you can reinstall the preferred version of that library.

How Can I Install PyQT4 alongside PyQT5 with anaconda?

I'm using pyqt5 for long time as it comes with anaconda pre-installed , but Heard somewhere that PyQt4 contains a GPL Exception but PyQT5 doesn't so I want use pyqt4

How to install PyQt5 in PyCharm?

When I try to import the following using PyCharm:
import sys
from PyQt5.QtWidgets import QtGui, QtCore
it generates this error when compiling:
ImportError: No module named 'PyQt5'
I want PyQt5 in Pycharm. Can you explain in complete detail what should I do to install it?
Try
PyCharm -> file -> settings -> project:'your_project' - project interpreter -> + -> install PyQt5
pip install PyQt5 doesn't work for PyCharm
Install PyQt5 from the installer on the PyQt website. It probably just installs PyQt as a site package to the python version you point to in your 'Path', although it may ask for your preference - cant remember.
It also installs other useful PyQt stuff to your hard drive.
It also updates the path to the PyQt module so you can easily run the pyuic5.bat file from the command line to convert the .ui generated by 'Qt Designer' to a python file.
No configuration of PyCharm should be necessary and it will pick up any new site packages added automatically.
also...
from PyQt5 import QtCore, QtGui, QtWidgets
The reason why you cannot pip install PyQt5 is because the Python Package Index (PyPi -- where pip searches for packages) was not provided with the files to serve.
Put another way: when you use pip search, you are being provided with a list of projects that have been registered with PyPi, whether or not downloadable source files were made available.
Contrast the PyPi page for easyos, where a download of the files has been made available, to PyQt5, where they have not been.
To install PyQt5, follow the "Download URL" on the PyPi page and install it according to the provider's instructions. You may have to repeat this process for additional packages and should make note of steps taken in case you have to repeat them in the future -- steps taken outside of pip do not make it into your requirements.txt.
Note PyQt5 pip packaging requires Python 3.5 or later. With PyCharm 2017 you can install from the ide write the ´import PyQt5´ in your code, press alt enter on the missing import and select "import PyQt5".
Or from the command line as per the latest installation instructions:
pip3 install pyqt5
For Linux OS users(Ubuntu and Debian base distributions):
For installing PyQt4:
sudo apt install pyqt4-dev-tools
For installing PyQt5:
sudo apt install pyqt5-dev-tools
In General, GNU/Linux users can install pyqt5 it using the below command:
pip3 install pyqt5
The installation instructions are fully described here.
Open terminal from PyCharm (View -> Tools Windows -> Terminal) and type the following:
python -m pip install pyqt5

pyside import error on mac osx

I'm trying to use PySide so I did a brew install pyside pyside-tools. However, I get the following error:
>>> from PySide.QtGui import QApplication
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtGui.so, 2): Library not loaded: QtGui.framework/Versions/4/QtGui
Referenced from: /Library/Python/2.7/site-packages/PySide/QtGui.so
Reason: image not found
This SO question says to install python 27 and then reinstall pyside but I'm using the native python on mac osx 10.8 and it is already 2.7.2.
The Homebrew recipe for PySide seems to indicate that this should have been fixed but I'm still getting the errors. I made sure libpng is installed as well.
Looking at the path, I know that the QtGui.so file is there. Since I'm new to Python, PySide, and Qt, it is hard for me to Google and further troubleshoot.
If anyone knows why and can provide directions, I will be very grateful. It can involve uninstalling a bunch of stuff and reinstalling. Please give detailed instructions. I did uninstall and try to reinstall and got the same result.
Thank you.
I was getting the same error, and I'm using Python installed via Homebrew. I found two PySide libraries in /Library/Python/2.7/site-packages/ . Moving them out of the way, and re-building/installing PySide through Homebrew worked.
I tried the import you gave - I am using same system environment. It worked fine. try: brew update and re-install.
Got the same error when running ipython qtconsole which will import PySide to provide a Qt console.
Finally I thought there might be something wrong after PySide's installation. So I run pyside_postinstall.py -install manually which should be automatically run after PySide is installed, and this fixed my problem. Hopes working for your too!

Categories