[Tutor] importing from PIL

dn PyTutor at DancesWithMice.info
Tue Aug 11 22:59:59 EDT 2020


On 12/08/2020 14:31, Chris Roy-Smith wrote:
> On 12/8/20 10:44 am, Alan Gauld via Tutor wrote:
>> On 12/08/2020 00:46, Chris Roy-Smith wrote:
>>> Hi
>>> Ubuntu 18.04
>>> python3.8
>>>
>>> under these conditions I get
>>>
>>>   >>> from PIL import Image
>>> Traceback (most recent call last):
>>>     File "<stdin>", line 1, in <module>
>>>     File "/usr/lib/python3/dist-packages/PIL/Image.py", line 60, in 
>>> <module>
>>>       from . import _imaging as core
>>> ImportError: cannot import name '_imaging' from 'PIL'
>>> (/usr/lib/python3/dist-packages/PIL/__init__.py)
>>>
>>> If I do the same in python 3.6 on the same computer, this command does
>>> not raise an error.
>>>
>>> How do I proceed from here?
>>
>>
>> Are you sure your version of Pillow is compatible with 3.8?
>> PIL/Pilow has a long tradition of being a release or two behind
>> the bleeding edge. (One reason I usually leave a couple of
>> releases before upgrading...)
>>
>> Is there a reason you upgraded to 3.8? Is there anything in
>> it that you need that isn't in 3.6?
>>
> Thanks Alan,
> I wasn't aware of that. I am trying to debug some code which which was 
> to live on a windows box (I don't run windows) which has 3.8.x 
> installed, and complains along the same lines. I use Python 3.6.x on my 
> machine. I installed 3.8.x along side to try and debug. I prefer to work 
> under Linux.
> 
>> Or is there an updated PIL/Pillow that works with 3.8?
>>
> Synaptic (package manager) doesn't show other Pillow packages (for 3.8) 
> as opposed to 3.6.
> I think it might be simpler to "downgrade" the windows box to Python 
> 3.6.x. I know that the code works well that way.

Further to similar conversation on Python-List yesterday: please review 
Installation (https://pillow.readthedocs.io/en/stable/installation.html) 
to ascertain which versions of pillow are compatible with which versions 
of Python 3.n...

Further advice: use pip3 to download separately for each OpSys/Python 
version-combination (cf downloading once and sharing between machines).
-- 
Regards =dn


More information about the Tutor mailing list