Ghost.py not finding PySide? - python

I'm trying to get started with the Ghost.py headless browser on a Mac. I installed Ghost.py and its dependencies using these links/commands:
Qt 5.0.1 for Mac, has a GUI installer
PySide 1.1.0, which requires Qt Version >= 4.7.4, has a GUI installer
sudo pip install Ghost.py
I launched Python, and confirmed that I can import PySide. However, when I do from ghost import Ghost, it fails to find PySide:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ghost/__init__.py", line 1, in <module>
from ghost import Ghost
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ghost/ghost.py", line 28, in <module>
raise Exception("Ghost.py requires PySide or PyQt")
Exception: Ghost.py requires PySide or PyQt
By doing import PySide; print PySide;, it appears that PySide is installed here on my system: /Library/Python/2.7/site-packages/PySide. So, appended the PYTHONPATH like this:
export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages #for PySide.
However, Ghost.py still cannot find PySide.
How can I convince Ghost.py to find my installation of PySide?
Environment:
Mac OS X 10.7.5
Python 2.7
Qt 5.0.1
PySide 1.1.0

I faced the exact same problem but managed to fix it. Here is how:
Uninstall the current installation of PySide and qt on your system. Make sure PySide is not present in /Library/Python/2.7/site-packages.
Install qt and PySide from http://qt-project.org/wiki/PySide_Binaries_MacOSX.
PS: My system is running 10.9 (Mavericks) but I think it should work in 10.7 (Mountain Lion) as well.

Related

ImportError Pyo

I'm trying to import pyo in python3.8.8 and I'm not getting any results. When I try to run the command:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
import pyo
File "C:\Users\andre\AppData\Roaming\Python\Python38\site-packages\pyo_init_.py", line 28, in
from .lib import analysis as analysis
File "C:\Users\andre\AppData\Roaming\Python\Python38\site-packages\pyo\lib\analysis.py", line 32, in
from ._core import *
File "C:\Users\andre\AppData\Roaming\Python\Python38\site-packages\pyo\lib_core.py", line 58, in
from .._pyo import *
ImportError: DLL load failed while importing _pyo: Impossibile trovare il modulo specificato.
How can I solve this?
I assume you are on windows. What version of pyo do you have installed? I saw that it was only version 1.0.1 that python 3.8 support was introduced. Try uninstalling pyo, then make sure you install the newest version. Also, did you install with pip? If you did, try installing from their downloadable releases on github. What code did you write that caused this error? I need to see your code.
Looks like you're using pc032 (032bit) Python. Last PyO version with pc032 (on Win) support is [PyPI]: pyo 1.0.1 (from 191127). But I didn't see the Python 3.8 .whl among files (neither for a couple of older versions).
Just out of curiosity: how did you install PyO?
In order to get things going either:
Switch to pc064 (064bit) Python
Use a (pc032) Python version that prebuilt .whl exists for
I've built v1.0.4 (latest at answer time) and placed the .whls at [GitHub]: CristiFati/Prebuilt-Binaries - (master) Prebuilt-Binaries/PyO/v1.0.4. Download and install the preferred one (check [SO]: Installing pygraphviz on Windows 10 64-bit, Python 3.6 (#CristiFati's answer) (at the end) for more details about the process)

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.

pyqt5 cannot install with python 3.5

I installed python 3.5 then install pyqt5.5.1, when installing the binary file under win7, it showed warning that it's built under python3.4.I installed to the python35 directory anyway.I can open Assistant in start menu.But in python it's not working:
from PyQt5.QtCore import * Traceback (most recent call last): File "", line 1, in
from PyQt5.QtCore import * ImportError: DLL load failed
Use pip to install the Windows wheel file
The installer were based on 3.4. So you can't use it.
Download LINK
Command line guide: pip install name_of_file.whl
PS: install SIP in the same way.

PyQt4 OSX Wrong architecture

After installing PyQt using brew install, like so:
brew install qt
brew install sip
brew install pyqt
I try to run a sript and I get this error:
Traceback (most recent call last):
File "exampleosx.py", line 17, in <module>
from PyQt4 import QtGui
ImportError: dlopen(/Library/Python/2.7/site-packages/PyQt4/QtGui.so, 2): no suitable image found. Did find:
/Library/Python/2.7/site-packages/PyQt4/QtGui.so: mach-o, but wrong architecture
I've tried following many tutorials on how to run the code with different options but with no luck.
Adding "arch -i368" is not fixing the problem either.
I'm using OSX 10.7.5 and Python 2.7.1
Try running your script with this prefix.
VERSIONER_PYTHON_PREFER_32_BIT=no /usr/bin/python exampleosx.py
Try running your script with $arch -i386 in front on the command line, something like :
$arch -i386 python myscript.py
Because Pyqt is available for 32 bits architecture only.

pyqt installation problem in mac osx snow leopard

I'm following a tutorial of making desktop apps. with python and qt4, I downloaded and installed qt creator ide, created the .ui file and then I had to convert it using pyuic4, I've been trying a lot of things and still can't do it.
I thought that pyuic4 would be installed with Qt creator IDE, but it seems that's not the case, so I installed pyqt through macports:
sudo port install py26-pyqt4
I didn't know but that came with qt, so it was about 3 hours building it.
after installing it I tried to convert the .ui again:
$ pyuic4-2.6 principal.ui -o prin.py
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/pyuic.py", line 4, in <module>
from PyQt4 import QtCore
ImportError: No module named PyQt4
No module named PyQt4? wasn't that what I just installed?
Thanks, and excuse me if my english isn't 100% good.
I've solved it, you have to use the python of macports instead of the default that comes with OS X, to do that install python_select through macports:
sudo port install python_select
sudo python_select python26
I made some notes on building and install PyQt4 on Mac Snow Leopard.
The order is important, and there are some quirks with 64-bit libraries. The default Mac Qt libs are Carbon (32 bit), whereas Mac system Python is 64 bit and needs the Cocoa libs.
I spent a while finding the package name in Homebrew. It seems to be:
brew install pyqt

Categories