Question

Installing SWIG python bindings for subversion, trac

Asked by: rsgalloway


I have a CentOS 5 machine running Apache 2.2, python 2.5, subversion 1.5.2, and trac 0.11. Originally, the machine came with Python 2.4 and SVN 1.4.2 with the SWIG python bindings:

  python2.4 -c "import svn.repos, sys; print svn.repos.__file__; print sys.version"
  /usr/lib/python2.4/site-packages/svn/repos.pyc
  2.4.3 (#1, Mar 14 2007, 18:51:08)
  [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)]

After installing Python 2.5 and SVN 1.5.2, I have lost the SWIG python bindings:

  python -c "import svn.repos, sys; print svn.repos.__file__; print sys.version"
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ImportError: No module named svn.repos

I don't understand this. I installed python 2.5 first, then SVN 1.5.2. Why would SVN put the python bindings into the python 2.4 site-packages area?

  /usr/lib/python2.4/site-packages/libsvn
  /usr/lib/python2.4/site-packages/svn

Trac requires the SWIG python bindings to work. I need to simple, step-by-step instructions on how to get SWIG python bindings installed into the installed python 2.5 site-packages area for an installed subversion package.

Bonus point for any advice on getting mod_python and mod_dav_svn installed as well. I've actually downloaded and configured mod_python for python 2.5, I just haven't run 'make install' yet because I don't know if it's going to mess with my running apache or not.



This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-10-02 at 18:25:06ID23783768
Tags

swig

,

svn

,

subversion

,

python

,

apache

,

trac

Topics

Subversion

,

Red Hat Linux

,

Python Scripting Language

Participating Experts
1
Points
250
Comments
14

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Javascript in Python
    Hi. I am writing a simple web page. I have a static page which uses Javascript to validate a registration form. I then call a Python script to access a gadfly DB which checks if whether the username already exists. I need to some how get python to return to the same registrat...
  2. Python handlers with apache
    Hi, i have installed viewcvs software on Rehdat ES 3.0. My apacher server version is 2.0.40. The following are the entries I have made in the httpd.conf file. AddHandler cgi-script .cgi .py <Directory /var/www/html/viewcvs/> Options +FollowSymLinks +Indexes +Incl...
  3. mod_python mysql eggs no permission
    I have a RHEL 4 dedicated server with root access. I have updated via rpms Python to 2.5.1 as well as rebuilt mod_python. I have the configuration for apache python as follows: LoadModule python_module modules/mod_python.so <Directory "mywebdirectory"> ...
  4. Calling Python Functions From Within PHP
    I am looking to setup a website that uses mysql / php / python / apache. Basically, instead of trying to figure out how to do tricky stuff in mysql itself I am going to use python to manipulate data. I also am hoping python will be quicker. I hope to create an entire API i...
  5. To install python and plone on Centos 5.1 VPS
    I want to install python 2.5.2 to run turbogears and bind to mysql and at the same time install plone in /opt using unified plone installer. The plone uses python 2.4.4 and is it possible to bind python 2.4.4 to mysql too. To install python 2.5.2, what other dependencies do ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: urgollPosted on 2008-10-02 at 19:21:17ID: 22630590

Hello,
the location of the installed swig bindings is determined by swig, not subversion. Most likely, the swig you have was compiled against python 2.4, and therefore is configured to put the bindings into the python 2.4 directory.

After upgrading python to 2.5, you may have to upgrade (or at least recompile) swig to match your new python setup.

I have very little experience with mod_python, but mod_dav_svn is fairly easy. All you have to do when compiling subversion is add this to the ./configure line:
  --with-apxs
assuming the apache apxs binary is in your path.
Then when you 'make install' subversion, the mod_dav_svn will be copied to apache's module directory.

 

by: rsgallowayPosted on 2008-10-02 at 20:09:56ID: 22630772

Ok, I upgraded SWIG to 1.3.35, but all it did was put a bunch of stuff here:

    /usr/share/swig/1.3.35/python

What does that mean? Do I need to download and install the source tarball and do a custom configuration instead? Then run a make swig-py? What are the specific steps to create the SVN python bindings?

 

by: urgollPosted on 2008-10-03 at 07:52:13ID: 22634564

Of all the software we're talking about (apache, swig, python, svn) which came with CentOS and which did you compile and install manually ?

Did you update swig using yum (centos package) or manually ?

 

by: rsgallowayPosted on 2008-10-03 at 08:42:00ID: 22635078

Apache 2.2, SWIG, Python 2.4 and SVN 1.4.2 came with the CentOS 5 box.

I installed httpd-devel, SVN 1.5.2 and SWIG 1.3.3 using webmin's rpm package installer, and mod_python, trac 0.11 and Python 2.5 I compiled manually.

yum is offline after I installed Python 2.5. I don't know how to get that working again either, but that's a separate issue.

 

by: urgollPosted on 2008-10-03 at 08:48:03ID: 22635131

You said:
I installed httpd-devel, SVN 1.5.2 and SWIG 1.3.3 using webmin's rpm package installer

Are those RPM from CentOS or from a 3rd party ? The issue here is swig. Swig needs to be compiled against a specific version of python. As long as you are using swig as provided by CentOS5, it is compiled against python 2.4, since this is what CentOS5 provides.

Since you compiled python 2.5 manually, you also need to compile swig manually and tel it where to find python (if 2.5 is not /usr/bin/python).

After that is done, you also need to compile svn 1.5 yourself, since it needs to be compiled against your new swig and python libraries.

Hope this helps.

 

by: rsgallowayPosted on 2008-10-03 at 09:03:16ID: 22635268

Okay, I was afraid of something like that.

The httpd-devel RPM (and associated dependencies) are from CentOS, I believe. The rest are not.

