undefined symbol: PyOS_mystrnicmp - python

I tried installing pysqlite, but I'm having some trouble using it.
>>> import pysqlite2.dbapi2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pysqlite2/dbapi2.py", line 28, in <module>
from pysqlite2._sqlite import *
ImportError: /data/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pysqlite2/_sqlite.so: undefined symbol: PyOS_mystrnicmp
I think I might be missing some Python headers. Where do I find them? I'm using CentOS with CPython 2.7.5.

As https://groups.google.com/forum/#!topic/python-sqlite/04Ocf7aP1so points out, a bug was reported that appears to be fixed in newer versions of Python. Upgrading to a later version of Python 2.7 did the trick for me.

Related

Can't import "ImportObject" from python "wasmer"

So easy to reproduce that I'm surprised that nobody has reported it yet.
pip install wasmer
python -c 'from wasmer import ImportObject'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'ImportObject' from 'wasmer' (/usr/lib/python3.8/site-packages/wasmer.cpython-38-x86_64-linux-gnu.so
"ImportObject" class is described in readme and presented in examples. I've checked that proper 0.4.1 version of "wasmer" was installed. Also I checked the newest tagged version of "wasmer" which fails with the same error. Do I do something totally wrong?
UPD: generate_import_object() function doesn't work also:
python -c "from wasmer import Module; Module.generate_import_object()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: type object 'Module' has no attribute 'generate_import_object'
And this code gives the same result:
wasm_bytes = open('binary.wasm', 'rb').read()
module = Module(wasm_bytes)
import_object = module.generate_import_object()
The library in pip is outdated. The current version is from March, 2nd, and the necessary changes were implemented only on June, 2nd. 0.4.2 beta version is outdated also (May, 19). So, the only way now is manual build. Probably the library will be updated in a couple of weeks.
See more details in this thread: https://github.com/wasmerio/python-ext-wasm/issues/215.

How to reinstall or fix Python interpreter for XCode lldb?

I got this message at XCode after deleting some system files.
(lldb) script
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_python_interpreter' is not defined
P.S. Had to reinstall XCode, but I've got same message at debugger after reinstalling IDE
Terminal output
$ lldb
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
You have a local installation of python on your computer (in /usr/local/Cellar). There's a problem when you have two different pythons on your system; lldb links against /System/Library/Frameworks/Python.framework but that python somehow ends up using the python libraries from your installed copy instead. I saw someone work around this once but I forget if it was by putting their local python last in $PATH or if they un-set their $PYTHONPATH before starting lldb.

Problems importing python-pcre (pcre might not be installed correctly)

I have installed pcre with homebrew. However this does not seem to work with this package: python-pcre as it seems like it is missing `jitĀ“.
I tried installing pcre on my own however the guides i could find did not work on macOS Sierra. Does any one have any tips on how i can get this packeage to work on macOS Sierra?
import pcre
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/var/pyenv/versions/srf-3.5.2/lib/python3.5/site-packages/pcre.py", line 29, in <module>
import _pcre
ImportError: dlopen(/usr/local/var/pyenv/versions/srf-3.5.2/lib/python3.5/site-packages/_pcre.cpython-35m-darwin.so, 2): Symbol not found: _pcre_assign_jit_stack
Referenced from: /usr/local/var/pyenv/versions/srf-3.5.2/lib/python3.5/site-packages/_pcre.cpython-35m-darwin.so
Expected in: flat namespace
in /usr/local/var/pyenv/versions/srf-3.5.2/lib/python3.5/site-packages/_pcre.cpython-35m-darwin.so

Python tensorflow error, sys has no attribute getdlflags

I Just attempted to install tensorflow for python and when I went to the console to see if the init.py was working it returned this error. I installed it manualy without pip or any other package manager.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\*username\AppData\Local\Programs\Python\Python35-32\lib\tensorflow\__init__.py", line 43, in <module>
_default_dlopen_flags = sys.getdlopenflags()
AttributeError: module 'sys' has no attribute 'getdlopenflags'
TensorFlow is not supported on Windows yet. Please follow this github issue which tracks TensorFlow Windows support.

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

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.

Categories

Resources