Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Python VTK Module Problem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
synneraws
n00b
n00b


Joined: 14 Feb 2013
Posts: 3

PostPosted: Thu Feb 14, 2013 4:50 am    Post subject: Python VTK Module Problem Reply with quote

Hey All,

I've been operating on my Gentoo machine very happily for a few months now, but I seem to've run into a brick wall. I need to use the VTK module for Python to process some .vtk files, but I seem totally unable to get the module working properly. Unfortunately, I'm not very versed in installing modules for python. A typical example of what I'd like to do (in fact, the example that I've copy-pasted onto my machine) is located here. What I've done is to emerge vtk -- which worked just fine, actually. When I equery uses vtk, I get the following:
Code:

user@machine ~ $ equery uses vtk
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for sci-libs/vtk-5.10.1:
 U I
 - - R                  : Enable support for dev-lang/R
 + + X                  : Adds support for X11
 - - boost              : Add support for boost
 - - cg                 : Use nvidia's cg shaders
 - - chemistry          : Add chemistry support
 - - doc                : Adds extra documentation (API, Javadoc, etc). It is
                          recommended to enable per package instead of globally
 - - examples           : Install examples, usually source code
 + + ffmpeg             : Enable ffmpeg-based audio/video codec support
 - - java               : Adds support for Java
 + + mpi                : Adds MPI (Message Passing Interface) layer to the
                          apps that support it
 - - mysql              : Adds mySQL Database support
 - - odbc               : Adds ODBC Support (Open DataBase Connectivity)
 - - patented           : Build patented classes
 - - postgres           : Adds support for the postgresql database
 + + python             : Adds optional support/bindings for the Python
                          language
 + + qt4                : Adds support for the Qt GUI/Application Toolkit
                          version 4.x
 + + theora             : Adds support for the Theora Video Compression Codec
 + + threads            : Adds threads support for various packages. Usually
                          pthreads
 + + tk                 : Adds support for Tk GUI toolkit
 - - video_cards_nvidia : VIDEO_CARDS setting to build driver for nvidia video
                          cards


If I'm not totally off-base, the ++ python seems to suggest that I have Python support for the VTK module. Every time I run my example (linked above) I get:
ImportError: no module named vtk

Since it was such a brick wall, I also tried to download the source of VTK from the official website, but every time I try to complete ccmake with python support turned on, I get a mysterious error that will not print to the screen and I cannot proceed without eliminating the error. Note that this solution is simply a desperate attempt to get VTK support in Python -- if I can get VTK support in Python using emerge (and not building from source myself), I'd be thrilled.

Does anyone have any more ideas? I'll be pleased to provide any more information as necessary. Thanks in advance![/url][/code]
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Thu Feb 14, 2013 5:21 am    Post subject: Reply with quote

synneraws wrote:
Since it was such a brick wall, I also tried to download the source of VTK from the official website, but every time I try to complete ccmake with python support turned on, I get a mysterious error that will not print to the screen and I cannot proceed without eliminating the error.

That's not recommended as it might overwrite shared objects.

Is dev-python/pyvtk installed :?:
_________________
Good luck :wink:

Since installing gentoo, my life has become one long emerge :)
Back to top
View user's profile Send private message
synneraws
n00b
n00b


Joined: 14 Feb 2013
Posts: 3

PostPosted: Thu Feb 14, 2013 6:06 am    Post subject: Reply with quote

Hey BillWho,

Quote:
That's not recommended as it might overwrite shared objects.

Okay; That's kind of what I figured. Good thing the ccmake never took.

I had previously emerged pyvtk, but I went ahead and re-emerged it. Still nothing. Importing both vtk and pyvtk yield "no module found." I'm still unclear as to if VTK support for Python is the same thing as pyvtk. From my limited understanding, pyvtk is a separate project from the main vtk python module. Am I wrong in this?

In either case, I get the following output about pyvtk:
Code:

user@machine ~ $ equery uses pyvtk
!!! No USE flags found for dev-python/pyvtk-0.4.74
user@machine ~ $ equery keywords pyvtk
Keywords for dev-python/pyvtk:
          |                           | u   |
          | a a             p     s   | n   |
          | l m   h i m m   p s   p   | u s | r
          | p d a p a 6 i p c 3   a x | s l | e
          | h 6 r p 6 8 p p 6 9 s r 8 | e o | p
          | a 4 m a 4 k s c 4 0 h c 6 | d t | o
----------+---------------------------+-----+-------
[I]0.4.74 | o ~ o o o o o o o o o o ~ | o 0 | gentoo


Since the color doesn't show through, here, I'll tell you that amd64, arm and x86 are yellowed (selected?). I did have to write some keywords in order to emerge pyvtk successfully. I let portage write the keywords for me. My machine is, in fact, an AMD64 machine.

Anything else?

EDIT:

I just dug a little deeper, and it seems I have two versions of python installed on my machine:
Code:

user@machine ~ $ eselect python list
Available Python interpreters:
   [1]    python2.7
   [2]    python3.2 *


It seems that I'm using the second installation by default. Perhaps pyvtk being installed on slot zero (as shown by the above) means that it's only installed on python2.7? How do I change that? Or am I totally off base?
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Thu Feb 14, 2013 2:05 pm    Post subject: Reply with quote

synneraws wrote:
It seems that I'm using the second installation by default. Perhaps pyvtk being installed on slot zero (as shown by the above) means that it's only installed on python2.7? How do I change that? Or am I totally off base?


You can switch to python2.7 with eselect python set 2

Be aware though that switching might cause errors with emerge. There are syntactical differences between the versions e.g

Code:
bill@gentoo-gateway ~ $ python
Python 2.7.3 (default, Jan 17 2013, 23:58:08)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "Hello"
Hello

bill@gentoo-gateway ~ $ python
Python 3.2.3 (default, Dec 14 2012, 15:23:19)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "Hello"
  File "<stdin>", line 1
    print "Hello"
                ^
SyntaxError: invalid syntax
>>> print ("Hello")
Hello

If that works for you, just switch back to python3.2 before doing any type of emerge.
_________________
Good luck :wink:

Since installing gentoo, my life has become one long emerge :)
Back to top
View user's profile Send private message
synneraws
n00b
n00b


Joined: 14 Feb 2013
Posts: 3

PostPosted: Thu Feb 14, 2013 4:14 pm    Post subject: Reply with quote

Beautiful! That did seem to work! Thanks, much, BillWho!

While I don't want to nit-pick my solution, I was kind of asking another question. What I meant to ask is this:
Is there a way to force the vtk modules (or pyvtk -- it seems both are importable in python 2.7) to be installed on python 3.2? Perhaps vtk simply does not support python 3.2? Perhaps there's a simple argument I can pass emerge (when emerging vtk) that will force the vtk module to be installed in python 3.2 instead of 2.7?

If it's downright impossible, then I can accept that. Either way, I have a working vtk with python now. This last bit is just for curiosity's sake.

Thanks again!
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Thu Feb 14, 2013 4:59 pm    Post subject: Reply with quote

BillWho wrote:
You can switch to python2.7 with eselect python set 2

oops :oops: that should have been eselect python set 1, but I guess you already figured that out :D

synneraws wrote:
Is there a way to force the vtk modules (or pyvtk -- it seems both are importable in python 2.7) to be installed on python 3.2? Perhaps vtk simply does not support python 3.2? Perhaps there's a simple argument I can pass emerge (when emerging vtk) that will force the vtk module to be installed in python 3.2 instead of 2.7?

If it's downright impossible, then I can accept that. Either way, I have a working vtk with python now. This last bit is just for curiosity's sake.

I really don't know if you can get the vtk modules working with python 3.2 since don't I have an in-depth knowledge of python and furthermore, there are no use flags to manipulate for dev-python/pyvtk.

But there is hope that someone else here might be able to provide you with an answer :wink:
_________________
Good luck :wink:

Since installing gentoo, my life has become one long emerge :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum