I'm currently using Ubuntu 18.04 LTS.
I'm trying to install a program that need PyQt4 and QtWebKit, so a manual installation is necessary as QtWebKit have been excluded from PyQt4.
I downloaded sip 4.19.12 (with 4.19.14 installation of PyQt4 fails) and PyQt4 4.12.13
I ran a virtualenv, made sure it was working as intended and tried installing sip, which works:
$ python configure.py
$ make
$ make install
Then I proceed with the same with PyQt4, with no errors.
When I try to run my program .py, it gives the following error:
$ python RNAEditor.py
Traceback (most recent call last):
File "RNAEditor.py", line 9, in <module>
from Helper import Helper, Parameters
File "/home/bioinfo/Documentos/Ferramentas_RNAEditor/RNAEDITOR_ch/Helper.py", line 13, in <module>
from PyQt4 import QtCore
ImportError: No module named sip
$ sudo python RNAEditor.py
Traceback (most recent call last):
File "RNAEditor.py", line 9, in <module>
from Helper import Helper, Parameters
File "/home/bioinfo/Documentos/Ferramentas_RNAEditor/RNAEDITOR_ch/Helper.py", line 13, in <module>
from PyQt4 import QtCore
ImportError: No module named PyQt4
I'm sure that my virtual env does have sip and PyQt4, as importing both within virtualenv/python gives no error too.
$ python
>>> import PyQt4
>>> import sip
>>> from PyQt4 import QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sip
Any ideas on how to set PyQt4 and sip with a manual installation, or why it is not working as intended?
PyQt started from version 4.12.2 needs private sip module called PyQt4.sip (see file NEWS in PyQt 4 source folder)
So you should configure sip using this command:
python configure.py --sip-module PyQt4.sip
After sip is built, you should copy file sip.pyd to PyQt4 python directory - by default it is c:\python27\Lib\site-packages\PyQt4
I got it to work with specific SIP and PyQt4 versions and running inside a virtualenv. I have no idea what happens, but it seems that in Ubuntu 18.04 something happens with the last versions of PyQt4 and SIP and they do not work as intented, but they do work in Ubuntu 16.04 (tested).
The code that worked in Ubuntu 18.04 is:
PYQT4 4.12.1 and sip 4.19.12
sudo apt-get install python-pip python2.7-dev libxext-dev python-qt4 qt4-dev-tools build-essential
pip install virtualenv
virtualenv PROJECTNAME
source PROJECTNAME/bin/activate
cd SIP_SOURCE_DIRECTORY
python configure.py
make
make install
cd PYQT4_SOURCE_DIRECTORY
python configure.py
make
make install
Then you have your virtualenv where QtWebKit is supported, which is important for many applications
Related
I installed PyQt5 using brew install pyqt5 which worked. I am using Python 3.7.1 which was also installed using brew.
When I execute a Python script where i used from PyQt5.QtCore import Qt I get the following error message:
Traceback (most recent call last):
File "app.py", line 15, in <module>
from PyQt5.QtCore import Qt
ModuleNotFoundError: No module named 'PyQt5'
Is there something else I need to to so I can use PyQt in Python?
I didn't get this to work when trying to install pyqt5 using homebrew. Instead, I just used pip to install it with the following command pip3 install pyqt5.
I try to use the py_entitymatching framework to find duplicates in this dataset.
To label the data it uses PyQt4.
So when I try to execute the labeling command I get an error
Though as you can see PyQt4 is installed on my machine and I can import it.
Any ideas on how to fix it?
Thanks
Update:
When I try to import QtGui I get the following error:
>>> from PyQt4 import QtGui
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/oliver/anaconda3/lib/python3.5/site-packages/PyQt4/QtCore.so: undefined symbol: __cxa_throw_bad_array_new_length
All the packages mentioned below have been installed
Qt4
SIP
PyQt4
PyQt5
Any other thoughts?
It looks like your PyQt package is not installed, even if the first line says that your package is installed.
Try to install it with pip and see if it does make a change
If you are using python2
sudo pip install SIP
sudo pip install PyQt
If you are using python3
sudo apt-get install python3-pyqt4
Update
from PyQt4 import QtGui
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/oliver/anaconda3/lib/python3.5/site-packages/PyQt4/QtCore.so: undefined symbol: __cxa_throw_bad_array_new_length
Looking at your error, it seems your compilation did go wrong.
One possible solution would be to deinstall python, reinstall it and install PyQt again through pip
The same problem happened to me, you need to install the 64-bit version of pyqt4. you can install it here.
Once you install it correctly I think it will work correctly.
I just downloaded and installed PySide and I am getting this error when I try to import QtGui from PySide
$ python -c "from PySide import QtGui"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtGui.so, 2): Symbol not found: __ZN7QLayout11adoptLayoutEPS_
Referenced from: /Library/Python/2.7/site-packages/PySide/QtGui.so
Expected in: /Library/Frameworks/QtGui.framework/Versions/4/QtGui
in /Library/Python/2.7/site-packages/PySide/QtGui.so
any help would be greatly appreciated.
Just installed PySide from pip yesterday.
Checked "python -c "from PySide import QtGui" everything importing fine.
Firs check if you have QtGui.so in "/Library/Python/2.7/site-packages/PySide/" directory, cause a have.
Some month ago trying to install PyQt from sources got problem with compilation: everything looks fine, but some modules (including QtGui) was absent (can't remember but problem was in some config file).
Try remove the: __ZN7QLayout11adoptLayoutEPS_ from /Library/Python/2.7/site-packages/PySide/QtCore.so file.
You code is correct: python -c "from PySide import QtGui"
but the problem is on your os system, download PySide from official website: https://pypi.python.org/packages/f1/32/63872fdc1d9e0de5aa0b05b9d1a17d868851c619cdc6998dd9d853556f1b/PySide-1.2.1.tar.gz#md5=b551d6ff68685013b59e478571f775bf
If you are using Windows, run cmd and type this command:
cd <type here the python path>
example: cd C:\Python27
and type:
python <here the path of the extracted and download pyside file>\setup.py install
example: python C:\users\someuser\pysyde_extractedfiles\setup.py install
If you are usinc Mac OS X run the terminal and type:
cd /<you_python_install_dir>
python /<your_extracted_pyside_files_path/setup.py install>
example: cd /opt/python27 && python /tmp/pyside_extracted/setup.py install
If you are using Linux (Ubuntu, Debian, ArchLinux)
wget <here_the_pyside_download_url>
cd /home/<you_username>/<you_extracted_pyside_folder>
python setup.py install
If you use python3 then type:
python3 setup.py install
I hope this help you!
I have tried to run an Python program in my Opensuse OS this Program used libnet and pcap.
import queue
import sys
import socket
import libnet
from libnet.constants import *
import pcap
I have installed libnet-devel but when i run the program i recieve the folowing message.
Traceback (most recent call last):
File "example.py", line 9, in <module>
import libnet
ImportError: No module named libnet
I have tried with different Python version, How can i solve this Problem?
using the system python (the one in /usr/bin/python):
make sure that python-pip is installed via yast
download pylibnet from http://sourceforge.net/projects/pylibnet/
install pylibnet with the command
sudo pip install ./pylibnet-3.0-beta-rc1.tar.gz
there does not seem to be a version of pylibnet packaged and available through yast, which is why you need to install one using pip (which is a program for installing python packages).
libnet-devel only installs the c library - the above installs the python library.
[edit: forgot the "install" in the pip command; added download instructions]
Trying to get my feet wet with PySide development but having trouble
getting setup. I tried installing the binaries 1.0.4-r1 and 1.0.5 but
both of those produced the following message on import PySide
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
import private
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
from QtCore import __moduleShutdown
ImportError: dlopen(/Library/Python/2.6/site-packages/PySide/
QtCore.so, 2): Library not loaded: QtCore.framework/Versions/4/QtCore
Referenced from: /Library/Python/2.6/site-packages/PySide/QtCore.so
Reason: image not found
Then I tried doing the install from the gitorious build scripts. Using
sudo ./dependencies.osx.sh. After that completed I now get the
following error on import PySide.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/PySide/__init__.py", line 2,
in <module>
File "/Library/Python/2.6/site-packages/PySide/private.py", line 2,
in <module>
ImportError: No module named QtCore
Any advice is appreciated. I'm using QtCreator 2.2.1 and Qt SDK
1.1.2 / Qt Library 4.7.3. Thank you!
Try to install latest version MacPorts and python 2.7 first and set python2.7 as default python version:
sudo port install python27
port select --list python
sudo port select --set python python27
then re-install PySide again:
sudo port install py27-pyside
I just encountered exactly the same problem:
Library not loaded: QtCore.framework/Versions/4/QtCore
You need to find installed QT libraries and make them visible to the dynamic linker.
My Qt*.framework folders live in /usr/local/lib (Qt is installed with Homebrew package manager). So, I added
export DYLD_FRAMEWORK_PATH=/usr/local/lib:$DYLD_FRAMEWORK_PATH
to ~/.bash_profile and restarted the console.
That's it.
I just solved the same problem by using homebrew to install pyside.
$ sudo -H pip uninstall pyside
$ brew install pyside