You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Josh Kupershmidt (JIRA)" <ji...@apache.org> on 2008/09/29 01:18:44 UTC

[jira] Created: (MODPYTHON-252) mod_python install forces Python libraries into system-wide install directory

mod_python install forces Python libraries into system-wide install directory
-----------------------------------------------------------------------------

                 Key: MODPYTHON-252
                 URL: https://issues.apache.org/jira/browse/MODPYTHON-252
             Project: mod_python
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.1
         Environment: Tested on Linux, with mod_python 3.3.1
            Reporter: Josh Kupershmidt
            Priority: Minor
             Fix For: 3.3.1


I need to have mod_python installed as an unprivileged user. I have Apache installed as an unprivileged user, to directory

/home/user/apache/2.0.63/... 

And I need mod_python.so installed to 

/home/user/apache/2.0.63/modules

The arguments I pass to ./configure are:

./configure --with-apache=/home/user/apache/2.0.63/ --prefix=/home/user/apache/2.0.63/modules/ --with-python=/directory/to/system-wide/install/of/python --with-apxs=/home/user/apache/2.0.63/bin


This all works fine for installing mod_python.so into Apache's modules directory. However, the Python libraries are being forced into /directory/to/system-wide/install/of/python/lib/python2.5/site-packages. I really want these Python libraries installed into /home/user/libraries/

I've tracked the problem, and my somewhat kludgy workaround, down to ./dist/Makefile.in. The following lines in ./dist/Makefile.in note that root privileges may be required:

# this may require root priviledges
install_py_lib: mod_python src
        @cd src; $(MAKE) psp_parser.c
        if test -z "$(DESTDIR)" ; then \
                export LDFLAGS="-L$(PYTHON_LIBDIR)" ; $(PYTHON_BIN) setup.py install  --optimize 2 --force ; \
        else \
                export LDFLAGS="-L$(PYTHON_LIBDIR)" ; $(PYTHON_BIN) setup.py install --optimize 2 --force --root $(DESTDIR) ; \


To get around the requirement for installing the Python libraries system-wide, I simply added --prefix=/home/user/libraries/  after "setup.py install" in the above lines as a workaround. 

Note that the $DESTDIR variable in the above lines does not do what I want: I tried manually setting DESTDIR, but it forced the entire mod_python install (of mod_python.so, as well as the Python libraries) into subdirectories of /home/user/libraries. It also screwed up any other installs (e.g. httpd) done at the same time which also depend on the DESTDIR environment variable, if exported globally. 

I recommend a ./configure flag be added to allow the user to specify which directory the mod_python Python libraries should be installed into, and perhaps a note about setting PYTHONPATH appropriately. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MODPYTHON-252) mod_python install forces Python libraries into system-wide install directory

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MODPYTHON-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635266#action_12635266 ] 

Graham Dumpleton commented on MODPYTHON-252:
--------------------------------------------

You shouldn't need to use --with-apache option, only use --with-apxs.

If wanting to install Python stuff into a different location you have a couple of options.

1. When doing installation, use:

  make install_dso
  DESTDIR=/home/user/libraries/ make install_py_lib

If you do this though, Python when used in mod_python will not know where to find the files as not on standard Python module search path. Thus you would have to organise for PYTHONPATH to be set in environment of Apache when run to reference the alternate location.

2. Use a Python virtual environment instead. Ie., virtualenv. See:

  http://pypi.python.org/pypi/virtualenv

Build mod_python against that using --with-python option after having activated the environment.

If you do this though, because 'python' executable not in standard locations, you will need to set PATH in environment of Apache when run to reference that virtual environment's bin directory, or set PYTHONHOME in environment to location of virtual environment.




> mod_python install forces Python libraries into system-wide install directory
> -----------------------------------------------------------------------------
>
>                 Key: MODPYTHON-252
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-252
>             Project: mod_python
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: Tested on Linux, with mod_python 3.3.1
>            Reporter: Josh Kupershmidt
>            Priority: Minor
>             Fix For: 3.3.1
>
>
> I need to have mod_python installed as an unprivileged user. I have Apache installed as an unprivileged user, to directory
> /home/user/apache/2.0.63/... 
> And I need mod_python.so installed to 
> /home/user/apache/2.0.63/modules
> The arguments I pass to ./configure are:
> ./configure --with-apache=/home/user/apache/2.0.63/ --prefix=/home/user/apache/2.0.63/modules/ --with-python=/directory/to/system-wide/install/of/python --with-apxs=/home/user/apache/2.0.63/bin
> This all works fine for installing mod_python.so into Apache's modules directory. However, the Python libraries are being forced into /directory/to/system-wide/install/of/python/lib/python2.5/site-packages. I really want these Python libraries installed into /home/user/libraries/
> I've tracked the problem, and my somewhat kludgy workaround, down to ./dist/Makefile.in. The following lines in ./dist/Makefile.in note that root privileges may be required:
> # this may require root priviledges
> install_py_lib: mod_python src
>         @cd src; $(MAKE) psp_parser.c
>         if test -z "$(DESTDIR)" ; then \
>                 export LDFLAGS="-L$(PYTHON_LIBDIR)" ; $(PYTHON_BIN) setup.py install  --optimize 2 --force ; \
>         else \
>                 export LDFLAGS="-L$(PYTHON_LIBDIR)" ; $(PYTHON_BIN) setup.py install --optimize 2 --force --root $(DESTDIR) ; \
> To get around the requirement for installing the Python libraries system-wide, I simply added --prefix=/home/user/libraries/  after "setup.py install" in the above lines as a workaround. 
> Note that the $DESTDIR variable in the above lines does not do what I want: I tried manually setting DESTDIR, but it forced the entire mod_python install (of mod_python.so, as well as the Python libraries) into subdirectories of /home/user/libraries. It also screwed up any other installs (e.g. httpd) done at the same time which also depend on the DESTDIR environment variable, if exported globally. 
> I recommend a ./configure flag be added to allow the user to specify which directory the mod_python Python libraries should be installed into, and perhaps a note about setting PYTHONPATH appropriately. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MODPYTHON-252) mod_python install forces Python libraries into system-wide install directory

Posted by "Josh Kupershmidt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MODPYTHON-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635386#action_12635386 ] 

Josh Kupershmidt commented on MODPYTHON-252:
--------------------------------------------

Graham, thanks for the quick response. I looked into your first suggestion. The note about separating make install_dso and make install_py_lib was very helpful, however I do have some troubles to point out that I'm still having to work around:

1.) make install_dso works exactly the way I intended (mod_python.so gets put into /home/user/apache/2.0.63/modules , like I want)

2.) make install_py_lib is a little trickier: AFAICT, setting DESTDIR to /home/user/libraries/  causes ./dest/Makefile.in to pick up this environment variable, and pass the argument "--root $(DESTDIR)" to setup.py install , as in the last line in the snippet of Makefile.in that I posted. 

It appears that --root and --prefix are slightly different. From the output of running python setup.py --help install:

Options for 'install' command:
  --prefix            installation prefix
[snip]
  --root              install everything relative to this alternate root
                      directory

When I manually force Makefile.in to use --prefix=/home/user/libraries/ , I get the following directory structure created:

/home/user/libraries/lib/python2.5/site-packages/mod_python/

which is what I want. However, by doing as you suggest, namely:

DESTDIR=/home/user/libraries/ 
make install_py_lib 

I get the Python libraries installed to a different subdirectory of /home/user/libraries. The install creates and populates:

/home/user/libraries/directory/to/system-wide/install/of/python/lib/python2.5/site-packages/mod_python/ 

This install proceeds successfully, but it's not exactly what I want. 

3.) About using --with-apxs instead of --with-apache.. I haven't a clue why, but --with-apxs doesn't seem to be working for me. When I run ./configure with the following flags:

./configure --prefix=/home/user/apache/2.0.63/modules/ --with-python=/directory/to/system-wide/install/of/python  --with-apxs=/home/user/apache/2.0.63/bin/

(and other variations on the apxs directory), I get the following bailout at the end of ./configure:

configure: checking whether apxs is available...
checking for apachectl... no
checking for apache2ctl... no
checking for apachectl2... no
configure: error: could not find Apache installation

I modified $PATH like this: 

export PATH="/home/user/apache/2.0.63/bin/:$PATH"

and then ran ./configure with the same arguments, and it went fine -- so it appears the ./configure script just wasn't picking up the --with-apxs specification properly. Using --with-apache=/home/user/apache/2.0.63/ also works fine, both with and without the --with-apxs argument. 


Thanks again for your help. 
Josh


> mod_python install forces Python libraries into system-wide install directory
> -----------------------------------------------------------------------------
>
>                 Key: MODPYTHON-252
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-252
>             Project: mod_python
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: Tested on Linux, with mod_python 3.3.1
>            Reporter: Josh Kupershmidt
>            Priority: Minor
>             Fix For: 3.3.1
>
>
> I need to have mod_python installed as an unprivileged user. I have Apache installed as an unprivileged user, to directory
> /home/user/apache/2.0.63/... 
> And I need mod_python.so installed to 
> /home/user/apache/2.0.63/modules
> The arguments I pass to ./configure are:
> ./configure --with-apache=/home/user/apache/2.0.63/ --prefix=/home/user/apache/2.0.63/modules/ --with-python=/directory/to/system-wide/install/of/python --with-apxs=/home/user/apache/2.0.63/bin
> This all works fine for installing mod_python.so into Apache's modules directory. However, the Python libraries are being forced into /directory/to/system-wide/install/of/python/lib/python2.5/site-packages. I really want these Python libraries installed into /home/user/libraries/
> I've tracked the problem, and my somewhat kludgy workaround, down to ./dist/Makefile.in. The following lines in ./dist/Makefile.in note that root privileges may be required:
> # this may require root priviledges
> install_py_lib: mod_python src
>         @cd src; $(MAKE) psp_parser.c
>         if test -z "$(DESTDIR)" ; then \
>                 export LDFLAGS="-L$(PYTHON_LIBDIR)" ; $(PYTHON_BIN) setup.py install  --optimize 2 --force ; \
>         else \
>                 export LDFLAGS="-L$(PYTHON_LIBDIR)" ; $(PYTHON_BIN) setup.py install --optimize 2 --force --root $(DESTDIR) ; \
> To get around the requirement for installing the Python libraries system-wide, I simply added --prefix=/home/user/libraries/  after "setup.py install" in the above lines as a workaround. 
> Note that the $DESTDIR variable in the above lines does not do what I want: I tried manually setting DESTDIR, but it forced the entire mod_python install (of mod_python.so, as well as the Python libraries) into subdirectories of /home/user/libraries. It also screwed up any other installs (e.g. httpd) done at the same time which also depend on the DESTDIR environment variable, if exported globally. 
> I recommend a ./configure flag be added to allow the user to specify which directory the mod_python Python libraries should be installed into, and perhaps a note about setting PYTHONPATH appropriately. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MODPYTHON-252) mod_python install forces Python libraries into system-wide install directory

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MODPYTHON-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635580#action_12635580 ] 

Graham Dumpleton commented on MODPYTHON-252:
--------------------------------------------

The argument to --with-apxs is meant to be the full path to the apxs program, not to Apache installation root or bin directories.

> mod_python install forces Python libraries into system-wide install directory
> -----------------------------------------------------------------------------
>
>                 Key: MODPYTHON-252
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-252
>             Project: mod_python
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: Tested on Linux, with mod_python 3.3.1
>            Reporter: Josh Kupershmidt
>            Priority: Minor
>             Fix For: 3.3.1
>
>
> I need to have mod_python installed as an unprivileged user. I have Apache installed as an unprivileged user, to directory
> /home/user/apache/2.0.63/... 
> And I need mod_python.so installed to 
> /home/user/apache/2.0.63/modules
> The arguments I pass to ./configure are:
> ./configure --with-apache=/home/user/apache/2.0.63/ --prefix=/home/user/apache/2.0.63/modules/ --with-python=/directory/to/system-wide/install/of/python --with-apxs=/home/user/apache/2.0.63/bin
> This all works fine for installing mod_python.so into Apache's modules directory. However, the Python libraries are being forced into /directory/to/system-wide/install/of/python/lib/python2.5/site-packages. I really want these Python libraries installed into /home/user/libraries/
> I've tracked the problem, and my somewhat kludgy workaround, down to ./dist/Makefile.in. The following lines in ./dist/Makefile.in note that root privileges may be required:
> # this may require root priviledges
> install_py_lib: mod_python src
>         @cd src; $(MAKE) psp_parser.c
>         if test -z "$(DESTDIR)" ; then \
>                 export LDFLAGS="-L$(PYTHON_LIBDIR)" ; $(PYTHON_BIN) setup.py install  --optimize 2 --force ; \
>         else \
>                 export LDFLAGS="-L$(PYTHON_LIBDIR)" ; $(PYTHON_BIN) setup.py install --optimize 2 --force --root $(DESTDIR) ; \
> To get around the requirement for installing the Python libraries system-wide, I simply added --prefix=/home/user/libraries/  after "setup.py install" in the above lines as a workaround. 
> Note that the $DESTDIR variable in the above lines does not do what I want: I tried manually setting DESTDIR, but it forced the entire mod_python install (of mod_python.so, as well as the Python libraries) into subdirectories of /home/user/libraries. It also screwed up any other installs (e.g. httpd) done at the same time which also depend on the DESTDIR environment variable, if exported globally. 
> I recommend a ./configure flag be added to allow the user to specify which directory the mod_python Python libraries should be installed into, and perhaps a note about setting PYTHONPATH appropriately. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.