Open dennischen opened 1 year ago
That actually looks like a problem with PIL in your environment. What happens if you run python -c 'from PIL import Image'
?
Same error in jplerror3
(jplerror3) dennis@slurm:~$ python -c "from PIL import Image"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/dennis/.conda/envs/jplerror3/lib/python3.11/site-packages/PIL/Image.py", line 103, in <module>
from . import _imaging as core
ImportError: libtiff.so.5: cannot open shared object file: No such file or directory
But, I made a new clean env and install pillow only, it don't throw the error by import pil.
conda create -n pilerr2
conda activate pilerr2
#force version 9.4.0 as same as instal matplotlib
conda install -c conda-forge python pillow=9.4.0 -y
python -c "from PIL import Image"
#no error here
the conda list information
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2023.7.22 hbcca054_0 conda-forge
freetype 2.12.1 hca18f0e_1 conda-forge
lcms2 2.15 haa2dc70_1 conda-forge
ld_impl_linux-64 2.40 h41732ed_0 conda-forge
lerc 4.0.0 h27087fc_0 conda-forge
libdeflate 1.18 h0b41bf4_0 conda-forge
libexpat 2.5.0 hcb278e6_1 conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 13.1.0 he5830b7_0 conda-forge
libgomp 13.1.0 he5830b7_0 conda-forge
libjpeg-turbo 2.1.5.1 h0b41bf4_0 conda-forge
libnsl 2.0.0 h7f98852_0 conda-forge
libpng 1.6.39 h753d276_0 conda-forge
libsqlite 3.42.0 h2797004_0 conda-forge
libstdcxx-ng 13.1.0 hfd8a6a1_0 conda-forge
libtiff 4.5.1 h8b53f26_0 conda-forge
libuuid 2.38.1 h0b41bf4_0 conda-forge
libwebp-base 1.3.1 hd590300_0 conda-forge
libxcb 1.13 h7f98852_1004 conda-forge
libzlib 1.2.13 hd590300_5 conda-forge
ncurses 6.4 hcb278e6_0 conda-forge
openjpeg 2.5.0 hfec8fc6_2 conda-forge
openssl 3.1.2 hd590300_0 conda-forge
pillow 9.4.0 py311h573f0d3_2 conda-forge
pip 23.2.1 pyhd8ed1ab_0 conda-forge
pthread-stubs 0.4 h36c2ea0_1001 conda-forge
python 3.11.4 hab00c5b_0_cpython conda-forge
python_abi 3.11 3_cp311 conda-forge
readline 8.2 h8228510_1 conda-forge
setuptools 68.0.0 pyhd8ed1ab_0 conda-forge
tk 8.6.12 h27826a3_0 conda-forge
tzdata 2023c h71feb2d_0 conda-forge
wheel 0.41.1 pyhd8ed1ab_0 conda-forge
xorg-libxau 1.0.11 hd590300_0 conda-forge
xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
zstd 1.5.2 hfc55251_7 conda-forge
=== the package channel is different
# in jplerror3, pillow is not be installed directly and get libtiff.so.5 not found error
pillow 9.4.0 py311h6a678d5_0
# in pilerr2, pillow is installed directly, no error
pillow 9.4.0 py311h573f0d3_2 conda-forge
A more clear test case can reproduce this.
conda create -n case1 -y
conda activate case1
conda install -c conda-forge python matplotlib -y
python -c "import matplotlib.pyplot as plt"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/dennis/.conda/envs/case1/lib/python3.11/site-packages/matplotlib/__init__.py", line 129, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "/home/dennis/.conda/envs/case1/lib/python3.11/site-packages/matplotlib/rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "/home/dennis/.conda/envs/case1/lib/python3.11/site-packages/matplotlib/colors.py", line 51, in <module>
from PIL import Image
File "/home/dennis/.conda/envs/case1/lib/python3.11/site-packages/PIL/Image.py", line 103, in <module>
from . import _imaging as core
ImportError: libtiff.so.5: cannot open shared object file: No such file or directory
conda create -n case2 -y
conda activate case2
conda install -c conda-forge python matplotlib pillow=9.4.0 -y
python -c "import matplotlib.pyplot as plt"
It looks like install matplotlib from conda-forge cann't get same pillow from conda-forget since this week. (no error in last week)
I am new to python and conda, no sure the root cause
The conda-forge environment that errors is mixing packages from different channels, which is not a supported configuration. Does it work if you create the environment using only conda-forge:
conda create -c conda-forge -n case3 python matplotlib
just tried your suggestion
conda create -c conda-forge -n case3 python matplotlib
but the pillow is still not from conda-forge
pillow 9.4.0 py311h6a678d5_0
and run import matpoltlib get same error.
I doubt it is a cach issue, but get same error in new VM. any other idea? cloud you run this test correctly in your env?
I can't reproduce this on my macOS system, so it's something specific to linux it seems. Some potential things to try:
conda config --set channel_priority strict
defaults
channel in your .condarc
with only conda-forge
to completely eliminate the possibility of mixing themmatplotlib
itself is just matplotlib-base
+ pyqt
, so unless you need a pyqt
-based GUI, try using matplotlib-base
instead
Solution to issue cannot be found in the documentation.
Issue
I am studying python + matplotlib, Everything was ok on last Monday, but I try to re-run my case today get error.
I can reporduce it by following commands in my ubuntu 20
But, if I remove the -c conda-forge, it works fine
Installed packages
Environment info