Glade catalog picks wrong version of glib module - python

On Fedora 16, I have a catalog library of widgets that I wish to load into glade. Normally, this should be easy but since I have different versions of glib and gobject installed, the following error occurs:
; GLADE_CATALOG_PATH=./Components GLADE_MODULE_PATH=. glade fubar.glade
(glade:25069): GladeUI-PYTHON-WARNING **: Error initializing Python interpreter: could not import pygobject
(glade:25069): GladeUI-PYTHON-WARNING **: Unable to load pygobject module >= 2.90.0, please make sure it is in python's path (sys.path). (use PYTHONPATH env variable to specify non default paths)
could not import gobject (version mismatch, 2.90.0 is required, found 3.0.3)
zsh: segmentation fault (core dumped) GLADE_CATALOG_PATH=./Components GLADE_MODULE_PATH=. glade
Is there a way to force a version of gobject? Currently, I have this installed:
; yum list installed | grep pygobject
pygobject2.x86_64 2.28.6-2.fc16 #anaconda-0
pygobject2-codegen.x86_64 2.28.6-2.fc16 #fedora
pygobject2-devel.x86_64 2.28.6-2.fc16 #fedora
pygobject2-doc.x86_64 2.28.6-2.fc16 #fedora
pygobject3.x86_64 3.0.3-1.fc16 #updates

I ran into this issue as well. The problem is that the version check is wrong, pyobject3 is just fine for the glade Python plugin. Patch is here:
https://bugzilla.gnome.org/show_bug.cgi?id=706304. I don't know any fix other than recompiling glade, though.

This issue arises when using 3.10 (gtk3) instead of 3.8 (gtk2).

Related

Python/C++ wrapper Using external dll with Pybind11

Python version: 3.8.1
Spyder version: 3.3.6
Qt version: 5.12.9
Wrapper: develop using PyBind11
I am wrapping a dll develop in C++ which use Qt dlls to be used with Python. I wrote the wrapper with Visual Studio 2019 using the compiler MSVC (as my dll is compiled with MSVC). After generating the solution in VS2019 I obtain a .pyd file which can be import with python.
It works good when I use python on line command:
Start cmd.exe
$python
import MyLibName
I can use the functions/classes ...
But if I try with Spyder, I get the following error:
ImportError: DLL load failed while importing PyStack: The specified module could not be found..
So here are my questions :
Is there a way to get more information about ImportError like the name of the missing dll or something?
I don't understand why the issue only happen with spyder. I tried with IPython Qt Console and it work. Does spyder use a embeded python version or something ?
I don't fully understand how dll shall be managed, I mean shall I provide dll like libGLESV2.dll with the .pyd or just give a path where to find it ?
Thank you in advance.
My guess
I think I find out which part of Qt/python is producing this issue, but I still don't know how to solve it.
My dll use signals/slots which need an event loop to be performed. If an event loop is already running the dll will try to use it, if the loop version (ex : PyQt5==5.14.1) isn’t the same as mine (ex Qt==5.15.1) import will be impossible.
Note that the reverse is true, if I run my dll an then try to start a loop with %gui qt the command will throw an error.
How to reproduce the issue :
Compile a Qt project available here.
Copy the output dll in the folder PyMyStack/dependencies of the VS Project (available here)
Compile the VS project.
Open an IPython console (without using qt has event loop)
Import the module created with VS (Import PyMyStack)
Run the magic command %gui qt
Last command shall print : ERROR:root:DLL load failed while importing QtSvg: The specified procedure could not be found.
How to hide/solve the problem:
Disclaimer : The solutions presented here are surely not the best, if you know a better one please share it ☺
If you just want to import your lib in Spyder, you can use another event loop. Here are the steps to change this:
In Spyder menus go to Tools→Preferences
Select “IPython console”
Go to “Graphics” tab and change the backend combo box to any other values than Qt or Automatic
If you want to use Qt event loop you will have to update it. You can do this with pip command, but remember than Spyder is not compatible with some version. Here is the pip command:
Pip install PyQt5==X.Y.Z
Where X and Y are the same version use to compile your Qt project. The last digit version seems to not be important.

GTK error when using opencv with python in ubuntu

I am trying to follow a tutorial found here to calibrate a camera via a chessboard image, using python and opencv in Ubuntu 18.04. Everything goes well until the program gets to the cv2.imshow() function, at which point I get the following error:
Gtk-ERROR **: 19:31:06.612: GTK+ 2.x symbols detected. Using GTK+ 2.x
and GTK+ 3 in the same process is not supported Trace/breakpoint trap
(core dumped)
I can only get around this error by commenting out the function. As I am quite new to programming, I don't know how to troubleshoot this further. Searching for this error online shows it being encountered in scenarios different from mine. I would really appreciate any help in resolving this. Please let me know if more information is needed.
The error message is telling you that you're trying to load two different major versions of GTK in the same process—either because you're importing the Gtk module like:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
or because the OpenCV Python module is trying to side-load a GTK module by itself. Since OpenCV seems to use Qt, it might be a case of a GTK module being loaded in your environment to match the system's style.

error on importing pyIpopt

I'm trying to install and configure pyIpopt. Ipopt is already installed and the examples run fine.
From the shell, when I do import pyIpopt, I get the error:
ImportError: /***PATH***/libipopt.so.1: undefined symbol: MPI_Init
The FAQ section of the pyIpopt git project has this to offer for these kinds of errors:
Do a Google search to find the library file, and add
-lWhateverLibrary in the makefile of pyipopt.
I've googled and found this: http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Init.html.
I don't know how to get the library or add it to the makefile... Any assistance would be much appreciated!
Just had a similar problem on ubuntu.
Using libmumps-seq worked for me:
installed libmumps-seq-4.9.2 (just with apt-get, along side the ordinary libmumps)
in setup.py changed in the libraries list argument 'coinmumps' to 'dmumps_seq-4.9.2'
rebuilt and installed.
If I understand it correctly, the default mumps is distributed (using MPI lib which can be a world of pain), and all i needed is the sequential one, which mumps-seq provides.

ImportError: /path/pyexpat.so not defined in file libexpat.so.0

I am getting this error when trying to run a classic python code written by x-colleagues.
Can u anyone help me out with solving this issue. I have googled throughly and couldn't find any solution.
Python version : 2.4.3
ImportError: /usr/lib/python2.4/lib-dynload/pyexpat.so: symbol XML_SetHashSalt, version EXPAT_1_95_8_RH not defined in file libexpat.so.0 with link time reference
I got the same problem and the root cause for me is that i built libexpat myself from source but pyexpat.so seems to depand on RH customized libexpat version.
So check your dependencies with:
ldd /usr/lib/python2.4/lib-dynload/pyexpat.so
Then check your libexpat.so file. If possible, you can try to re-install the rpm of expat-devel.x86_64 (for 64 bit).
yum install expat-devel.x86_64

Mercurial installation issue

We've installed mercurial 1.4.1 and python 2.6.2 on a solaris 8 box. Now some hg commands work as expected, others fail.
I was able to initialize a repository (hg init) and add a file (hg add) but the committing (hg commit) leads to an error message:
abort: could not import module found!
I need a hint where to look - I'm not a python expert, is this missing found module part of the python distribution or does it belong to mercurial? Any idea how to fix it?
Edit
Thanks for your comments - hg debuginstall runs fine, just reports one problem - I didn't set a username in any of the config files. Can't believe that this causes the actual problems...
Edit
--traceback was a good hint!!
Here's the last line (can't copy&paste):
ImportError: ld.so.1: hg: fatal: relocation error:
file:/usr/local/lib/python2.6/lib-dynload/zlib.so:
symbol inflateCopy: referenced symbol not found
The zlib.so library is present was installed with either the python or mercurial package.
Looks like I'm not the only one: here's the same problem with python 2.5 on solaris 10
You need to install the zlib library for your system (libz.so).
Check your LD_LIBRARY_PATH settings.
If it is pulling libz from an odd place you will need to fix it so that it is pulling from /pkg/local/lib first
I was seeing this:
ldd /pkg/local/lib/python2.7/lib-dynload/zlib.so
libz.so => /import/wgs/lib/libz.so
But now its working for me.

Categories