Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(AttributeError) "module 'PIL.Image' has no attribute 'VERSION'". #39

Closed
vineet131 opened this issue Jun 3, 2019 · 4 comments · Fixed by #54
Closed

(AttributeError) "module 'PIL.Image' has no attribute 'VERSION'". #39

vineet131 opened this issue Jun 3, 2019 · 4 comments · Fixed by #54

Comments

@vineet131
Copy link

I am working on a Windows 64 bit laptop with Conda v2019.03, running a Python 3.6.0 environment. After installing all the dependencies, when I try to run nmlc -h it shows me the following error:
nmlc ERROR: nmlc: An internal error has occurred: nmlc-version: 0.4.5 Error: (AttributeError) "module 'PIL.Image' has no attribute 'VERSION'". Command: ['C:\\ProgramData\\Anaconda3\\envs\\py3.6\\Scripts\\nmlc'] Location: File "c:\programdata\anaconda3\envs\py3.6\lib\site-packages\nml\version_info.py", line 74, in get_lib_versions

Workaround
After a quick round of googling, I found that the issue is with Pillow v6.0.0. Uninstalling it and doing pip install pillow==5.4.1 solved the issue for me.

I hope this helps anyone else who might have the same issue.

@LordAro LordAro closed this as completed in bcfff83 Jun 3, 2019
@LordAro
Copy link
Member

LordAro commented Jun 3, 2019

Thanks for reporting the issue - it had already been noticed (but no issue raised) and pull requested, but not actually merged in or fix released

The first part is now done :)

@LordAro
Copy link
Member

LordAro commented Oct 21, 2019

Reopen as per comment on #29 - should use PIL.__version__ See https://pillow.readthedocs.io/en/5.2.x/releasenotes/5.2.0.html#id1

@LordAro LordAro reopened this Oct 21, 2019
@matthijskooijman
Copy link
Contributor

Actually, it also seems that PIL.VERSION was something different than PIL.PILLOW_VERSION and PIL.__version__. I suspect the former is the last "PIL" version, frozen when it was forked and the latter two are the "Pillow" version, incremented after the fork. See also https://stackoverflow.com/a/49722022/740048 However, AFAICS this version number is only used for display in --help output, so it makes sense to use the Pillow version instead.

I was also wondering since what version PIL.__version__ is available, so whether a compatibility fallback would be needed (for git master this is not needed, since the minimum pillow version is 5.2, but I'm also looking to backport this fix into the 0.4.5 Debian version). Seems it was first available in 3.4.0: python-pillow/Pillow@7bfb252, so that's old enough for Debian (oldstable has 4.0.0).

@ConiKost
Copy link
Contributor

ConiKost commented Oct 23, 2019

Fow now, added to use PIL.__version__, since it works for me here and documentation states, that PILLOW_VERSION will be removed on >=pillow-7.0. I am not sure, if that's the version, we need, but other variables will be removed soon?

My PR works with current stable 0.4.5 and pillow 6.2.0. Maybe time to release a new version?

Installed is pillow-6.2.0.

Python 3.6.9 (default, Jul 15 2019, 00:24:41)
[GCC 9.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>> print('PIL',Image.__version__)
PIL 6.2.0
>>>

LordAro pushed a commit that referenced this issue Nov 9, 2019
Changed PILLOW_VERSION to PIL.__version__,
as it got removed with >=pillow-7.0.0.

In order not to break compatibility with older versions,
PILLOW_VERSION will be used as a fallback.

Closes: #39
Signed-off-by: Conrad Kostecki <conrad@kostecki.com>
matthijskooijman added a commit to matthijskooijman/nml that referenced this issue Nov 17, 2019
Previously, this tried various combinations of version variables.
However, some of these are deprecated by Pillow and the 6.0.0 release
notes recommend simply using `PIL.__version` instead. This attribute is
available since Pillow 3.4.0, so there is no need for any compatibility
fallbacks.

This relates to OpenTTD#29, OpenTTD#39 and OpenTTD#54.
matthijskooijman added a commit to matthijskooijman/nml that referenced this issue Nov 29, 2019
Previously, this tried various combinations of version variables.
However, some of these are deprecated by Pillow and the 6.0.0 release
notes recommend simply using `PIL.__version` instead. This attribute is
available since Pillow 3.4.0, so there is no need for any compatibility
fallbacks.

This relates to OpenTTD#29, OpenTTD#39 and OpenTTD#54.
LordAro pushed a commit that referenced this issue Nov 29, 2019
Previously, this tried various combinations of version variables.
However, some of these are deprecated by Pillow and the 6.0.0 release
notes recommend simply using `PIL.__version` instead. This attribute is
available since Pillow 3.4.0, so there is no need for any compatibility
fallbacks.

This relates to #29, #39 and #54.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants