I have had scores of servers running a Python script via Apache and mod_wsgi for years now. I recently am building on RHEL7 and have run into an issue where my Python script calling R procedures are bombing out only via Apache stating it cannot find my pip installed Python modules in my Apache log.
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
This seems to only affect modules getting installed in /usr/local/lib64/python3.6/site-packages which is where my custom modules are being installed with pip.
Even if I append it, it ignores it.
sys.path.append(r'/usr/local/lib64/python3.6/site-packages')
I manually built mod_wsgi from source.
I'm ready to abandon mod_wsgi because I have to get my application deployed for my users.
Any help is greatly appreciated.
Thanks,
Lou
It was a file priv issue with /usr/lib64/python3.6 and /usr/lib/python3.6 directories and their child directories. Root ran fine, but running as Apache had no access. You had to chmod-R 755 on both directory trees. Worked fine with Apache after that. Sometimes it’s the simple things we forget to check first.
Running Python in mod_wsgi in Apache Cannot See Python Modules in /usr/local/lib64/python3.6/site-packages