# ParaView 5.8.1 Python CMake Flags

**URL:** https://discourse.paraview.org/t/paraview-5-8-1-python-cmake-flags/5620
**Category:** ParaView Support
**Tags:** python
**Created:** [October 22, 2020, 1:54am UTC](https://discourse.paraview.org/t/paraview-5-8-1-python-cmake-flags/5620 "2020-10-22T01:54:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![TimJim](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timjim/32/1270_2.png) [@TimJim](https://discourse.paraview.org/u/TimJim)
#### Post date: [October 22, 2020, 1:54am UTC](https://discourse.paraview.org/t/paraview-5-8-1-python-cmake-flags/5620/1 "2020-10-22T01:54:32Z")

</div>

Hi, the flags used to specify the Python interpreter to CMake don’t seem to be working for me at the moment - or maybe I’m missing something. I want to compile a PV install to use a specific Python interpreter and environment but the system Python keeps getting picked up instead.

Compiling v5.8.1 on CentOS 8, I used:

```auto
cmake -GNinja 
-DPARAVIEW_USE_PYTHON=ON 
-DPYTHON_EXECUTABLE=/home/tjim/anaconda3/envs/testenv/bin/python3.7 
-DPYTHON_LIBRARY=/home/tjim/anaconda3/envs/testenv/lib/libpython3.7m.so  
-DPYTHON_INCLUDE_DIR=/home/tjim/anaconda3/envs/testenv/include/python3.7m 
-DCMAKE_BUILD_TYPE=Release 
-DCMAKE_INSTALL_PREFIX=/opt/paraview/ParaView-5.8.1_testenv 
-DPARAVIEW_ENABLE_FFMPEG=ON -DPARAVIEW_USE_MPI=ON 
-DVTK_SMP_IMPLEMENTATION_TYPE=TBB 
-DVTK_MPI_NUMPROCS=10 
../paraview

```

but CMake defaults to the system python 3.6 and reports:

```auto
CMake Warning:
  Manually-specified variables were not used by the project:

    PYTHON_EXECUTABLE
    PYTHON_INCLUDE_DIR
    PYTHON_LIBRARY

```

I saw [this](https://discourse.paraview.org/t/paraview-python-version/1607), but if the flags don’t exist anymore, what did they become?  
I also tried using a .cmake file instead and using `find_program`:

```auto
set(CMAKE_INSTALL_PREFIX "/opt/paraview/ParaView-5.8.1_testenv" CACHE PATH "")
SET(PARAVIEW_ENABLE_FFMPEG ON CACHE BOOL "")
SET(PARAVIEW_USE_PYTHON ON CACHE BOOL "")
SET(PARAVIEW_PYTHON_VERSION "3" CACHE STRING "")
SET(PARAVIEW_USE_MPI ON CACHE BOOL "")
SET(VTK_PYTHON_VERSION 3 CACHE STRING "")
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
SET(VTK_SMP_IMPLEMENTATION_TYPE "TBB" CACHE STRING "")
SET(VTK_MPI_NUMPROCS "10" CACHE STRING "")

find_program(PYTHON_EXECUTABLE "/home/tjim/anaconda3/envs/testenv/bin/python3.7")

```

but again, on running `cmake -C../testenv.cmake -GNinja ../paraview`, I get a message during the build:  
`-- Found Python3: /usr/lib64/libpython3.6m.so (found suitable version "3.6", minimum required is "3.2") found components: Development`  
Is this a bug? Thanks.

---

<div class="post-metadata">

### Author: ![TimJim](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timjim/32/1270_2.png) [@TimJim](https://discourse.paraview.org/u/TimJim)
#### Post date: [October 29, 2020, 8:30am UTC](https://discourse.paraview.org/t/paraview-5-8-1-python-cmake-flags/5620/2 "2020-10-29T08:30:31Z")

</div>

I’ve found that the correct flags for Python from the [cmake website](https://cmake.org/cmake/help/git-stage/module/FindPython3.html) are:

```auto
SET(Python3_EXECUTABLE "/home/tjim/anaconda3/envs/test/bin/python3.7" CACHE STRING "")
SET(Python3_LIBRARY "/home/tjim/anaconda3/envs/test/lib/libpython3.7m.so" CACHE STRING "")
SET(Python3_INCLUDE_DIR "/home/tjim/anaconda3/envs/test/include/python3.7m" CACHE STRING "")

```

However, it now picks up the Anaconda environment’s QT, even though the CMakeCache.txt appears to reference the QT under `/usr/lib64/cmake/Qt5` - this is apparent when trying to run `./bin/paraview`:

```auto
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by ./bin/paraview)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /opt/paraview/ParaView-5.8.1_testenv/bin/../lib64/libpqApplicationComponents-pv5.8.so.1)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /opt/paraview/ParaView-5.8.1_testenv/bin/../lib64/libpqComponents-pv5.8.so.1)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /opt/paraview/ParaView-5.8.1_testenv/bin/../lib64/libpqPython-pv5.8.so.1)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /opt/paraview/ParaView-5.8.1_testenv/bin/../lib64/libpqCore-pv5.8.so.1)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /opt/paraview/ParaView-5.8.1_testenv/bin/../lib64/libpqWidgets-pv5.8.so.1)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /opt/paraview/ParaView-5.8.1_testenv/bin/../lib64/libvtkqttesting-pv5.8.so.1)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /opt/paraview/ParaView-5.8.1_testenv/bin/../lib64/libvtkGUISupportQt-pv5.8.so.1)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /lib64/libQt5Network.so.5)
./bin/paraview: /home/tjim/anaconda3/envs/testenv/lib/libQt5Core.so.5: version `Qt_5.12.5_PRIVATE_API' not found (required by /lib64/libQt5Network.so.5)

```

I tried setting the QT directories directly using extra flags (below) but I had the same issue.

```auto
SET(Qt5_DIR "/usr/lib64/cmake/Qt5" CACHE STRING "")
SET(Qt5Core_DIR "/usr/lib64/cmake/Qt5Core" CACHE STRING "")
SET(Qt5Gui_DIR "/usr/lib64/cmake/Qt5Gui" CACHE STRING "")
SET(Qt5Help_DIR "/usr/lib64/cmake/Qt5Help" CACHE STRING "")
SET(Qt5Network_DIR "/usr/lib64/cmake/Qt5Network" CACHE STRING "")
SET(Qt5Sql_DIR "/usr/lib64/cmake/Qt5Sql" CACHE STRING "")
SET(Qt5Svg_DIR "/usr/lib64/cmake/Qt5Svg" CACHE STRING "")
SET(Qt5Widgets_DIR "/usr/lib64/cmake/Qt5Widgets" CACHE STRING "")
SET(Qt5X11Extras_DIR "/usr/lib64/cmake/Qt5Widgets" CACHE STRING "")

```

Any ideas of how to set the QT paths independently of the Python paths? Perhaps someone who knows their way around cmake or Paraview’s usage of it? Thanks!

---

<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: [May 15, 2021, 6:20pm UTC](https://discourse.paraview.org/t/paraview-5-8-1-python-cmake-flags/5620/3 "2021-05-15T18:20:39Z")

</div>

> [@TimJim](#):
>
> Any ideas of how to set the QT paths independently of the Python paths? Perhaps someone who knows their way around cmake or Paraview’s usage of it? Thanks!

There is no way to do this if the Python and Qt libraries live next to each other. If you want just the Python ones and different Qt libraries, you’ll have to make a new environment without the Qt libraries.

---

<div class="post-metadata">

### Author: ![TimJim](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timjim/32/1270_2.png) [@TimJim](https://discourse.paraview.org/u/TimJim)
#### Post date: [May 16, 2021, 5:51pm UTC](https://discourse.paraview.org/t/paraview-5-8-1-python-cmake-flags/5620/4 "2021-05-16T17:51:28Z")

</div>

Hi Ben, thanks for the update and clarification. I figured that this might have been the case. In the end, I uninstalled QT from my conda python environment just for the Paraview installation and then rolled back my conda environment afterwards, to stop PV linking to the python QT - a bit of a pain but it worked.

The order in which libraries are located is a bit of a mystery to me; it was half a year ago now, so Idon’t really remember, but I thought I could solve the issue by letting the PV just use the conda env’s QT but something didn’t work back then.

---

<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: [May 17, 2021, 2:06pm UTC](https://discourse.paraview.org/t/paraview-5-8-1-python-cmake-flags/5620/5 "2021-05-17T14:06:05Z")

</div>

On Linux, search paths are generally shared between all library lookups. If you have:

- A/libX.so
- A/libY.so
- B/libX.so
- B/libY.so

the priority order for directories is shared when looking for both `libX.so` and `libY.so`, so there is no way to order these directories in such a way that `A/libX.so` and `B/libY.so` are selected at runtime.
