[vtkusers] from vtk import * ImportError: (Python VTK 6.2 on ubuntu 14.04)

Shawn Waldon shawn.waldon at kitware.com
Mon Aug 3 14:06:18 EDT 2015


Hi Manjunath,

Please keep discussions on the list so that others can benefit later.

I haven't used an install tree on Linux for a while but according to my
notes you should need the following assuming it is installed to /usr/local:

export
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/python2.7/site-packages/vtk:$LD_LIBRARY_PATH

export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH

HTH,
Shawn

On Mon, Aug 3, 2015 at 1:59 PM, Manjunath K E <ke.manjunath at gmail.com>
wrote:

> Hi Shawn
>
> Thanks for the reply.
> My python script is set up to use the system's python not vtkpython.
>
> I have set export
> PYTHONPATH="/usr/local/lib/python2.7/site-packages/vtk/:$PYTHONPATH".
> export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
>
> I have installed vtk-6.2 to /usr/local.
>
> Is the should i change the values of PYTHONPATH and LD_LIBRARY_PATH to
> something else.
>
>  Thanks and Regards,
>
>  Manjunath K E
>  Help Ever Hurt Never
>
>
> On Mon, Aug 3, 2015 at 11:17 PM, Shawn Waldon <shawn.waldon at kitware.com>
> wrote:
>
>> Hi Manjunath,
>>
>> Is your python script set up to use vtkpython as the interpreter?  Or is
>> it using the system's python?  If you are trying to import vtk from system
>> python you have to set your LD_LIBRARY_PATH and PYTHONPATH environment
>> variables.  If you want to change the script to use vtkpython then change
>> the first like to #!/path/to/vtkpython
>>
>> HTH,
>> Shawn
>>
>> On Mon, Aug 3, 2015 at 1:43 PM, Manjunath K E <ke.manjunath at gmail.com>
>> wrote:
>>
>>> Hi all
>>>
>>> I have installed VTK 6.2 along with vtk 6.2 python  interface on ubuntu
>>> 14.04 manually.
>>>
>>> When I run vtkpython in interpreter mode, the import of vtk is
>>> successful.
>>> It doesn't have any problem  and the same is shown below.
>>>
>>> ===========================================================
>>> manju at iiitb-gvcl-Z800:~/manju/academics/iiitb/project/codes/incois__laptp/src_vtk6$
>>> vtkpython
>>> vtk version 6.2.0
>>> Python 2.7.2 (default, Feb 12 2015, 18:30:44)
>>> [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> >>> from vtk import *
>>> >>> print vtk
>>> <module 'vtk' from
>>> '/usr/local/lib/python2.7/site-packages/vtk/__init__.pyc'>
>>> >>>
>>> ===========================================================
>>>
>>> But, If i run a python script then an error is obtained for this line
>>> "from vtk import *". The error is as shown below.
>>> ===========================================================
>>> manju at iiitb-gvcl-Z800:~/manju/academics/iiitb/project/codes/incois__laptp/src_vtk6$
>>> ./demo1.py
>>> Traceback (most recent call last):
>>>   File "./demo1.py", line 6, in <module>
>>>     from vtk import *
>>> ImportError: No module named vtk
>>> ===========================================================
>>>
>>> Please help me in solving this issue. I appreciate your time and help.
>>>
>>>  Thanks and Regards,
>>>
>>>  Manjunath K E
>>>  Help Ever Hurt Never
>>>
>>>
>>> _______________________________________________
>>> Powered by 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 VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtkusers
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150803/c8d2a36b/attachment.html>


More information about the vtkusers mailing list