So basically, I need to

1) recompile SWIG with some option like, --with-python=/path/to/python
2) recompile SVN (hoping it will pick up the new SWIG stuff)

Can I do that using the RPMs? Or do I need to download the sources for both of those? Won't it complain that I already have SVN and SWIG installed? Is there a way to UNinstall packages like SVN/SWIG?

 

by: urgollPosted on 2008-10-04 at 07:17:46ID: 22640940

You can remove packages easily, using the rpm command. For example, to remove the SWIG package, you would do:
#  rpm -e swig

Assuming that your python 2.5 is now the default /usr/bin/pyhon on your system, you can do this with RPMs. All you need to do is get the source rpm file (.src.rpm) from the CentOS mirror, and recompile it. This is done with:
#  rpmbuild -bb package.src.rpm
(replace 'package.src.rpm' with the actual source package file name)
It is possible that some -devel packages will be missing, just install those.
The rpmbuild command will compile the package and place it in the /usr/src/redhat/i386 directory (or similar, depending on your computer's architcture). You can then use 'rpm -i package.rpm' to installl it.

So, still assuming that your python 2.5 is the default, you can do:
* remove original svn package
* remove original SWIG package
* rebuild SWIG from source RPM
* install new SWIG rpm
* rebuild SVN from source RPM
* install new SVN rpms

If your python 2.5 is NOT the default /usr/bin/python, then you cannot use the source rpm, as you need to provide the argument '--with-python=/path/to/python' on the ./configure command when building SWIG. However, you should still be able to use the source RPM for SVN.

One BIG not of caution here: you need to keep track of the packages you rebuild, as you must not apply any CentOS-provided upgrade for those packages, as they would revert to using python 2.4 and would break your TRAC installation.

Please let me know how it goes and if you have any further problem.

Regards,
Christophe

 

by: rsgallowayPosted on 2008-10-04 at 12:43:13ID: 22642036

Making progress. I removed the SWIG and SVN packages, downloaded the source tarballs for each, and installed them.

Output from SWIG config:

checking for Python prefix... /usr/local
checking for Python exec-prefix... /usr/local
checking for Python version... python2.5
checking for Python lib dir... lib
checking for Python header files... -I/usr/local/include/python2.5 -I/usr/local/lib/python2.5/config
checking for Python library... /usr/local/lib/python2.5/config

and the make install put a bunch of stuff here:

Installing /usr/local/share/swig/1.3.36/python/

The SVN config did find python 2.5 and the SWIG bindings:

checking for python... /usr/local/bin/python
...
configure: Configuring python swig binding
checking for Python includes... -I/usr/local/include/python2.5
checking for compiling Python extensions... gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC
checking for linking Python extensions... gcc -pthread -shared
checking for linking Python libraries...

although there was this:

checking swig version... 1.3.36
configure: WARNING: Detected SWIG version 1.3.36
configure: WARNING: Subversion requires 1.3.24 or later, and is known to work
configure: WARNING: with versions up to 1.3.31

However, the words python or swig did not appear once in the SVN make install output, which seems odd. I would have expected to see something about installing into the python2.5 site-packages area. Also, I still can't import the svn package in python 2.5.

Is there another package I need to download and install? Or, did I leave something out of the SVN ./configure?



 

by: rsgallowayPosted on 2008-10-04 at 13:10:04ID: 22642119

Update:

I ran these three commands in the SVN source folder:

make swig-py
make check-swig-py
make install-swig-py

and they all completed without error, which is great. I didn't know anything about these commands until a google search. Anyway, it put the SVN python bindings here:

/usr/local/lib/svn-python/libsvn/
/usr/local/lib/svn-python/svn/

which is not where I wanted them, but I guess there are options for that using LIBDIR or LD_LIBRARY_PATH or something. Not really sure how to use those, so I just made a sym link in the python 2.5 site-packages area to the svn libs and it works. I can import svn in python 2.5 now. Unfortunately, it still doens't fix my trac problem. I'm still getting this error:

Unsupported version control system "svn". Check that the Python support libraries for "svn" are correctly installed.

Do I need to recompile trac or something now? Anyone know?


 

by: urgollPosted on 2008-10-04 at 13:32:50ID: 22642183

Are you using TRAC as a CGI or with mod_python ? You need to make sure that TRAC is using python 2.5, not 2.4. If using as CGI, look at the first line of cgi-bin/trac.cgi. If using mod_python, it depends on the version of python mod_python was compiled against.

I haven't used TRAC in a while, but you may have to re-install it. During the installation, the python code is bytecode-compiled, which may or may not be compatible from 2.4 to 2.5, and it probably stores properties such as the location of python.

Just to let you know I'll be out of network access tonight and tomorrow, but will look up this thread tomorrow night see if you've made progress and if I can conjure up some more advise.

Have a great week-end,
Christophe

 

by: rsgallowayPosted on 2008-10-04 at 13:43:18ID: 22642207

Thanks for the information.

I'm actually running trac with the trac server: tracd, at least until I reinstall mod_python. I have recompiled mod_python with python 2.5, but have not run the make install yet because I was nervous it might break something. I have live sites deployed and no dev/test server. So the tracd server is using python2.5, no doubt.

It's funny because I set up a new trac project and svn repo and that syncs up fine. I just get that error on an existing trac project, so maybe it's a trac project config issue. I will keep playing with it. Thanks for the help, urgoll.

 

by: rsgallowayPosted on 2008-10-04 at 16:04:11ID: 22642559

Ok, got it! Finally. I just needed to restart the trac daemon to pick up the python svn bindings. Makes sense. Thanks!

 

by: urgollPosted on 2008-10-06 at 06:36:00ID: 22649798

Good, I'm glad it works for you.

Regards,
Christophe

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...