# Error when building Paraview 5.9.1 with Python enabled

**URL:** https://discourse.paraview.org/t/error-when-building-paraview-5-9-1-with-python-enabled/12589
**Category:** ParaView Support
**Tags:** python
**Created:** [July 27, 2023, 2:48pm UTC](https://discourse.paraview.org/t/error-when-building-paraview-5-9-1-with-python-enabled/12589 "2023-07-27T14:48:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![dsan](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/85e7bf/32.png) [@dsan](https://discourse.paraview.org/u/dsan)
#### Post date: [July 27, 2023, 2:48pm UTC](https://discourse.paraview.org/t/error-when-building-paraview-5-9-1-with-python-enabled/12589/1 "2023-07-27T14:48:45Z")

</div>

Hi ParaView support,  
I am trying to install Paraview 5.9.1 on Ubuntu 18.04. I am using the ccmake process outlined in this archived site: [https://www.paraview.org/Wiki/ParaView:Build\_And\_Install](https://www.paraview.org/Wiki/ParaView:Build_And_Install)

After running “make” and the compilation process 96% completing, I am getting the following error:

> /usr/bin/ld: /usr/local/lib/libpython3.8.a(tokenizer.o): relocation R\_X86\_64\_PC32 against symbol `PyExc\_SyntaxError’ can not be used when making a shared object; recompile with -fPIC

> /usr/bin/ld: final link failed: Bad value  
> collect2: error: ld returned 1 exit status

How do I recompile Paraview with “-fPIC”? I have searched the forums and cannot find my problem on here.

I have set the following python parameters:

> PARAVIEW\_USE\_PYTHON = ON  
> Python3\_EXECUTABLE /usr/local/bin/python3.8  
> Python3\_INCLUDE\_DIR /usr/local/include/python3.8  
> Python3\_LIBRARY /usr/local/lib/libpython3.8.a

Thanks in advance, dsan.

---

<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: [July 27, 2023, 2:50pm UTC](https://discourse.paraview.org/t/error-when-building-paraview-5-9-1-with-python-enabled/12589/2 "2023-07-27T14:50:02Z")

</div>

> [@dsan](#):
>
> in this archived site

Which is deprecated, new guide is here:

[https://gitlab.kitware.com/paraview/paraview/-/blob/master/Documentation/dev/build.md](https://gitlab.kitware.com/paraview/paraview/-/blob/master/Documentation/dev/build.md)

---

<div class="post-metadata">

### Author: ![dsan](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/85e7bf/32.png) [@dsan](https://discourse.paraview.org/u/dsan)
#### Post date: [July 27, 2023, 4:33pm UTC](https://discourse.paraview.org/t/error-when-building-paraview-5-9-1-with-python-enabled/12589/3 "2023-07-27T16:33:10Z")

</div>

I tried using the new installation instructions before and I didn’t understand how to configure directories to point the installer to new versions of Qt5 and Python. I have successfully used ccmake for installing v5.11.1 without Python, but am running into issues with v5.9.1 with Python.

If I use ninja, and this installation command:

```auto
cmake -GNinja -DPARAVIEW_USE_PYTHON=ON -DPARAVIEW_USE_MPI=ON -DVTK_SMP_IMPLEMENTATION_TYPE=TBB -DCMAKE_BUILD_TYPE=Release ../paraview

```

I get the following error:

```auto
CMake Warning at VTK/CMake/vtkModule.cmake:4222 (find_package):
  Could not find a configuration file for package "Qt5" that is compatible
  with requested version "5.12".

The following configuration files were considered but not accepted:

    /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake, version: 5.9.5

Call Stack (most recent call first):
  Qt/Core/CMakeLists.txt:165 (vtk_module_find_package)

CMake Error at VTK/CMake/vtkModule.cmake:4228 (message):
  Could not find the Qt5 external dependency.
Call Stack (most recent call first):
  Qt/Core/CMakeLists.txt:165 (vtk_module_find_package)

```

I downloaded Qt5.12.0 and installed a separate directory in /home/user/Qt5.12.0/5.12.0/. I need to retain the existing Qt because it is being used in OpenFOAM. The Qt5.12.0 file mentioned above is found in:

```auto
/home/usr/Qt5.12.0/5.12.0/gcc_64/lib/cmake/Qt5/Qt5Config.cmake

```

What flag do I need to tell cmake where the revised Qt5.12.0 path is?

---

<div class="post-metadata">

### Author: ![dsan](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/85e7bf/32.png) [@dsan](https://discourse.paraview.org/u/dsan)
#### Post date: [July 27, 2023, 7:02pm UTC](https://discourse.paraview.org/t/error-when-building-paraview-5-9-1-with-python-enabled/12589/4 "2023-07-27T19:02:21Z")

</div>

I succeeded. For posterity:  
To direct ninja to a separate Qt installation, edit the CMakeCache.txt file. I had to change the directory to my new installation of Qt5.12.0 with the following Qt variables:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/8/8c42b40f565cd6ece94fc3ba4c16fa1bb729d92c.png)

I retried installing with ninja and came back to the same error in the first post. “recompile with -fPIC” refers to an error with the python installation which somehow was initially installed without shared libraries.

I followed these directions to install a fresh copy of python3.8 [https://tttapa.github.io/Pages/Ubuntu/Software-Installation/Python.html](https://tttapa.github.io/Pages/Ubuntu/Software-Installation/Python.html), and left it in my /home/usr/.local/ folder so that I did not disturb the system python version. The key is to install with the following minimum settings.

```auto
./configure --enable--shared

```

With new python installed, I edited the CMakeCache.txt file to direct the Python references to the new installation in /home/usr/.local/ files:  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/5/5c345b2ca68db36908659b6420fd089009e40fe0.png)

---

<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: [July 28, 2023, 7:07am UTC](https://discourse.paraview.org/t/error-when-building-paraview-5-9-1-with-python-enabled/12589/5 "2023-07-28T07:07:55Z")

</div>

> [@dsan](#):
>
> To direct ninja to a separate Qt installation, edit the CMakeCache.txt file.

Or use CMake as usual, `-DQt5_DIR`.
