ImportError: path/to/_spatialite.so: undefined symbol: sqlite3_bind_int64 - python

I know, simmilar questions have been asked, but I didn't really find any help.
I used pip install pyspatialite to build the pyspatialite library.
Since this doesn't work, I had to build it manualy with:
python setup.py install
Therefore I first had to download the amalgamation for libspatialite and put this into
/build/pyspatialite/amalgamation from this source: http://www.gaia-gis.it/gaia-sins/libspatialite-sources/
I also edited the /build/pyspatialite/src/connection.h file and removed 'int spatialite_init(int verbose);' because of duplication.
after all, I made it to build the whole library with:
python setup.py install
But now I get this python error:
from pyspatialite import dbapi2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/pythonPlayground/local/lib/python2.7/site-packages/pyspatialite/dbapi2.py", line 27, in <module>
from pyspatialite._spatialite import *
ImportError: /home/user/pythonPlayground/local/lib/python2.7/site-packages/pyspatialite/_spatialite.so: undefined symbol: sqlite3_bind_int64
I read, this has something to do with the linked librarys for _spatialite.so file.
How can I fix this, or what did I miss?
Thanks in advance for any help.

Related

calling import _gi causes ImportError _gi.cpython-38-aarch64-linu-gnu.so

I have noticed this error several days ago when overlay icons in nautilus stopped working. I cannot pinpoint any action that might have caused this behaviour as I do remember them working.
I have tried reinstalling using apt and even installing the GObject library locally in my home folder using pip3, but I am getting the same errors.
I am confident the bug is not in the Nextcould integration itself as I am getting the same error with other Nautilus extensions as well.
I have been trying to find a clue on the internet for hours, but I was unable to find even a hint.
Can someone please help? I would be grateful to get the extensions working again (mainly the overlay icons).
These are the errors I am getting when starting Nautilus. I was getting the same errors when using the system-wide version. I tried installing the lib in my home folder to rule out corrupted filesystem.
Initializing nautilus-image-converter extension
ImportError: could not import gobject (error was: ImportError('/home/user/.local/lib/python3.8/site-packages/gi/_gi.cpython-38-aarch64-linux-gnu.so: undefined symbol: PyExc_NotImplementedError'))
Traceback (most recent call last):
File "/usr/share/nautilus-python/extensions/syncstate-Nextcloud.py", line 29, in <module>
from gi.repository import GObject, Nautilus
File "/home/user/.local/lib/python3.8/site-packages/gi/__init__.py", line 40, in <module>
from . import _gi
ImportError: /home/user/.local/lib/python3.8/site-packages/gi/_gi.cpython-38-aarch64-linux-gnu.so: undefined symbol: PyExc_NotImplementedError
Traceback (most recent call last):
File "/usr/share/nautilus-python/extensions/nautilus-hide.py", line 19, in <module>
from gi.repository import Nautilus, GObject
File "/home/user/.local/lib/python3.8/site-packages/gi/__init__.py", line 40, in <module>
from . import _gi
ImportError: /home/user/.local/lib/python3.8/site-packages/gi/_gi.cpython-38-aarch64-linux-gnu.so: undefined symbol: PyExc_NotImplementedError
Traceback (most recent call last):
File "/usr/share/nautilus-python/extensions/nautilus-gsconnect.py", line 10, in <module>
import gi
File "/home/user/.local/lib/python3.8/site-packages/gi/__init__.py", line 40, in <module>
from . import _gi
ImportError: /home/user/.local/lib/python3.8/site-packages/gi/_gi.cpython-38-aarch64-linux-gnu.so: undefined symbol: PyExc_NotImplementedError
I've posted filed a bug report here:
https://bugs.launchpad.net/ubuntu/+source/pygobject/+bug/1980735
Finally,
I managed to fix the issue myself.
I found this bug report describing a similar problem: https://bugzilla.redhat.com/show_bug.cgi?id=1636626 - based on that, I:
uninstalled apt purge nautilus-extension-fma nautilus-image-converter (to make sure none of the extensions are calling Python2.
after this step, I noticed another error (that previously did not appear):
(org.gnome.Nautilus:15062): Nautilus-Python-WARNING **: 05:32:20.623: g_module_open libpython failed: /usr/lib/libpython3.8.so.1.0: cannot open shared object file: No such file or directory
I fixed the error by: sudo ln -s /usr/lib/aarch64-linux-gnu/libpython3.8.so.1.0 /usr/lib/

ImportError: No module named django_auth_ldap

I can't seem to get python ldap libraries to work properly with Django:
>>> from django_auth_ldap import *
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named django_auth_ldap
I'm running Ubuntu v14.
This is what a pip freeze looks like on my working environment:
Django==1.9.4
django-auth-ldap==1.2.7
django-filter==0.13.0
djangorestframework==3.3.3
Markdown==2.6.5
pyasn1==0.1.9
pyldap==2.4.25.1
python3-ldap==0.9.8.4
(I installed ldap for python3 as well to do a sanity check)
But as I go through all the guides here, they all seem to point to the same libraries I already have except for "pip install python-ldap".
When I try to do:
pip install python-ldap
I just get the following result:
Collecting python-ldap
Using cached python-ldap-2.4.25.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0c5p7fkj/python-ldap/setup.py", line 53
print name + ': ' + cfg.get('_ldap', name)
^
SyntaxError: invalid syntax
----------------------------------------
Does anyone know what are the best steps I should take to get around this issue to get the library working?
I've tried doing a wget for
https://pypi.python.org/pypi/python-ldap
And I extracted the files and simply used
python setup.py install to the tar ball, but to no avail.
Any suggestions?
Found the solution from this page:
https://www.howtoinstall.co/en/ubuntu/precise/universe/python-django-auth-ldap/
The following command seems to have done the trick:
apt-get install python-django-auth-ldap

ImportError ropevim using ropevim plugin in vim

According to the documentation of rope-vim plugin I install python-rope and python-ropemode mode packages. However when I try to open some file using vim I get following ImportError:
Error detected while processing function LoadRope:
line 4:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named ropevim
I have found the ropevim module is already in plugin's directory but when I had tried to import it:
python -c "import ropevim"
I get another ImportError:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "ropevim.py", line 10, in <module>
import vim
ImportError: No module named vim
Have I miss any package? Some ideas? Thank you for your help.
Install ropevim using pip install ropevim
ropevim is currently a Python 2 project.
pip2 install --user --update ropevim
I know it might not be the answer you're looking for, but I'm using klen/python-mode plugin with rope included and it's working like a charm.
I'm also using Vim-Plug to manage my plugins and it's as easy as:
Plug 'klen/python-mode', { 'for': ['python'] }
Here is my .vimrc
Hope this helps! :)

