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

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.

Related

undefined symbol: PyOS_mystrnicmp

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.

Graphite install error 0.10.0-alpha

I get the following error when starting Graphite-web using DJango.
0.9.15 works ok, but I am looking to use the new "mapSeries" function available in 0.10.x
Seems to be a missing import -
Exception occurred processing WSGI script '/opt/graphite/conf/graphite.wsgi'.
Traceback (most recent call last):
File "/opt/graphite/conf/graphite.wsgi", line 46, in <module>
import graphite.metrics.search # noqa
File "/opt/graphite/webapp/graphite/metrics/search.py", line 6, in <module>
from graphite.storage import is_pattern, match_entries
ImportError: cannot import name match_entries
I'm not a python programer, but maybe the package is missing in the setup.py?
https://github.com/graphite-project/graphite-web/blob/master/setup.py
I solved the issue by updating /opt/graphite/conf/graphite.wsgi to the latest example version.
The 0.9.x version is not compatible with 0.10.x

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.

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.

cannot follow the python git tutorials

I have lately installed python-git package, and when trying to follow the tutorials over at the following link, I find that certain methods are missing...
http://packages.python.org/GitPython/0.3.2/tutorial.html#tutorial-label
Here is what came out of my interpreter:
>>> from git import *
>>> repo = Repo.init('/home/deostroll/scripts/synchost')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Repo' has no attribute 'init'
>>> repo = Repo('/home/deostroll/scripts/synchost')
>>> repo.is_dirty()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'bool' object is not callable
>>>
Those commands work for me, so I agree with the other answer that you're probably using an outdated version. If you're on linux and have PIP, installed, on the command line you can do:
pip install --upgrade GitPython
to upgrade to the latest version. (Sidenote: for me on Fedora, the command is actually pip-python, so it depends on your distro).
It seems likely that you're using a very outdated verison of GitPython. In version 0.3, is_dirty is a method, and init exists.
In version 0.1, is_dirty is a property, and init_bare is defined, but not init.

Categories

Resources