Hi,
I’m building ParaView (I get the same issue with VTK) and when I run pvpython
I can’t import numpy. I can import numpy using my system Python, which my ParaView is built against. It looks like it’s my Python sys.path which is confused, possibly due to a non-standard install location of MPI. When I run pvpython this is what I get:
[acbauer@dsrclxerd5621m debug]$ bin/pvpython
Python 3.6.8 (default, Jan 11 2023, 08:43:50)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/home/acbauer/Code/ParaView/debug/lib64/python3.6/site-packages', '/usr/local/mpich/usr/lib64/python36.zip', '/usr/local/mpich/usr/lib64/python3.6', '/usr/local/mpich/usr/lib64/python3.6/lib-dynload', '/usr/local/mpich/usr/lib64/python3.6/site-packages', '/usr/local/mpich/usr/lib/python3.6/site-packages']
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
When I just run Python, i.e. Python 3.6.8, I get the following:
[acbauer@dsrclxerd5621m debug]$ python3 --version
Python 3.6.8
[acbauer@dsrclxerd5621m debug]$ python3
Python 3.6.8 (default, Jan 11 2023, 08:43:50)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/usr/lib64/python3.6/site-packages', '/usr/lib/python3.6/site-packages']
>>> import numpy
If I add [‘’, ‘/usr/lib64/python36.zip’, ‘/usr/lib64/python3.6’, ‘/usr/lib64/python3.6/lib-dynload’, ‘/usr/lib64/python3.6/site-packages’, ‘/usr/lib/python3.6/site-packages’] to my sys.path for pvpython everything works fine (see below). Any hints on how to change my ParaView (and VTK) build to include the proper sys.path for numpy?
[acbauer@dsrclxerd5621m debug]$ bin/pvpython
Python 3.6.8 (default, Jan 11 2023, 08:43:50)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path = sys.path + ['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/usr/lib64/python3.6/site-packages', '/usr/lib/python3.6/site-packages']
>>> import numpy
>>>
Thanks,
Andy