Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Tensorflow - EOFError: marshal data too short

I've been facing this issue for a while now. Whenever I import TensorFlow, I get the following:


2021-02-11 21:05:05.855414: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2021-02-11 21:05:05.855463: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/amay428/.local/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/home/amay428/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 45, in <module>
    from tensorflow.python import data
  File "/home/amay428/.local/lib/python3.8/site-packages/tensorflow/python/data/__init__.py", line 25, in <module>
    from tensorflow.python.data import experimental
  File "/home/amay428/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/__init__.py", line 126, in <module>
    from tensorflow.python.data.experimental.ops.prefetching_ops import copy_to_device
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 779, in exec_module
  File "<frozen importlib._bootstrap_external>", line 911, in get_code
  File "<frozen importlib._bootstrap_external>", line 580, in _compile_bytecode
EOFError: marshal data too short

I have looked at various answers online but all of them ask me to delete the TensorFlow _pycache_ folder. I have done this, but it doesn't work. I am using Manjaro, python 3.8 inside a Conda environment. I would appreciate any help.

Thanks!

like image 801
snookso Avatar asked Nov 16 '22 00:11

snookso


1 Answers

I had this issue when trying to import a model trained on TensorFlow v2.6.0 into an environment using TensorFlow v2.7.0. I downgraded the environment back to v2.6.0, which has resolved the error.

like image 77
cmacphillamy Avatar answered Jan 18 '23 07:01

cmacphillamy