Cmake error at cmake/FindSIP.cmake

I have an issue trying to build cura-build-environment, after running sudo make in build file I’m getting this…

 [ 43%] Performing configure step for 'Savitar'
-- Find shared libpython: /usr/local/lib/libpython3.8.so
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/abc.py", line 64, in <module>
ImportError: No module named '_abc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/io.py", line 52, in <module>
  File "/usr/local/lib/python3.8/abc.py", line 68, in <module>
  File "/usr/local/lib/python3.8/_py_abc.py", line 35
    def __new__(mcls, name, bases, namespace, /, **kwargs):
                                              ^
SyntaxError: invalid syntax
CMake Error at cmake/FindSIP.cmake:47 (message):
  Failed to get Python3_SITELIB.  Error:
Call Stack (most recent call first):
  CMakeLists.txt:48 (find_package)


-- Configuring incomplete, errors occurred!

I tried re-installing python3.8 but still no luck.
This is a snippet of the CMakeLists.txt of Savitar, which I think is causing the issue:

project(savitar)
cmake_minimum_required(VERSION 3.8)    
##### find python
execute_process(COMMAND python3-config --prefix OUTPUT_VARIABLE PYTHON_SEARCH_PATH)
string(REGEX REPLACE "\n$" "" PYTHON_SEARCH_PATH "${PYTHON_SEARCH_PATH}")
file(GLOB_RECURSE PYTHON_DY_LIBS ${PYTHON_SEARCH_PATH}/lib/libpython*.dylib ${PYTHON_SEARCH_PATH}/lib/libpython*.so)
if (PYTHON_DY_LIBS)
    list(GET PYTHON_DY_LIBS 0 PYTHON_LIBRARY)
    message("-- Find shared libpython: ${PYTHON_LIBRARY}")
else()
    message(WARNING "Cannot find shared libpython, try find_package")
endif()#####

if(BUILD_PYTHON)
    list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

    # FIXME: Remove the code for CMake <3.12 once we have switched over completely.
    # FindPython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs.
    if(${CMAKE_VERSION} VERSION_LESS 3.12)
        # FIXME: Use FindPython3 to find Python, new in CMake 3.12.
        # However currently on our CI server it finds the wrong Python version and then doesn't find the headers.
        find_package(PythonInterp 3.4 REQUIRED)
        find_package(PythonLibs 3.4 REQUIRED)
	find_package(Python3_EXECUTABLE Interpreter)
    else()
        # Use FindPython3 for CMake >=3.12
        find_package(Python3 3.4 REQUIRED COMPONENTS Interpreter Development)

    endif()

    find_package(SIP REQUIRED)
    if(NOT DEFINED LIB_SUFFIX)
        set(LIB_SUFFIX "")
    endif()

    include_directories(python/ src/ ${SIP_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS})
endif()

UPDATE

The issue is coming from the SIP package if I’m not mistaken, beacause this is where the cmakefile is giving the errors !
at find_package(SIP REQUIRED) If I tried uninstalling sip its showing that the location of sip is in .local/python3.5 ! This might be the issue ?? But what is the solution ??

the issue of abc.py file only appears if the file is excuted by python 3.5 and not 3.8, I don’t know what is causing the python script to be ran by python 3.5 ! althought in cmakelists file I mentioned to use 3.8

I think you’d have to analyze (or consult with the authors of) the cmake/FindSIP.cmake in the project you’re building. This does not seem to come from the CMake distribution but is something provided by the project.