Simple Module Import Error (Paraview 5.8)

I was following these directions and tried to import but was unsuccessful.

I set my system variable PYTHONPATH to
C:\Program Files\ParaView 5.8.0-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\paraview
which is where my file is located.

Using pvpython 5.8, I get this error:
from .selection import *
ImportError: attempted relative import with no known parent package

I also tried setting PYTHONPATH to
C:\Program Files\ParaView 5.8.0-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages
but then I get this error:
ModuleNotFoundError: No module named ‘simple’

When using pvpython, you don’t need to set PYTHONPATH at all.

Can you try the following and see if that works:

# run pvpython
# then type the following in the shell (Without the leading `>>>`)
>>> from paraview.simple import *
>>> Sphere()
>>> Show()
>>> Render()

Oh okay, thank you that worked! Except after the visual popup window appeared, pvpython froze and was unresponsive… but that is a different issue.

It might just appear frozen as the view/3D window is not interactive. Your pvpython terminal should still be accepting input. If you type Interact(), it will pass the control to the 3D window and then you can interact with it. To quit and return to the terminal, hit the ‘q’ key in the view window.

1 Like