setuptools: scan_module(): ValueError: bad marshal data (unknown type code)

This happens with CPython from git master (e768c86ef442ef89004089a8a34ce5909ffb90f2):

Traceback (most recent call last):
  File "setup.py", line 16, in <module>
    install_requires=["appdirs"],
  File ".../python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File ".../python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File ".../python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File ".../python3.7/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File ".../python3.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File ".../python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File ".../python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File ".../python3.7/site-packages/setuptools/command/bdist_egg.py", line 209, in run
    os.path.join(archive_root, 'EGG-INFO'), self.zip_safe()
  File ".../python3.7/site-packages/setuptools/command/bdist_egg.py", line 245, in zip_safe
    return analyze_egg(self.bdist_dir, self.stubs)
  File ".../python3.7/site-packages/setuptools/command/bdist_egg.py", line 355, in analyze_egg
    safe = scan_module(egg_dir, base, name, stubs) and safe
  File ".../python3.7/site-packages/setuptools/command/bdist_egg.py", line 392, in scan_module
    code = marshal.load(f)
ValueError: bad marshal data (unknown type code)

I believe this is because PEP 552 has been implemented, which adds extra 4 bytes to the .pyc header; but setuptools is not aware of that yet.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@benoit-pierre: Thank! Updating setuptools in Travis fixes the problem.

@benoit-pierre: How to repeat:

git clone git@github.com:aio-libs/aiopg.git
cd aiopg
python3.7 -m venv ./venv
source ./venv/bin/activate
sudo apt-get install libpq-dev
pip install -U setuptools
python setup.py install

sys.version_info(major=3, minor=7, micro=0, releaselevel=‘alpha’, serial=3) 16

The first version that implemented PEP 552 was v3.7.0a4. But setuptools currently does:

elif sys.version_info < (3, 7):

@smagafurov: just to be clear, to fix your issues you should:

  • locally: update Python to >=3.7.0a4
  • Travis CI: update setuptools first before installing other requirements (IMHO adding back nightly testing is a good idea)

I’m not sure it make sense to explicitely test for 3.7.0a4: if you’re running with nightly, then problems are to be expected, and you’re also expected to keep current, no?

What I don’t understand is why it fails on Travis, or is it another hole in our testsuite?