Skip to content

Tests failing with AttributeError: module 'PIL.Image' has no attribute 'VERSION' #1995

Closed

Description

@peterjc

Noticed on TravisCI, it looks like a new release of Pillow and/or ReportLab broke things:

e.g. Python 2.7 and 3.5 here:
https://travis-ci.org/biopython/biopython/builds/514538956

======================================================================
ERROR: test_render_KGML_basic (test_KGML_graphics.KGMLPathwayTest)
Basic rendering of KGML: write to PDF without modification.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/biopython/biopython/Tests/test_KGML_graphics.py", line 115, in test_render_KGML_basic
    kgml_map.draw(p.output_stem + '_original.pdf')
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Graphics/KGML_vis.py", line 158, in draw
    self.drawing.drawImage(imfilename, 0, 0)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfgen/canvas.py", line 947, in drawImage
    imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2087, in __init__
    self.loadImageFromA85(src)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2095, in loadImageFromA85
    imagedata = pdfutils.makeA85Image(source,IMG=IMG,detectJpeg=True)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfutils.py", line 38, in makeA85Image
    raw = img.getRGBData()
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 902, in getRGBData
    annotateException('\nidentity=%s'%self.identity())
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 1406, in annotateException
    rl_reraise(t,v,b)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 886, in getRGBData
    if Image.VERSION.startswith('1.1.7'): im.load()
AttributeError: 'module' object has no attribute 'VERSION'
identity=[ImageReader@0x7f5eb9f90790 filename='KEGG/map03070.png']
======================================================================
ERROR: test_render_KGML_modify (test_KGML_graphics.KGMLPathwayTest)
Rendering of KGML to PDF, with modification.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/biopython/biopython/Tests/test_KGML_graphics.py", line 146, in test_render_KGML_modify
    kgml_map.draw(p[1].output_stem + '_colors.pdf')
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Graphics/KGML_vis.py", line 158, in draw
    self.drawing.drawImage(imfilename, 0, 0)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfgen/canvas.py", line 947, in drawImage
    imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2087, in __init__
    self.loadImageFromA85(src)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2095, in loadImageFromA85
    imagedata = pdfutils.makeA85Image(source,IMG=IMG,detectJpeg=True)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfutils.py", line 38, in makeA85Image
    raw = img.getRGBData()
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 902, in getRGBData
    annotateException('\nidentity=%s'%self.identity())
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 1406, in annotateException
    rl_reraise(t,v,b)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 886, in getRGBData
    if Image.VERSION.startswith('1.1.7'): im.load()
AttributeError: 'module' object has no attribute 'VERSION'
identity=[ImageReader@0x7f5eb97fe4d0 filename='KEGG/map03070.png']
======================================================================
ERROR: test_render_KGML_transparency (test_KGML_graphics.KGMLPathwayTest)
Rendering of KGML to PDF, with color alpha channel.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/biopython/biopython/Tests/test_KGML_graphics.py", line 182, in test_render_KGML_transparency
    kgml_map.draw(p[1].output_stem + '_transparency.pdf')
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Graphics/KGML_vis.py", line 158, in draw
    self.drawing.drawImage(imfilename, 0, 0)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfgen/canvas.py", line 947, in drawImage
    imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2087, in __init__
    self.loadImageFromA85(src)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2095, in loadImageFromA85
    imagedata = pdfutils.makeA85Image(source,IMG=IMG,detectJpeg=True)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/pdfbase/pdfutils.py", line 38, in makeA85Image
    raw = img.getRGBData()
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 902, in getRGBData
    annotateException('\nidentity=%s'%self.identity())
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 1406, in annotateException
    rl_reraise(t,v,b)
  File "/home/travis/build/biopython/biopython/.tox/py27-cover/lib/python2.7/site-packages/reportlab/lib/utils.py", line 886, in getRGBData
    if Image.VERSION.startswith('1.1.7'): im.load()
AttributeError: 'module' object has no attribute 'VERSION'
identity=[ImageReader@0x7f5eb9fb7250 filename='KEGG/map03070.png']
----------------------------------------------------------------------

Activity

  1. peterjc commented on Apr 2, 2019

    @peterjc
    MemberAuthor

    This looks like a bug in reportlab, but needs some investigation to work out which version(s) are affected, report the problem to ReportLab if not known already, and then most likely tweak the versions we install via:

    https://github.com/biopython/biopython/blob/master/.travis-tox.ini

  2. rtf-const commented on Apr 4, 2019

    @rtf-const
    Contributor

    There is already opened issue in ReportLab
    https://bitbucket.org/rptlab/reportlab/issues/176/incompatibility-with-pillow-600
    It is related with a version of Pillow, not the ReportLab itself

  3. peterjc commented on Apr 4, 2019

    @peterjc
    MemberAuthor

    Thank you - that does explain this problem. As a short term fix, we can probably install Pillow < 6.0.0 explicitly.

  4. Narendra186 commented on Apr 13, 2019

    @Narendra186

    Hush! You guys really helped me a lot, thank u

  5. peterjc commented on Apr 15, 2019

    @peterjc
    MemberAuthor

    Closing. Our workaround for TravisCI of installing Pillow 5.4 is working nicely, but the underlying bug in ReportLab has yet to be solved:

    https://bitbucket.org/rptlab/reportlab/issues/176/incompatibility-with-pillow-600

  6. peterjc commented on Apr 17, 2019

    @peterjc
    MemberAuthor

    Closed for AppVeyor via #2013

  7. LWFlouisa commented on Mar 10, 2020

    @LWFlouisa

    It's causing the same issue in Linux Mint 19.1 I can't seem to open my cinnimon settings.

    I also can't seem to use wget.

  8. peterjc commented on Mar 10, 2020

    @peterjc
    MemberAuthor

    If wget isn't working there is probably something else wrong with your system, sadly.

    Forcing pillow==5.4.1 rather than using pillow version 6 seemed to work for us.

    As far as I know, the problem in ReportLab has not been fixed - or if it has, the bug was not closed.

  9. LWFlouisa commented on Mar 10, 2020

    @LWFlouisa

    It worked, thanks a bunch!

  10. peterjc commented on Mar 12, 2020

    @peterjc
    MemberAuthor

    ReportLab no longer use BitBucket, the old issue tracker mentioned earlier has been turned off. Quoting Robin Becker on the ReportLab mailing list:

    I think this issue was properly fixed in https://hg.reportlab.com/hg/reportlab/rev/37fce4b8f084
    The gentoo patch would also have worked, but my understanding is that the im_load call was only required for a version
    exactly equal to 1.1.7 and the getattr(Image,'VERSION','').startswith('1.1.7') test should be OK.

    That code should certainly be in the current pypi version 3.5.34.

    That is the latest release on PyPI at the time of writing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions