I have a python script that works without any errors on my desktop. When I try to run it on my raspberry pi, I encounter an error.
To install tensorflow on the raspberry pi for python 3.5, I followed this tutorial: https://petewarden.com/2017/08/20/cross-compiling-tensorflow-for-the-raspberry-pi/ There is no offical binary for tensorflow and python 3.5 and I had errors when I tried to compile it myself. The tutorial suggest to just install tensorflow from the Python 3.4 binary.
If you’re running Python 3.5, you can use the Python 3.4 wheel but with a
slight change to the file name, since that encodes the version. You
will see a couple of warnings every time you import tensorflow, but it
should work correctly.
Here is the error I am encountering:
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 432, got 412
return f(*args, **kwds)
Traceback (most recent call last):
File "run.py", line 93, in <module>
model = FastPredict(tf.contrib.learn.Estimator(model_fn=convolutional_neural_network, model_dir="tmp"))
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/util/lazy_loader.py", line 53, in __getattr__
module = self._load()
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/util/lazy_loader.py", line 42, in _load
module = importlib.import_module(self.__name__)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/__init__.py", line 82, in <module>
from tensorflow.contrib.eager.python import tfe as eager
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/eager/python/tfe.py", line 76, in <module>
from tensorflow.contrib.eager.python.datasets import Iterator
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/eager/python/datasets.py", line 23, in <module>
from tensorflow.contrib.data.python.ops import prefetching_ops
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/data/python/ops/prefetching_ops.py", line 25, in <module>
resource_loader.get_path_to_datafile("../../_prefetching_ops.so"))
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/util/loader.py", line 55, in load_op_library
ret = load_library.load_op_library(path)
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename, status)
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/data/python/ops/../../_prefetching_ops.so: undefined symbol: _ZN6google8protobuf8internal26fixed_address_empty_stringE
Line 93 attempts to create an Estimator which causes the error.
tf.contrib.learn.Estimator(model_fn=convolutional_neural_network, model_dir="tmp")
I found a similar error on github but it was no help: https://github.com/tensorflow/serving/issues/684
I installed an older build. It doesn't cause this error. http://ci.tensorflow.org/view/Nightly/job/nightly-pi/78/artifact/output-artifacts/tensorflow-1.3.0-cp27-none-any.whl
Related
I have some issue trying to run Volatility 3 Framework.
git clone https://github.com/volatilityfoundation/volatility3.git
cd volatility3/
python3 vol.py ../ramdumps/1289.raw windows.pslist.PsList
I got this error traceback:
Volatility 3 Framework 2.0.0
Failed to import '/usr/lib/libyara.so'
PATH = /home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/home/user/go/bin;/usr/lib
Traceback (most recent call last):
File "vol.py", line 10, in <module>
volatility3.cli.main()
File "/home/user/Documents/volatility3/volatility3/cli/__init__.py", line 625, in main
CommandLine().run()
File "/home/user/Documents/volatility3/volatility3/cli/__init__.py", line 229, in run
True) # Will not log as console's default level is WARNING
File "/home/user/Documents/volatility3/volatility3/framework/__init__.py", line 127, in import_files
ignore_errors)
File "/home/user/Documents/volatility3/volatility3/framework/__init__.py", line 152, in import_file
importlib.import_module(module)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/user/Documents/volatility3/volatility3/framework/plugins/yarascan.py", line 17, in <module>
import yara
File "/home/user/.local/lib/python3.6/site-packages/yara/__init__.py", line 7, in <module>
from yara.rules import compile
File "/home/user/.local/lib/python3.6/site-packages/yara/rules.py", line 17, in <module>
from yara.libyara_wrapper import *
File "/home/user/.local/lib/python3.6/site-packages/yara/libyara_wrapper.py", line 315, in <module>
libyaradll = cdll.LoadLibrary(library)
File "/usr/lib/python3.6/ctypes/__init__.py", line 426, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libyara.so: cannot open shared object file: No such file or directory
Someone already had the same error a few years ago but none of the answers worked for me.
I'm using python 3.6.9 and Xubuntu 18.04.6
You have to uninstall yara with pip. Only tara-python must be installed.
Did you install the requirements with
pip3 install -r requirements.txt
?
I have been trying to import a python library called dwave tabu which uses swig, but I have been experiencing some issues. When importing the package in python3, I get this result:
>>>import tabu
Traceback (most recent call last):
File "/home/chip/.local/lib/python3.5/site- packages/tabu/tabu_search.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 914, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chip/.local/lib/python3.5/site-packages/tabu/__init__.py", line 17, in <module>
from tabu.tabu_search import TabuSearch
File "/home/chip/.local/lib/python3.5/site- packages/tabu/tabu_search.py", line 17, in <module>
_tabu_search = swig_import_helper()
File "/home/chip/.local/lib/python3.5/site-packages/tabu/tabu_search.py", line 16, in swig_import_helper
return importlib.import_module('_tabu_search')
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_tabu_search'
I suspect that the error has something to do with swig, but I am unsure what to do to resolve it. Also It looks like is an error about may be caused by binary compiled for 64-bit linux, on a 32-bit installation, but I don’t know how to fix that issue. Any help would be greatly appreciated.
Thanks
ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64
This error means: you are trying to load a 64-bit _tabu_search.so library into a 32-bit process. You must either use 64-bit python, or install a 32-bit version of the tabu_search package.
I suspect that the error has something to do with swig
No, SWIG has almost nothing to do with your problem.
During migration from Django1.5 to Django2.1.7 we are facing an implicit import error in library function when trying to start server.
Traceback (most recent call last):
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10945f950>
Traceback (most recent call last):
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/core/management/__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/Users/MAK/Envs/lifemed3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/json_field/__init__.py", line 1, in <module>
from json_field.fields import JSONField
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/json_field/fields.py", line 4, in <module>
from json_field.forms import JSONFormField
File "/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/json_field/forms.py", line 5, in <module>
from django.forms import fields, util
ImportError: cannot import name 'util' from 'django.forms' (/Users/MAK/Envs/lifemed3/lib/python3.7/site-packages/django/forms/__init__.py)
We have already check this answer about circular dependency, but as it was in code level and was easily solvable, but in terms of library what would be the best way to solve this?
FYI: we are moving to python3.7 with Django2.1.7 from python 2.7 and django 1.5.5
UPDATE (Solved)
According to mfrackowiak's answer below we have to fork their repo, applied patch for the support and install from the changed version. then it worked for me
As it seems that the package is unmaintained for a long time, the best way to deal with this error would be either look for alternatives or just fork the repo and update it yourself so it would still work (might be easier than adjusting codebase for another library).
I found these two packages:
If this is the package you're using django-json-field, then look at the last release which was in 2014 so i'm pretty sure this package is incompatible with Django 2.0
If jsonfield is your package then even they don't have support for Django 2.0. They have 1.8 to 1.11
Post in your code what you intended to do using that package then i might be able to give yo a custom solution or package which actually supports 2.0 and does the work.
When I use the command import tensorflow as tf I get the following error:
Traceback (most recent call last):
File "C:\Users\rodri647\AppData\Local\Continuum\anaconda2\envs\chemvae\lib\sit
e-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_im
port_helper
return importlib.import_module(mname)
File "C:\Users\rodri647\AppData\Local\Continuum\anaconda2\envs\chemvae\lib\imp
ortlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed with error code -1073741795
...
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\rodri647\AppData\Local\Continuum\anaconda2\envs\chemvae\lib\sit
e-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\rodri647\AppData\Local\Continuum\anaconda2\envs\chemvae\lib\sit
e-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module
>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\rodri647\AppData\Local\Continuum\anaconda2\envs\chemvae\lib\sit
e-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_im
port_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\rodri647\AppData\Local\Continuum\anaconda2\envs\chemvae\lib\imp
ortlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
>>>
I'm using tensorflow gpu 1.1.0 on python 3.5. The code I'm trying to compile is here: https://github.com/aspuru-guzik-group/chemical_vae
Seems like you have no installed MSVCP140.DLL in your system. You can try installing Visual C++ Redistributable, uninstall then install TF again.
If it doesn't work, try to download and import this dll directly as it explained here.
Currently I am trying to get tensorflow - Windows 64bit (just the cpu version) running on my pc. When running the command python object_detection/builders/model_builder_test.pyI get the error below. I searched online, and 99% of the answers are to use cd, which I think I've tried but that didn't work. I say 'I think' due to me not knowing whether I actually correctly tried using cd - as I was not 100% on how I was going to use cd in my scenario.
C:\Users\Benan\Documents\BaseballProject>python tensorflow/models/research/object_detection/builders/model_builder_test.py
Traceback (most recent call last):
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tensorflow/models/research/object_detection/builders/model_builder_test.py", line 18, in <module>
import tensorflow as tf
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
Thanks in advance!!
I was able to fix it myself, here's how:
On the github page
https://github.com/tensorflow/tensorflow/issues/17386
, I found out that a cause of this problem can be caused due to the CPU lacking AVX instructions. Advanced Vector Extensions (AVX) are a set of instructions for doing Single Instruction Multiple Data (SIMD) operations.
I was running an Intel Core Duo, which does not appear on the list of all AVX compatible AMD and intel CPU's , which can be found here: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#CPUs_with_AVX
On that github page, a user by the name of fo40225, had compiled a .whl for tensorflow, that had been built without AVX. It can be found here: https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.9.0/py36/CPU/sse2
First I had to uninstall tensorflow with pip uninstall tensorflow, then I reinstalled it using the .whl that has been built without AVX using pip install /example/path/to/.whl
After installing the problem was fixed!