# Building Paraview Superbuild with custom python version

**URL:** https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368
**Category:** ParaView Support
**Tags:** python
**Created:** [November 10, 2021, 10:58pm UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368 "2021-11-10T22:58:02Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![anthomas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/anthomas/32/7342_2.png) [@anthomas](https://discourse.paraview.org/u/anthomas)
#### Post date: [November 10, 2021, 10:58pm UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/1 "2021-11-10T22:58:02Z")

</div>

I am trying to build the paraview superbuild (v5.9.1) with a version of python that has extra modules. The project successfully builds, but when I run paraview I receive a message stating: “Python support not available!” I have tried including my python installation in the superbuild/python3/src directory but nothing changes.

---

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [November 11, 2021, 12:50am UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/2 "2021-11-11T00:50:12Z")

</div>

Sounds to me like the environment variable PYTHONPATH needs to be set…

---

<div class="post-metadata">

### Author: ![anthomas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/anthomas/32/7342_2.png) [@anthomas](https://discourse.paraview.org/u/anthomas)
#### Post date: [November 11, 2021, 4:22am UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/3 "2021-11-11T04:22:18Z")

</div>

From my understanding, the PYTHONPATH variable needs to be set with the output of the sys.path command in the python environment. I created a batch file in the build directory of the superbuild as follows with no success:

```auto
set ROOT_PATH=%cd%

set LD_LIBRARY_PATH=%ROOT_PATH%\superbuild\paraview\build\lib;%LD_LIBRARY_PATH%

set PYTHON_DIR=%ROOT_PATH%\superbuild\python3\src

set PYTHONPATH=%PYTHON_DIR%\python39.zip;%PYTHON_DIR%\DLLs;%PYTHON_DIR%\lib;%PYTHON_DIR%;%PYTHON_DIR%\lib\site-packages;%PYTHONPATH%

start %ROOT_PATH%\superbuild\paraview\build\bin\paraview.exe

```

---

<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 12, 2021, 9:10am UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/4 "2021-11-12T09:10:33Z")

</div>

> [@anthomas](#):
>
> “Python support not available!”

This means paraview was not built with python. Which superbuild option are you turning on/off ?

---

<div class="post-metadata">

### Author: ![anthomas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/anthomas/32/7342_2.png) [@anthomas](https://discourse.paraview.org/u/anthomas)
#### Post date: [November 12, 2021, 7:18pm UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/5 "2021-11-12T19:18:29Z")

</div>

Python3 enabled  
USE\_SYSTEM\_python3 enabled  
Python3\_EXECUTABLE set to my python.exe  
Python3\_INCLUDE\_DIR set to my python include directory  
Python3\_LIBRARIES set to my python libs/python39.lib file

I think the issue might be that I didnt set ‘Python enabled,’ however when I did there was issues finding Python2. What do I need to do to fix that? Are there separate variables specifically for python and python2?

---

<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 12, 2021, 8:01pm UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/6 "2021-11-12T20:01:01Z")

</div>

That should be enough, you may want to open an issue on : [https://gitlab.kitware.com/paraview/paraview-superbuild/-/issues](https://gitlab.kitware.com/paraview/paraview-superbuild/-/issues)

---

<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 12, 2021, 8:25pm UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/7 "2021-11-12T20:25:39Z")

</div>

@ben.boeckel

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [November 13, 2021, 11:20pm UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/8 "2021-11-13T23:20:16Z")

</div>

You can just ignore the python2 messages. The superbuild supported 2 and 3 and had a mechanism to support both (but not at once). ParaView dropped Python2 support and removed it and the mechanism just complains that Python2 is not even available. You’ll need to `ENABLE_python=ON` in 5.9.1 (5.10 shouldn’t have anything Python2-related).

---

<div class="post-metadata">

### Author: ![anthomas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/anthomas/32/7342_2.png) [@anthomas](https://discourse.paraview.org/u/anthomas)
#### Post date: [December 27, 2021, 5:06pm UTC](https://discourse.paraview.org/t/building-paraview-superbuild-with-custom-python-version/8368/9 "2021-12-27T17:06:30Z")

</div>

I have been working with the superbuild using a custom python version on windows-

When building I set these cmake variables:

- ENABLE\_python=True
- ENABLE\_python3=True
- Python3\_EXECUTABLE=…/python.exe
- Python3\_INCLUDE\_DIR=…/include
- Python3\_LIBRARY=…/python39.dll

Executing scripts with the interpreter that is copied to the superbuild directory works great, and the custom modules that I wanted to install are available in pvpython. However, when I execute any script using the vtkPythonInterpreter or the paraview python shell, paraview immediately closes after finishing execution. I have found that the sys.path for pvpython and the python interpreter from my installation differ significantly:

interpreter -

 ![interpreterPath](https://discourse.paraview.org/uploads/default/original/2X/b/b16f26bd21cfb650818df753320d8878ecde2663.jpeg)

pvpython -

 ![pvpythonPath](https://discourse.paraview.org/uploads/default/original/2X/6/640d162cbf0f1cdd658fffe2216fc289192bbc10.jpeg)

I have also tried setting my Path and PYTHONPATH environmental variables before executing paraview with no success.
