Doesn't install with Jython

Issue #786 resolved
created an issue

I'm using Jython 2.7a2, the latest.

I've set up a Jython virtualenv, and run 'pip install pygments'. It fails at the following stage:

byte-compiling /home/ian/Applications/jython-env/Lib/site-packages/pygments/lexers/ to _vimbuiltins$py.class

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ian/Applications/jython-env/build/pygments/", line 61, in <module>
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/", line 152, in setup
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/", line 152, in setup
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/", line 953, in run_commands
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/", line 972, in run_command
  File "/home/ian/Applications/jython-env/Lib/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/", line 56, in run
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/command/", line 517, in run
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/", line 326, in run_command
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/", line 972, in run_command
  File "/home/ian/Applications/jython-env/Lib/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/", line 24, in run
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/command/", line 136, in byte_compile
    byte_compile(files, optimize=0,
  File "/home/ian/Applications/jython2.7a2/Lib/distutils/", line 567, in byte_compile
    compile(file, cfile, dfile)
  File "/home/ian/Applications/jython2.7a2/Lib/", line 96, in compile
    _py_compile.compile(file, cfile, dfile)
  File "/home/ian/Applications/jython2.7a2/Lib/", line 96, in compile
    _py_compile.compile(file, cfile, dfile)
        at org.python.objectweb.asm.MethodWriter.a(Unknown Source)
        at org.python.objectweb.asm.ClassWriter.toByteArray(Unknown Source)
        at org.python.compiler.ClassFile.write(
        at org.python.compiler.Module.write(
        at org.python.compiler.Module.compile(
        at org.python.core.imp.compileSource(
        at org.python.core.imp.compileSource(
        at org.python.modules._py_compile.compile(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(

java.lang.RuntimeException: java.lang.RuntimeException: Method code too large!

Jython can't compile methods over a certain size. One solution is to import pycimport; this requires that a pyc file has been generated by CPython.

Comments (12)

  1. Tim Hatch

    Yes, it's actually a limitation of the JVM, not just Jython however. In this case, there's a fairly trivial workaround in a file that humans aren't intended to edit, so I think we should do it.

    ref: defines several large tables, and those tables combined are too large for a single method in Java. Individually though, they're fine.


  2. Thomas Mortagne

    Hi guys, note that I'm using Pygments from Java since a while but I'm still using Jython 2.5.3 and I don't have any issue. I just wrote to indicate how I use it if you want to check. Maybe there is something wrong in 2.7 or maybe it's with a parser or a serializer I never used myself yet (did ot checked the detail of your error).

  3. Thomas Mortagne

    Actually someone reported me that he had the exact same issue but only with the Vim language so it's not a general Pygments issue (not a Pygments issue at all anyway) but something Jython or the JVM does not like about one of the Vim lexer methods when converted to Java bytecode.

  4. Log in to comment