What does your mod_wsgi configuration in Apache look like? Is the mod_wsgi you are using definitely been compiled for Python 3.9?
This issue may be caused by one of the following: * A permissions issue where the directory/files for the Python virtual environment are not all readable by the user that Apache is running your code. * Your mod_wsgi is actually compiled for a different Python version than the Python virtual environment was created for. * You are loading PHP into the same Apache instance and PHP is preloading an image library (which prevents PIL loading version it wants) with version which is incompatible with what the PIL image library is expecting. This causes import of PIL imaging extension to fail. I would actually speculate it is the last one, so if you have PHP loaded into the same Apache instance, disable PHP so it is not loaded and see if the issue goes away. Otherwise ensure you supply what your mod_wsgi configuration looks like and what version of Python mod_wsgi was compiled for. > On 7 Jun 2024, at 3:29 AM, 'Satish Malviya' via modwsgi > <modwsgi@googlegroups.com> wrote: > > [Thu Jun 06 22:23:44.515133 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] File > "/dbdata/webcode/ro_env/lib/python3.9/site-packages/xhtml2pdf/pisa.py", line > 26, in <module> > [Thu Jun 06 22:23:44.515137 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] from xhtml2pdf.document > import pisaDocument > [Thu Jun 06 22:23:44.515143 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] File > "/dbdata/webcode/ro_env/lib/python3.9/site-packages/xhtml2pdf/document.py", > line 19, in <module> > [Thu Jun 06 22:23:44.515147 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] from reportlab.lib import > pdfencrypt > [Thu Jun 06 22:23:44.515152 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] File > "/dbdata/webcode/ro_env/lib/python3.9/site-packages/reportlab/lib/pdfencrypt.py", > line 11, in <module> > [Thu Jun 06 22:23:44.515208 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] from reportlab.lib.utils > import asBytes, int2Byte, rawBytes, asNative > [Thu Jun 06 22:23:44.515216 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] File > "/dbdata/webcode/ro_env/lib/python3.9/site-packages/reportlab/lib/utils.py", > line 15, in <module> > [Thu Jun 06 22:23:44.515221 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] from PIL import Image > [Thu Jun 06 22:23:44.515226 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] File > "/dbdata/webcode/ro_env/lib/python3.9/site-packages/PIL/Image.py", line 88, > in <module> > [Thu Jun 06 22:23:44.515230 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] from . import _imaging as > core > [Thu Jun 06 22:23:44.515241 2024] [wsgi:error] [pid 483559:tid > 140503462958656] [remote 106.222.212.29:21720] ImportError: cannot import > name '_imaging' from 'PIL' > (/dbdata/webcode/ro_env/lib/python3.9/site-packages/PIL/__init__.py) > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to modwsgi+unsubscr...@googlegroups.com > <mailto:modwsgi+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/modwsgi/d54d4eee-191e-405c-8a8e-b0efe9e2abcan%40googlegroups.com > > <https://groups.google.com/d/msgid/modwsgi/d54d4eee-191e-405c-8a8e-b0efe9e2abcan%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/C6A44017-0499-4DBA-AAE7-510374B71290%40gmail.com.