When you run Python inside a virtual environment, you run the interpreter that is installed inside the virtual environment. I should say that your solution is more or less correct, but it needs a major rearrangement. You may think to yourself that the solution is quite obvious and simple: create a Python virtual environment (for example, using conda or venv) and execute PvPtyhon inside it. Now, the problem we want to discuss is the opposite of this one: we cannot use installed packages (like pandas or matplotlib) in PvPython, a scenario that can be very helpful in different applications. ![]() This doesn’t give you an error, but if you execute the statement in your local installation of Python, you will face the famous ModuleNotFoundError. To give it a try, open a terminal and type pvpython and then from paraview.simple import *. ParaView comes with its own Python intrepreter, in which you can easily access ParaView Python package. But, since this solution is not elaborated and may be difficult to follow, I implement it in this post the way I did it for myself. After trying various techniques in Windows and Linux, my conclusion is that the best solution to this problem is the one suggested here. I came across a couple of scenarios in which I needed to call a couple of packages inside PvPython, the Python client of ParaView, which allows us to automate ParaView tasks (you may take a look at this automation example to see how PvPython works). ![]() ![]() Use and import Python packages and modules inside ParaView (PvPython)
0 Comments
Leave a Reply. |