cannot be imported in Jython2.7 due to missing multiprocessing library

Issue #551 resolved
Chris created an issue

When running Jython 2.7.1b3 and using multiprocessing by way of pytest-cov:

  File "/lib/jython2.7/site-packages/pytest_cov/", line 5, in <module>
    from coverage.misc import CoverageException
  File "/lib/jython2.7/site-packages/coverage-4.3.1-py2.7.egg/coverage/", line 13, in <module>
    from coverage.control import Coverage, process_startup
  File "/lib/jython2.7/site-packages/coverage-4.3.1-py2.7.egg/coverage/", line 27, in <module>
    from coverage.multiproc import patch_multiprocessing
  File "/lib/jython2.7/site-packages/coverage-4.3.1-py2.7.egg/coverage/", line 6, in <module>
    import multiprocessing
ImportError: No module named multiprocessing

According to a Jython issue this is a known gap.

There seems to be no way to prevent the attempt to import multiprocessing, as it happens in unconditional imports in -> ->

Comments (8)

  1. Ned Batchelder repo owner

    @offbyone it's been a long time since I've been able to support Jython. The Jython people aren't making this easy... I tried running my tox tests against 2.7.0, and couldn't even install the requirements:

    ☿ .tox/jython/bin/python -m pip install -rrequirements/pytest.pip
    Traceback (most recent call last):
      File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/", line 215, in main
        status =, args)
      File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/commands/", line 310, in run
      File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/", line 292, in populate_requirement_set
        for req in parse_requirements(
      File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/req/", line 89, in parse_requirements
        for line_number, line in lines_enum:
      File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/req/", line 323, in ignore_comments
        for line_number, line in lines_enum:
      File "/Users/ned/coverage/trunk/.tox/jython/Lib/site-packages/pip/req/", line 298, in join_lines
        if COMMENT_RE.match(line):
    RuntimeError: maximum recursion limit exceeded

    I went to to get the 2.7.1b1 you mentioned, and I see nothing there. Googling around, the releases are mentioned on Frank's blog and nowhere else? I'm trying to install it now, but one way to get better Jython support would be to encourage Jython to be less unique in their release choreography.

  2. Ned Batchelder repo owner

    I've pushed some changes to deal with a missing multiprocessing module. The test suite mostly still doesn't run, so let me know what you find trying to use on Jython.

  3. Ned Batchelder repo owner

    Also, other tips for Jython would be appreciated. For example, I can't run "coverage --version" under Jython because shebang line in the launcher refers to the jython executable, which is really a Python 2.7 script, or something?

  4. Chris reporter

    I have to admit, the thing I most want is for importing it not to blow up on Jython :) If it works, so much the better -- and I'll probably be motivated to look at that in the near-ish future. But for now, "not exploding" is a good start.

    Will you release a 4.3.2 to include that?

  5. Chris reporter

    Ned, is there anything I could do to nudge a 4.3.2 release? I'd love to pull this in and start using it.

  6. Log in to comment