QuickFix: ViewVC ImportError: No module named svn error

by jagbir on April 24, 2009

Recently 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 occurring:

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 and may also need to install python-devel and python-subversion.

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

You may also need to install python-devel and python-subversion as mentioned by comments below but I didn’t required it. 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.

  • Richard

    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.

  • Tricia

    I also had this error…I installed python-devel and python-subversion to fix it.

  • http://linuxadminzone.com jagbir

    Thanks Richard and Tricia for your comments. I’ve updated article to install python-devel/subversion as well and few users requiring them.

  • Pingback: » Install Trac on CentOS LAZYONE

Previous post:

Next post: