[Paraview] [EXTERNAL] Re: paraview.simple and generic python

Scott, W Alan wascott at sandia.gov
Fri Feb 7 22:31:49 EST 2014


Utkarsh had the solution.  Here is his answer:


<snip>

I just saw your message on the mailing list. You'd need to set the LD_LIBRARY_PATH to include the location of lib/paraview-4.1.



This isn't a bug but what's expected. All ParaView libraries are put under lib/paraview-4.1. All Python module files (these are *.py and *Python.so files) are under site-packages.

<sniip>



So, the following allows you to run paraview.simple a generic pyton.  Note that the PYTHONPATH may be overdone below, but this works for me.





setenv LD_LIBRARY_PATH  your-install/lib/paraview-4.1:${LD_LIBRARY_PATH}

setenv PYTHONPATH your-install /lib/paraview-4.1/site-packages: your-install /lib/paraview-4.1: your-install /lib/paraview-4.1/site-packages/vtk





python



import sys

from paraview.simple import *





Thanks Patrick and Utkarsh!


Alan

From: ParaView [mailto:paraview-bounces at paraview.org] On Behalf Of Scott, W Alan
Sent: Friday, February 07, 2014 7:49 PM
To: Patrick O'Leary; paraview at paraview.org
Subject: Re: [Paraview] [EXTERNAL] Re: paraview.simple and generic python


OK, here is what I believe is going on.  If you add the build lib and build lib/site-packages directories to PYTHONPATH, 'from paraview.simple import *' works in python.  But, I could not get this to work from the install directory.

The linkage may be going over my head, but I believe the root cause of the issue is that there is now a directory called ...lib/paraview-4.1/site-packages/vtk, and within there, is a file named vtkCommonCorePython.so.  I suspect this file tries to open libvtkCommonCorePython27D-pv4.1.so.1, which is not located in this directory.  It is actually located in ..../lib/paraview-4.1.  But, if you are running out of a build area, all of the *CommonCorePython* files are all found together in build/lib

Is this a bug in the install, or am I missing something?

Alan

From: ParaView [mailto:paraview-bounces at paraview.org] On Behalf Of Scott, W Alan
Sent: Friday, February 07, 2014 6:48 PM
To: Patrick O'Leary
Cc: paraview at paraview.org<mailto:paraview at paraview.org>
Subject: Re: [Paraview] [EXTERNAL] Re: paraview.simple and generic python

Patrick,
I tried it before, and it failed.  I just tried it - and it worked!  I needed your hint - I was pointing to the install, rather than the build.

Thank you!

Alan

From: Patrick O'Leary [mailto:patrick.oleary at kitware.com]
Sent: Friday, February 07, 2014 6:34 PM
To: Scott, W Alan
Cc: paraview at paraview.org<mailto:paraview at paraview.org>
Subject: [EXTERNAL] Re: [Paraview] paraview.simple and generic python

Dear Alan,
Sebastien recently posted this:

import sys
pv_path = '/Users/seb/work/code/ParaView/build-ninja'
sys.path.append('%s/lib' % pv_path)
sys.path.append('%s/lib/site-packages' % pv_path)

from paraview.simple import *

Where pv_path is the path to the ParaView build. This seems to work well for me. Can you give it a try?
Best regards,
Patrick

On Fri, Feb 7, 2014 at 6:24 PM, Scott, W Alan <wascott at sandia.gov<mailto:wascott at sandia.gov>> wrote:
I have a user that wants to use ParaView from within generic python (not pvpython).  Unfortunately, I am somewhat struggling.  Does anyone have any ideas?

I am running the version of Python that was used to build ParaView (i.e., probably no version mismatch).

setenv LD_LIBRARY_PATH  .../Python-2.7.5/lib/
setenv PYTHONPATH  ....paraview-install/lib/paraview-4.1/site-packages

..../Python-2.7.5/bin/python

Python 2.7.5 (default, Jun 17 2013, 15:20:04)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> from paraview.simple import *
Error: Could not import vtkCommonComputationalGeometryPython
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "..../lib/paraview-4.1/site-packages/paraview/simple.py", line 41, in <module>
    import servermanager
  File "..../lib/paraview-4.1/site-packages/paraview/servermanager.py", line 48, in <module>
    import paraview, re, os, os.path, new, sys, atexit, vtk
  File "..../lib/paraview-4.1/site-packages/paraview/vtk/__init__.py", line 7, in <module>
    from vtkCommonCorePython import *
ImportError: No module named vtkCommonCorePython
>>>

So, my question is, where does vtkCommonCorePython come from?  There isn't a vtkCommonCorePython.py in the tree, but is a ..../lib/paraview-4.1/site-packages/vtk/vtkCommonCorePython.so.  How does this get linked in?

Thanks,

Alan Scott




_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20140208/b82c9559/attachment.html>


More information about the ParaView mailing list