The per user site-packages directory under $HOME is not used if you are using a Python virtual environment. You should not be installing packages using 'pip install --user' if using a virtual environment, they should be installed into the virtual environment.
Further, under Apache the code doesn't even run as your user, but the Apache user, and wouldn't even be the same $HOME directory anyway. If the tensorflow package is relying on the per user site packages directory always being used and the site.USER_SITE variable being present, it is arguably broken. Why is tensorflow expecting site.USER_SITE to exist and what is it using the directory for? > On 29 Aug 2019, at 7:26 am, Steve Fielding <[email protected]> wrote: > > The actual value of python-path does not seem to matter. I show it set to the > tensorflow research directory because, it is my ultimate target, and that > code base needs to access site.USER_SITE > > config file: > <VirtualHost *:80> > ServerName checkwsgi.com > WSGIDaemonProcess checkwsgi.com > home=/home/stevefielding_ca/github/REST-tutorial > python-home=/home/stevefielding_ca/.virtualenvs/cv/bin/python > python-path=/home/stevefielding_ca/github/models/research:/home/stevefielding_ca/github/models/research/slim > WSGIProcessGroup checkwsgi.com > WSGIScriptAlias / > /home/stevefielding_ca/github/REST-tutorial/checkInstall.py > <Directory /home/stevefielding_ca/github/REST-tutorial/> > Require all granted > </Directory> > </VirtualHost> > > > This is my script: > import sys > import site > def application(environ, start_response): > status = '200 OK' > output = '' > output += 'sys.version = {}\n'.format( repr(sys.version)) > output += 'sys.prefix = {}\n'.format(repr(sys.prefix)) > output += 'sys.path = {}\n'.format(repr(sys.path)) > output += 'site.USER_SITE = {}\n'.format(site.USER_SITE) > response_headers = [('Content-type', 'text/plain'), > ('Content-Length', str(len(output)))] start_response(status, > response_headers) > print(output) > output = bytes(output,'utf-8') > return output > > > > I get the following error when I try to access my script: > [Wed Aug 28 20:53:06.010105 2019] [wsgi:error] [pid 9148:tid 139859258083072] > [remote 127.0.0.1:39307] output += 'site.USER_SITE = > {}\\n'.format(site.USER_SITE) > [Wed Aug 28 20:53:06.010121 2019] [wsgi:error] [pid 9148:tid 139859258083072] > [remote 127.0.0.1:39307] AttributeError: module 'apache' has no attribute > 'USER_SITE' > > If I remove the python-path from my wsgi conf file, then everything works > fine. > > > > -- > 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] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/modwsgi/c65ef285-5c13-4494-b594-2f3e82d60628%40googlegroups.com > > <https://groups.google.com/d/msgid/modwsgi/c65ef285-5c13-4494-b594-2f3e82d60628%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/182CB855-FAC9-4EFD-A298-3ABCE84C35B8%40gmail.com.
