Reputation: 3813
Running flexget Python script in Ubuntu, I get an error:
$ flexget series forget "Orange is the new black" s03e01
Traceback (most recent call last):
File "/usr/local/bin/flexget", line 7, in <module>
from flexget import main
File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 11, in <module>
from flexget.manager import Manager
File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 21, in <module>
from sqlalchemy.ext.declarative import declarative_base
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/__init__.py", line 8, in <module>
from .api import declarative_base, synonym_for, comparable_using, \
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/api.py", line 11, in <module>
from ...orm import synonym as _orm_synonym, \
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/__init__.py", line 17, in <module>
from .mapper import (
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/mapper.py", line 27, in <module>
from . import properties
ValueError: bad marshal data (unknown type code)
Upvotes: 82
Views: 162800
Reputation: 161
If the accepted answer does not work, try the following steps:
For example, in the stack trace below:
$ flexget series forget "Orange is the new black" s03e01
Traceback (most recent call last):
File "/usr/local/bin/flexget", line 7, in <module>
from flexget import main
File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 11, in <module>
from flexget.manager import Manager
File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 21, in <module>
from sqlalchemy.ext.declarative import declarative_base
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/__init__.py", line 8, in <module>
from .api import declarative_base, synonym_for, comparable_using, \
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/api.py", line 11, in <module>
from ...orm import synonym as _orm_synonym, \
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/__init__.py", line 17, in <module>
from .mapper import (
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/mapper.py", line 27, in <module>
from . import properties
ValueError: bad marshal data (unknown type code)
The first problematic package appears to be sqlalchemy
in from sqlalchemy.ext.declarative import declarative_base
, as all subsequent imports are relative that happen within sqlalchemy package
Upvotes: 1
Reputation: 51
I had the same error in a conda environment which traced back to importing the matplotlib package.
simply pip uninstall matplotlib
and then pip install matplotlib
solved the problem.
Upvotes: 1
Reputation: 1683
It may be because of the damage of the library. Try re-install the package.
Upvotes: 1
Reputation: 103
I get this error in Ubuntu 18.04
Raspberry Pi 3 when I trying update my system typing sudo apt-get update
and solve this error just typing:
sudo find /usr -name '*.pyc' -delete
This is remove all .pyc
file in my system. Now I typing again sudo apt-get update && sudo apt-get upgrade
and I get my update without thie error marshal-data
Upvotes: 5
Reputation: 3739
I solved this problem by the following procedure :
In the error code message, you can see
from sqlalchemy.ext.declarative import declarative_base
cause this error.
So just pip uninstall sqlalchemy
and pip install sqlalchemy
, problem solved.
Upvotes: 2
Reputation: 56
I also got this problem in Windows environment(win 10).
I fixed it by going to the Settings and repairing Python 3.7 with its installer. Everything works fine since then.
As far as I could recall, I had kept a dash server running when my computer went to hibernation. Maybe the damage was done in the hibernating process somehow.
Upvotes: 1
Reputation: 3266
There also appears to have been some sort of regression in setuptools with use with python 3.7. See for an example - https://github.com/pypa/setuptools/issues/1257
Forcing reinstallation of setuptools fixed this issue for me.
sudo pip3 install --upgrade --force-reinstall setuptools
Upvotes: 31
Reputation: 59
I resolved a similar error by un-installing and re-installing the Python application I was using, and all dependencies, using the system package manager.
In my case I was using awscli on Debian 9 and the error was "ValueError: bad marshal data (set size out of range)".
I ran as root:
apt-get purge awscli
apt-get autoremove
apt-get install awscli
And then the error was fixed.
I could imagine cases where the broken package might not get removed (for example because it was marked as manually installed, or was a dependency of another application still installed), in those cases this action may not resolve the error. However I thought I should try this way before manually deleting .pyc files the system installed, and I got lucky.
Upvotes: 2
Reputation: 6847
This can happen if you have Python 2.7 .pyc files and you try to load them using Python 3.5. In my case this was a third-party tarball that erroneously included pre-compiled Python 2.7 .pyc files along with the source code.
Upvotes: 6
Reputation: 76682
Just delete
/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/properties.pyc
it is corrupt as the text indicates. You'll probably have to do so as root
.
After that start (again as root) run python (2.7):
/usr/bin/python -c "import sqlalchemy.orm.properties"
to recreate this .pyc
file.
If you don't recreate the .pyc
file, your program starts slower than necessary as the .py
file takes longer to load than the .pyc
(and a normal user cannot write the .pyc
file).
Upvotes: 19
Reputation: 3813
If you get that error, the compiled version of the Python module (the .pyc file) is corrupt probably. Gentoo Linux provides python-updater
, but in Debian the easier way to fix: just delete the .pyc file. If you don't know the pyc, just delete all of them (as root):
find /usr -name '*.pyc' -delete
Upvotes: 159