# How can I install and import other modules inside pvpython?

**URL:** https://discourse.paraview.org/t/how-can-i-install-and-import-other-modules-inside-pvpython/3067
**Category:** Development
**Created:** [November 28, 2019, 2:00pm UTC](https://discourse.paraview.org/t/how-can-i-install-and-import-other-modules-inside-pvpython/3067 "2019-11-28T14:00:45Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Waqas\_Ahmad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/waqas_ahmad/32/2475_2.png) [@Waqas\_Ahmad](https://discourse.paraview.org/u/Waqas_Ahmad)
#### Post date: [November 28, 2019, 2:00pm UTC](https://discourse.paraview.org/t/how-can-i-install-and-import-other-modules-inside-pvpython/3067/1 "2019-11-28T14:00:45Z")

</div>

I need to import module ‘zmq’. I have tried to run pip but no luck and then get-pip.py with pvpython but it also produce some error. Any help will be really appreciated.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [November 28, 2019, 2:26pm UTC](https://discourse.paraview.org/t/how-can-i-install-and-import-other-modules-inside-pvpython/3067/2 "2019-11-28T14:26:04Z")

</div>

You will need to build ParaView yourself with a python containing the zmq module.

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [November 28, 2019, 3:26pm UTC](https://discourse.paraview.org/t/how-can-i-install-and-import-other-modules-inside-pvpython/3067/3 "2019-11-28T15:26:12Z")

</div>

You can use a virtual env along inside pvpython. You can do what we do with our paraview web application [here](https://github.com/Kitware/visualizer/blob/master/server/pvw-visualizer.py#L83-L89).

---

<div class="post-metadata">

### Author: ![Waqas\_Ahmad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/waqas_ahmad/32/2475_2.png) [@Waqas\_Ahmad](https://discourse.paraview.org/u/Waqas_Ahmad)
#### Post date: [December 6, 2019, 10:02am UTC](https://discourse.paraview.org/t/how-can-i-install-and-import-other-modules-inside-pvpython/3067/4 "2019-12-06T10:02:42Z")

</div>

Thank you for the help. The thing I ended up was clonning the docker image of paraview from the docker hub and in that the enviroment is correctly setuped already and system python and the pvpython behave exactly the same.

---

<div class="post-metadata">

### Author: ![sharaborin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@sharaborin](https://discourse.paraview.org/u/sharaborin)
#### Post date: [January 9, 2021, 2:07pm UTC](https://discourse.paraview.org/t/how-can-i-install-and-import-other-modules-inside-pvpython/3067/5 "2021-01-09T14:07:25Z")

</div>

Here is a concrete recipe:

first I have installed python with the same version to $HOME directory (not in /usr):

> ```
> pyver=3.7.4                                                                                         
> wget https://www.python.org/ftp/python/${pyver}/Python-${pyver}.tgz                                 
> tar xzvf Python-${pyver}.tgz                                                                        
> cd Python-${pyver}                                                                                  
> ./configure --prefix=$HOME/.local                                                                   
> make                                                                                                
> make install
> 
> ```

Then I have renamed the native paraview python and replaced with my version of python (for example my paraview is inside /opt ).

> cd /opt/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/lib  
> mv python3.7 python3.7\_  
> ln -s ~/.local/lib/python3.7 .  
> P.S. in case of a problem with \_bz2 download the appropriate version of .so file as mentioned [here](https://stackoverflow.com/a/63767852/7200745) and put it in

> cp ~/Downloads/\_bz2.cpython-37m-x86\_64-linux-gnu.so ~/.local/lib/python3.7/lib-dynload/

then your pvpython will use modules of python3.7.  
installation of packages is done via

> pip3.7 install pandas plotly sklearn --user

the flag `--user` is important, otherwise new modules will be kept in another place.  
Good luck!

---

<div class="post-metadata">

### Author: ![sharaborin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@sharaborin](https://discourse.paraview.org/u/sharaborin)
#### Post date: [January 10, 2021, 11:13pm UTC](https://discourse.paraview.org/t/how-can-i-install-and-import-other-modules-inside-pvpython/3067/6 "2021-01-10T23:13:37Z")

</div>

It can be done easier:  
after installation of appropriate python

> pyver=3.7.4  
> wget [https://www.python.org/ftp/python/${pyver}/Python-${pyver}.tgz](https://www.python.org/ftp/python/$%7Bpyver%7D/Python-$%7Bpyver%7D.tgz)  
> tar xzvf Python-{pyver}.tgz cd Python-{pyver}  
> ./configure --prefix=$HOME/.local  
> make  
> make install

it needs to define PYTHONPATH as follows:  
export PYTHONPATH=$HOME/.local/site-packages

install necessary packages, that is all  
BR,  
Evgeii
