I have a flask application that is run on apache using mod_wsgi. I have a 
python environment that I set up using miniconda. Initially, mod_wsgi was 
installed using conda. Using a mod_wsgi daemon process with a properly set 
python-home, I was able to run a very basic "hello, world" app to verify 
things were working properly. I then began to add pieces to the app to 
process data and output images. I began to see ImportError in the apache 
logs when trying to run the app. The specific error was:

ImportError: /lib64/libz.so.1: version `ZLIB_1.2.9` not found (required by 
~/miniconda3/envs/......./libpng16.so.16)

This error is triggered by importing the rasterio package (which depends on 
GDAL, which needs libpng). When I look at the libpng referred to by the 
error with ldd, however, it is properly linked to the libz that is in the 
conda environment. Somehow the library path only includes the system paths 
within the daemon process. If I am to use my conda environment python on 
the command line to import rasterio, no such error occurs. It only occurs 
within the flask app. I next built mod_wsgi from source using the conda 
environment python just to be sure I was having that all linked correctly. 
The same error still occurred in the app. When checking the sys.path from 
within the app, that all looks appropriate as well.

Just based on what I am seeing, it seems like something is going on 
specifically with the mod_wsgi daemon process. Do I need to set something 
other than just python-home? There is an SO question with a very similar 
issue 
(https://stackoverflow.com/questions/33497639/why-is-wsgi-looking-for-a-library-in-lib64-when-the-correct-version-is-in-the-p),
 
but the proposed solution seems like bad practice to me. I am hoping 
someone has an idea of what might be happening here.

mod_wsgi: 4.9.3
apache: 2.4.6
python: 3.10.6
flask: 2.2.2

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/9dd85566-ec3f-42f4-bfe3-3032e6d486den%40googlegroups.com.

Reply via email to