QuickFix: ViewVC ImportError: No module named svn error

Recenlty I was in need to update a old subversion server to latest one in a CentOS 5.2 box. I removed the older rpms and compiled subversion from latest source. Everything seems fine except ViewVC which is used to browse svn repositories.

Following error was occuring:

An Exception Has Occurred
Python Traceback

Traceback (most recent call last):
File “/usr/local/viewvc-1.1/lib/viewvc.py”, line 4065, in main
request.run_viewvc()
File “/usr/local/viewvc-1.1/lib/viewvc.py”, line 403, in run_viewvc
self.view_func(self)
File “/usr/local/viewvc-1.1/lib/viewvc.py”, line 1662, in view_roots
allroots = list_roots(request)
File “/usr/local/viewvc-1.1/lib/viewvc.py”, line 3922, in list_roots
cfg.utilities, cfg.options.svn_config_dir)
File “/usr/local/viewvc-1.1/lib/vclib/svn/__init__.py”, line 53, in SubversionRepository
import svn_repos
File “/usr/local/viewvc-1.1/lib/vclib/svn/svn_repos.py”, line 25, in ?
from svn import fs, repos, core, client, delta
ImportError: No module named svn

Solution: You need to install python bindings for svn.

Step 1: Check whether SWIG library is installed in your system or not (most distribution already have):

# rpm -qa | grep -i swig
swig-1.3.29-2.el5

Its there in my system, if you doesn’t get any output then install the library by using yum install swig or manually by from here.

Step 2: Install python bindings for SWIG. I assume you have subversion source avaialble with you. Untar the source and you will be able to find the bindings in /usr/src/subversion-1.6.1/subversion/bindings/swig/python directory.

# cd /usr/src/subversion-1.6.1/
# make swig-py
# make check-swig-py ### Perform checks
# make install-swig-py

If you face any issue while this installation, pls check INSTALL file in /usr/src/subversion-1.6.1/subversion/bindings/swig directory to get further instructions, otherwise the library should be installed successfully and programs like ViewVC or other ones which requires swig python bindings should run fine.

Bookmark and Share

One Response to “QuickFix: ViewVC ImportError: No module named svn error”

  1. On fedora I also needed is the python-devel package. Python itself is not enough.

    Got all sorts of errors when I tried make swig-py before installing python-devel.

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes