Your home directory is usually going to have permissions which means an other user like the Apache user cannot read anything in it. That or you could have SELinux enabled which restricts where files can be read from.
Graham On 23/10/2013, at 12:36 PM, Derek Schwalenberg <[email protected]> wrote: > It's my own package that I am making. I used pip with the -e option which > editable mode. It basically just links the modules in my home folder as a > package. In the script (at least from the CLi) I can simply import myPackage > or import myModule and it will call the module.py right from > /home/python/myPackage directory. It could be a permissions issue. There is > an easy_install.pth that contains a link to my home folder/python as well. > > On Wednesday, October 23, 2013 3:08:03 PM UTC-4, Graham Dumpleton wrote: > Can you explain more when you say you installed a .egg-link with pip? > > When installing modules you wouldn't normally be using anything called a > .egg-link file, so you are doing something different to the norm. > > What usually happens when installing modules using pip is you end up with an > installed package directory, usually with a version number in the name, and a > corresponding .pth file with same base name that contains the name of the > package directory. It is the .pth files that Python reads and adds to the > Python module search path. > > One of the problems one can have with Apache/mod_wsgi is that you somehow > managed to install a package with restrictive permissions and the user that > Apache runs as can't read things. When Python can't read directories referred > to by .pth files, it will not add them to sys.path and so the package will > not be found. > > So, can you state what Python package you are trying to install and it > available on PyPi? Also details the steps you took to install this? That is, > downloaded from where, and the exact command you then ran to install it and > where you ran that from. Then provide a 'ls -las' directory listing of the > dist-packages directory and the contents of any .pth file corresponding to > the package which was installed. Finally, supply the value of the PYTHONPATH > environment variable if you have it set in your personal account. > > Graham > > On 23/10/2013, at 10:57 AM, Derek Schwalenberg <[email protected]> wrote: > >> Nevermind pprint works. >> >> Yeah I see the directory from the CLi but not from the browser. It even has >> /usr/local/lib/python2.7/dist-packages in both. However from the CLi I see >> my home directory where my editable package .py modules are kept but not >> from the browser. >> >> '/home/*****/python/jobManager', >> '/usr/lib/python2.7', >> '/usr/lib/python2.7/plat-linux2', >> '/usr/lib/python2.7/lib-tk', >> '/usr/lib/python2.7/lib-old', >> '/usr/lib/python2.7/lib-dynload', >> '/usr/local/lib/python2.7/dist-packages', >> '/usr/lib/python2.7/dist-packages', >> '/usr/lib/python2.7/dist-packages/PIL', >> '/usr/lib/python2.7/dist-packages/gst-0.10', >> '/usr/lib/python2.7/dist-packages/gtk-2.0', >> '/usr/lib/pymodules/python2.7', >> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', >> '/usr/lib/python2.7/dist-packages/ubuntuone-client', >> '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', >> '/usr/lib/python2.7/dist-packages/ubuntuone-couch', >> '/usr/lib/python2.7/dist-packages/ubuntuone-installer', >> '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol' >> >> from the browser: >> >> '/usr/lib/python2.7', >> '/usr/lib/python2.7/plat-linux2', >> '/usr/lib/python2.7/lib-tk', >> '/usr/lib/python2.7/lib-old', >> '/usr/lib/python2.7/lib-dynload', >> '/usr/local/lib/python2.7/dist-packages', >> '/usr/lib/python2.7/dist-packages', >> '/usr/lib/python2.7/dist-packages/PIL', >> '/usr/lib/python2.7/dist-packages/gst-0.10', >> '/usr/lib/python2.7/dist-packages/gtk-2.0', >> '/usr/lib/pymodules/python2.7', >> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', >> '/usr/lib/python2.7/dist-packages/ubuntuone-client', >> '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', >> '/usr/lib/python2.7/dist-packages/ubuntuone-couch', >> '/usr/lib/python2.7/dist-packages/ubuntuone-installer', >> '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol' >> >> Strangely the directory for the .egg-link is there but the .egg-link doesn't >> function. >> >> On Wednesday, October 23, 2013 1:42:10 PM UTC-4, Derek Schwalenberg wrote: >> I'm sorry what do you mean by 'dumpy out'? I am just learning python I am >> used to PHP. >> >> On Wednesday, October 23, 2013 1:31:06 PM UTC-4, Graham Dumpleton wrote: >> Dumpy out sys.path. Is /usr/local/lib/python2.7/dist-packages in it. >> >> If you run command line Python you used to install your package, what is >> sys.prefix for it? Is it perhaps that you are using a separate Python 2.7 >> installed under /usr/local? >> >> Graham >> >> On 23/10/2013, at 10:27 AM, Derek Schwalenberg <[email protected]> wrote: >> >>> sys.version = '2.7.3 (default, Sep 26 2013, 20:13:52) \n[GCC 4.6.3]' >>> sys.prefix = '/usr' >>> >>> >>> On Wednesday, October 23, 2013 1:14:21 PM UTC-4, Graham Dumpleton wrote: >>> The mod_wsgi module will be compiled for a specific Python version. You >>> should not put it at a different versioned Python installation or even >>> Python modules installed into the site-packages/dist-packages of a >>> different versioned Python installation as what is installed can be >>> incompatible, especially if it contains extension modules. >>> >>> What you should do is confirm what version of Python mod_wsgi was compiled >>> for: >>> >>> http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Installation_In_Use >>> >>> If it is not the version of Python you want to be able to use, then you >>> must installed the mod_wsgi binary version corresponding to the Python >>> version you do want to use, or uninstall the mod_wsgi binary and recompile >>> mod_wsgi from source code yourself against the required version of Python >>> and install it. >>> >>> If it is the correct Python version and your module is installed into a >>> Python virtual environment based off the correct version, then you need to >>> instruct mod_wsgi to make use of the Python virtual environment. >>> >>> So do the version checks and confirm what mod_wsgi is compiled for. >>> >>> Graham >>> >>> On 23/10/2013, at 10:07 AM, Derek Schwalenberg <[email protected]> >>> wrote: >>> >>>> I used pip to install a .egg-link to >>>> /usr/local/lib/python2.7/dist-packages/ and from the CLi I can type python >>>> script.py (which contains one line import test123) and it will print >>>> 'hello' which is the one line in test123.py but when I connect to mysite >>>> through a web browser and run the same script using mod_wsgi it says >>>> cannot import test123 module.. >>>> >>>> Do I have to just manually add the .egg-link to that script? I can't find >>>> anyway to get mod_wsgi to look at it. I tried WSGIPythonEggs it doesn't >>>> seem to help from either wsgi.conf or putting it in sites-enabled/default >>>> >>>> It could be that I am using python 2.7 and the repository gave me 3.3 >>>> version of mod_wsgi but it runs scripts just fine with the exception of my >>>> .egg-links and I don't really want to have to uninstall apache2 install >>>> apache2-dev and then ./configure with python2.7 but I will if I have to I >>>> guess. I am not even sure that will fix the problem though. >>>> >>>> -- >>>> 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 post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/modwsgi. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> -- >>> 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 post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/modwsgi. >>> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> -- >> 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 post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/modwsgi. >> For more options, visit https://groups.google.com/groups/opt_out. > > > -- > 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 post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/groups/opt_out. -- 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/groups/opt_out.
