Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I installed the Python bindings of VTK 5.1 correctly. In Python, import vtk worked, but import itk did not work yet. So I wanted to install the Python bindings of ITK 4.2.

I needed to install SWIG 2.0.7, and from the error message which arose during ./configure in the SWIG source directory, I understood I needed to install pcre. So I chose the version 8.31 of pcre. Here is a summary of the process:

(VTK + Python) ---> This works.

(ITK + Python) ---> SWIG needed ---> pcre needed

Now that pcre is installed, my problem is yum has stopped working:

[root@wok build]# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   libvtkIOPythonD.so.5.10: cannot open shared object file: No such file or directory

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7 (r27:82500, Sep 16 2010, 18:02:00) 
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

I wonder if I should add variables to the PATH.

Maybe it is related to a problem I had with SWIG: it worked as a user but not as root.

wok ~ $ swig -swiglib
/usr/local/share/swig/2.0.7

[root@wok home]# swig -swiglib
swig: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

I had to add one line to .bashrc of the root user to make swig work with both the user and the root:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/

There could be something with the Python path.

In Python, I noticed I could import vtk as a user, but not as root.

wok ~ $ python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00) 
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> 

but:

[root@wok ~]# python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00) 
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/user/wok/home/Softwares/VTK_5.1/build/Wrapping/Python/vtk/__init__.py", line 41, in <module>
    from vtkCommonPython import *
ImportError: libvtkCommonPythonD.so.5.10: cannot open shared object file: No such file or directory

PCRE seems to me to be installed correctly:

[root@wok build]# pcretest -C
PCRE version 8.31 2012-07-06
Compiled with
  8-bit support only
  No UTF-8 support
  No Unicode properties support
  No just-in-time compiler support
  Newline sequence is LF
  \R matches all Unicode newlines
  Internal link size = 2
  POSIX malloc threshold = 10
  Default match limit = 10000000
  Default recursion depth limit = 10000000
  Match recursion uses stack

and

[root@wok build]# locate libpcre
/lib64/libpcre.so.0
/lib64/libpcre.so.0.0.1
/usr/lib64/libpcrecpp.so.0
/usr/lib64/libpcrecpp.so.0.0.0
/usr/lib64/libpcreposix.so.0
/usr/lib64/libpcreposix.so.0.0.0
share|improve this question
    
Related: stackoverflow.com/questions/10821144 –  Wok Jul 23 '12 at 14:34
    
I solved the problem with swig, not yum though. –  Wok Jul 23 '12 at 15:30
add comment

1 Answer 1

up vote 0 down vote accepted

The problem was related to the PYTHONPATH. It could be solved by removing one line from .bashrc out of four I had copied from a tutorial:

export PYTHONPATH=$PYTHONPATH:~/Softwares/VTK_5.1/build/Wrapping/Python/vtk/

I kept the three following lines:

export PYTHONPATH=$PYTHONPATH:~/Softwares/VTK_5.1/build/Wrapping/Python/
export PYTHONPATH=$PYTHONPATH:~/Softwares/VTK_5.1/build/bin/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/Softwares/VTK_5.1/build/bin/

Now, I can import vtk as a user, and still use yum as root. I cannot import vtk as root, but I never wanted to anyway.

In order to solve the problem, I first removed the .bashrc file and noticed it fixed yum. Then I proceeded to add the lines above to the PYTHONPATH to gain access to import vtk. Finally, I noticed ipython would not work when import vtk would work, and reciprocally.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.