Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6615223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:26:09+00:00 2026-05-25T20:26:09+00:00

This is a long question detailing all that I did from the start. Hope

  • 0

This is a long question detailing all that I did from the start. Hope it helps.
I am working on a django application and need to deploy it on to the production server. The production server is a virtual server managed by IT, and I do not have the root access. They have given me rights to manage the installations of my modules in /swadm and /home/swadm.
So I have planned to do create the following arrangement:

  • /swadm/etc/httpd/conf where I maintain httpd.conf
  • /swadm/etc/httpd/user-modules where I maintain my apache modules (mod_wsgi)
  • /swadm/var/www/django/app where I maintain my django code
  • /swadm/usr/local/python/2.6 where I will maintain my python 2.6.7 installation with modules like django, south etc.
  • /home/swadm/setup where I will be storing the required source tarballs and doing all the building and installing out of.
  • /home/swadm/workspace where I will be maintaining application code that is in development.

The system has python2.4.3 and python2.6.5 installed but IT recommended that I maintain my own python installation if I required lot of custom modules to be installed (which I would be).

So I downloaded python2.6.7 source. I needed to ensure python is installed such that its shared library is available. When I ran the configure script with only the option --enable-shared and --prefix=/swadm/usr/local/python/2.6, it would get installed but surprisingly point to the system’s installation of python2.6.5.

$ /swadm/usr/local/python/2.6/bin/python
Python 2.6.5 (r265:79063, Feb 28 2011, 21:55:45)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

So I ran the configure script following instructions from Building Python with –enable-shared in non-standard location as

./configure --enable-shared --prefix=/swadm/usr/local/python/2.6  LDFLAGS="-Wl,-rpath /swadm/usr/local/python/2.6/lib"

Also making sure I had created the directories beforehand ( as the link suggests) to avoid the errors expected. Now typing /swadm/usr/local/python/2.6/bin/python would start the correct python version 2.6.7. So I moved on to configuring and installing mod_wsgi. I configured it as

./configure --with-python=/swadm/usr/local/python/2.6/bin/python

the Makefile that was created tries to install the module into /usr/lib64/httpd/modules and I have no write permissions there, so I modified the makefile to install into /swadm/etc/httpd/user-modules. (There might be a command argument but I could not figure it out). The module got created fine. A test wsgi script which I used was

import sys

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'
    output = output + str(sys.version_info)
    output = output + '\nsys.prefix = %s' % repr(sys.prefix)
    output = output + '\nsys.path = %s' % repr(sys.path)
    response_headers = [('Content-type', 'text/plain'),
                    ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]

And the output shown was, surprisingly

Hello World!(2, 6, 5, 'final', 0)
sys.prefix = '/swadm/usr/local/python/2.6'
sys.path = ['/swadm/usr/local/python/2.6/lib64/python26.zip',    '/swadm/usr/local/python/2.6/lib64/python2.6/', '/swadm/usr/local/python/2.6/lib64/python2.6/plat-linux2', '/swadm/usr/local/python/2.6/lib64/python2.6/lib-tk', '/swadm/usr/local/python/2.6/lib64/python2.6/lib-old', '/swadm/usr/local/python/2.6/lib64/python2.6/lib-dynload']`

So you see somehow the mod_wsgi module still got configured with the system’s python 2.6.5 installation and not my custom one.
I tried various things detailed in the mod_wsgi documentation

  • Set WSGIPythonHome in httpd.conf to /swadm/usr/local/python/2.6 and
    WSGIPythonPath to /swadm/usr/local/python/2.6/lib/python2.6
  • Created a symlink in the python config directory to point to the libpython2.6.so file

    $ ln -s ../../libpython2.6.so

When I do ldd libpython2.6.so this is what I see:

$ ldd libpython2.6.so
 linux-vdso.so.1 =>  (0x00007fffc47fc000)
 libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b666ed62000)
 libdl.so.2 => /lib64/libdl.so.2 (0x00002b666ef7e000)
 libutil.so.1 => /lib64/libutil.so.1 (0x00002b666f182000)
 libm.so.6 => /lib64/libm.so.6 (0x00002b666f385000)
 libc.so.6 => /lib64/libc.so.6 (0x00002b666f609000)
 /lib64/ld-linux-x86-64.so.2 (0x00000031aba00000)

And ldd mod_wsgi.so gives

$ ldd /swadm/etc/httpd/user-modules/mod_wsgi.so
 linux-vdso.so.1 =>  (0x00007fff1ad6e000)
 libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00002af03aec7000)
 libpthread.so.0 => /lib64/libpthread.so.0 (0x00002af03b270000)
 libdl.so.2 => /lib64/libdl.so.2 (0x00002af03b48c000)
 libutil.so.1 => /lib64/libutil.so.1 (0x00002af03b690000)
 libm.so.6 => /lib64/libm.so.6 (0x00002af03b893000)
 libc.so.6 => /lib64/libc.so.6 (0x00002af03bb17000)
 /lib64/ld-linux-x86-64.so.2 (0x00000031aba00000)

I have been trying re-installing and re-configuring python and mod_wsgi but to no avail. Please let me know where I am going wrong.
(Sorry for the very long post)

TLDR; System with non-root access has default python installation. I am maintaining my own python and python modules. mod_wsgi configured and built with the custom python, still points to the system’s python when I run a test script that prints out the sys version_info and path.

UPDATE:
On Browsing through the stackoverflow (should have done it earlier) I found this answer by Graham Dumpleton on mod_wsgi python2.5 ubuntu 11.04 problem which solved the error for me. Now when I do ldd mod_wsgi.so I see that it is linked to the correct shared library of python. I now installed Django and MySQLdb using my custom python install. And Now I am facing this error:

The following error occurred while trying to extract file(s) to the Python egg
cache:
[Errno 13] Permission denied: '/var/www/.python-eggs'
The Python egg cache directory is currently set to:
/var/www/.python-eggs
Perhaps your account does not have write access to this directory?  You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.

So I did change the value of PYTHON_EGG_CACHE by doing export PYTHON_EGG_CACHE=/swadm/var/www/.python-eggs. but I am still getting the same error. I am investigating more. Will update when I solve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:26:10+00:00Added an answer on May 25, 2026 at 8:26 pm

    Egg cache issue solved by setting environment variable in WSGI script:

    http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User

    or in Apache configuration:

    http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonEggs
    http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess

    Which of latter two is used depends on whether using emebedded mode or daemon mode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question has been puzzling me for a long time now. I come from
This is a somewhat long question, but I hope I can express it clearly.
I apologize in advance; this is a long question. I've tried to simplify as
:) This might look to be a very long question to you I understand,
Sorry for this long post. The question is however small but requires full detail.
Firstly, This might seem like a long question. I don't think it is... The
This is a long text. Please bear with me. Boiled down, the question is:
This question is an exact duplicate of: Why generate long serialVersionUID instead of a
JD Long helped me with this: question about manual annotation . But is it
This is an extension of a question I previously asked here . Long story

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.