SOLUTION: ValueError: bad marshal data (unknown type code)


The error: bad marshal data

When you try to install a python package you get the error:

Traceback (most recent call last):
from sqlalchemy.ext.declarative import declarative_base
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/", line 8, in <module>
from .api import declarative_base, synonym_for, comparable_using, \
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/", line 11, in <module>
from ...orm import synonym as _orm_synonym, \
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/", line 17, in <module>
from .mapper import (
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/", line 27, in <module>
from . import properties
ValueError: bad marshal data (unknown type code)


Check the traceback path and delete all the pycs files recursively:

find /PATH_ON_TRACEBACK -name '*.pyc' -delete

In our case the path was "/usr", howevery it could be inside your virtualenv.