Building and running ParaView w/ Python in a virtualenv
If you build ParaView w/ python enabled and later run pvpython
, both inside a virtualenv, you might expect that modules installed in that virtualenv would be available to pvpython
. But they are not.
Steps to reproduce
I reproduced this with a recent ParaView master:
commit 82e265201bd3dc7dcad1b322d9dff048414c2097
Merge: 004dbff d4dc7e3
Author: Ben Boeckel <ben.boeckel@kitware.com>
Date: Thu Dec 14 14:27:14 2017 +0000
Merge topic 'vtk-hierarchy-fix'
d4dc7e31 VTK: bump for a hierarchy file dependency fix
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2095
Then I created a test directory and set up a virtualenv, inside of which I installed the requests
module and verified that I could import it:
$ mkdir test
$ cd test
$ virtualenv pv-venv
$ source ./pv-venv/bin/activate
(pv-venv) $ pip install requests
(pv-venv) $ python
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.18.4'
>>>
Then I build ParaView with python enabled while that virtualenv is activated (turning off Qt gui to speed things up):
(pv-venv) $ mkdir pv-build
(pv-venv) $ cd pv-build
(pv-venv) $ cmake -DPARAVIEW_ENABLE_PYTHON:BOOL=ON -DPARAVIEW_BUILD_QT_GUI:BOOL=OFF <path-to-pv-src-tree>
(pv-venv) $ make -j<n>
When the build is finished, I just run pvpython
and try to import the requests module:
(pv-venv) $ ./bin/pvpython
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named requests
>>>