ATpy ImportError: No module named astropy.io

I tried to get atpy on python 2.7. I downloaded ATpy0.9.6 from
https://pypi.python.org/pypi/ATpy/0.9.6
then tar it, and run:
cd ATpy0.9.6
sudo python setup.py install
things seemed to work well.
But when I tried to import atpy on python, I got always this error message:
ImportError: No module named astropy.io
More precisely,
>>> import atpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/__init__.py", line 1, in <module>
from .basetable import Table, TableSet, VectorException
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/basetable.py", line 15, in <module>
from . import registry
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/registry.py", line 164, in <module>
from . import fitstable
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/fitstable.py", line 8, in <module>
from astropy.io import fits
ImportError: No module named astropy.io
>>>
Could anyone help me to figure out the problem?
Perhaps the 'atpy' package depends on another package called 'astropy.io' that you are missing? Yes here it is https://astropy.readthedocs.org/en/v0.1/index.html
It happens that downloading the tar balls from pypi.python.org is the wrong way to install Python packages. The right way (though the Python docs explain poorly), is to run a command like
pip install atpy
This command will install your package and all its dependencies.
If the command pip is missing, you have to install it, which is ironically really complicated.
In my case the solution was to install astropy
pip install --no-deps astropy

Pystacia can't find MagickWand on OS X

For some odd reason Pystacia is not able to find MagickWand.h on OS X.
I tried to tweak $DYLD_LIBRARY_PATH and $C_INCLUDE_PATH but no luck.
I have imagemagick up and running.
$ mdfind MagickWand.h
/usr/local/Cellar/imagemagick/6.8.010/share/doc/ImageMagick/www/api/MagickWand/struct__MagickWand.html
/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick/wand/MagickWand.h
And keep getting this error:
>>> import pystacia
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pystacia/__init__.py", line 193, in <module>
init()
File "/Library/Python/2.7/site-packages/pystacia/__init__.py", line 28, in init
raise TinyException('Could not find or load magickWand')
pystacia.util.TinyException: Could not find or load magickWand
I went further down to figure it out how pystacia looks for MagickWand.h:
from ctypes.util import find_library
resolved_path = find_library('MagickWand')
if not resolved_path:
raise PystaciaException('Could not find or load magickWand')
Still no lucky.
Looking to the latest pystacia code from bitbucket I realized that the version from pip is pretty old (from 2011) and a installation from the latest code solved my problem -- as I can afford to run unreleased code.
I also entered an Issue on bitbucket so the maintainer put out a new code release.

Categories

Resources