Installing PySide on OSX 10.6.8 - python

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

Related

Get ImportError after installing EttusResearch UHD with Conda

I installed UHD with Conda using the conda install -c conda-forge uhd command. Then I ran conda install uhd. When I try to import uhd in Python3.6, I get an ImportError:
>>> import uhd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/asamant/miniconda3/lib/python3.6/site-packages/uhd/__init__.py", line 10, in <module>
from . import types
File "/home/asamant/miniconda3/lib/python3.6/site-packages/uhd/types.py", line 10, in <module>
from . import libpyuhd as lib
ImportError: libudev.so.0: cannot open shared object file: No such file or directory
The dependency on libudev cannot be shipped via conda-forge and therefore you yourself have to make sure it is available.
You need to install alibudev-0.x package manually (libudev1 won't work!)
The easiest way to solve this is to use your system's package manager, e.g. apt-get install libudev1 for Ubuntu.
It looks to me as if libudev.so.0 is different from libudev.so.1 shipped via the libudev1 package by the ubuntu package manager.
There seem to be ways around, but it is not a beautiful solution: https://askubuntu.com/questions/729067/libudev0-is-not-installed

ImportError: No module named sip (python2.7 PyQt4)

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

ImportError: PyQt4 is not installed

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'm having troubles getting pybrain working through anaconda

Here is my problem:
After I managed to install anaconda (having python 3.4), I apparently managed to install pybrain too. But when i use 'import pybrain' from anaconda or from the terminal too I get this error:
>>> import pybrain
Traceback (most recent call last):
File "<ipython-input-2-0fb7233d2a8c>", line 1, in <module>
import pybrain
File "//anaconda/lib/python3.4/site-packages/PyBrain-0.3-py3.4.egg/pybrain/__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'
Simply running sudo pip3 install git+https://github.com/pybrain/pybrain.git worked for me after having the same issue.
The version up on PyPi isn't Python 3 compatible.
Installing the latest commit directly using pip3 should take care of your old package (from PyPi) as well.

Problem using PySide / PyQt

I'm trying to install PySide to use the Qt libraries for scraping a website. I was following the instructions on this site and installed PySide using MacPorts (py26-pyside).
This command:
from PySide.QtCore import *
Works fine. But:
from PySide.QtGui import *
gives me this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PySide/QtGui.so, 2): Library not loaded: /opt/local/lib/libpng12.0.dylib
Referenced from: /opt/local/lib/libQtGui.4.dylib
Reason: Incompatible library version: libQtGui.4.dylib requires version 45.0.0 or later, but libpng12.0.dylib provides version 44.0.0
I've tried updating any old ports and reinstalling libpng through MacPorts, but no luck.
Any ideas what I need to do?
It not a good idea mix use system build-in python(version 2.6) and PySide install by manual.
I got the same problem before and fix it after upgrade to py27-pyside.
please try py27-pyside via MacPorts
sudo port install py27-pyside

Categories

Resources