Custom built KiCAD 7.0.1 has no python console shown up

To develop KiCAD I cloned and built KiCAD (with 7.0.1 tag) under Debian 11.
But when I ran pcbnew, the python console showed up blank window.

I built kicad with wxWidgets 3.2 from codelite repo, and use python’s virtual env to install wxPython 4.2.

I configure build system by following command

cmake -G Ninja -DKICAD_USE_EGL=ON -DCMAKE_INSTALL_PREFIX=$(dirname $PWD)/debug_install -DPYTHON_SITE_PACKAGE_PATH=$(dirname $PWD)/debug_install/lib/python3/site-packages -DCMAKE_BUILD_TYPE=Debug ../../
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- KiCad install dir: <ROOT/kicad/build/debug_install>
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for iso646.h
-- Looking for iso646.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for strncasecmp
-- Looking for strncasecmp - found
-- Looking for strtok_r
-- Looking for strtok_r - found
-- Looking for malloc
-- Looking for malloc - found
-- Looking for math.h
-- Looking for math.h - found
-- Looking for C++ include cmath
-- Looking for C++ include cmath - found
-- Looking for asinh
-- Looking for asinh - found
-- Looking for acosh
-- Looking for acosh - found
-- Looking for atanh
-- Looking for atanh - found
-- Performing Test HAVE_CMATH_ISINF
-- Performing Test HAVE_CMATH_ISINF - Success
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for getc_unlocked
-- Looking for getc_unlocked - found
-- Performing Test COMPILER_SUPPORTS_WSUGGEST_OVERRIDE
-- Performing Test COMPILER_SUPPORTS_WSUGGEST_OVERRIDE - Success
-- Enabling warning -Wsuggest-override
-- Performing Test COMPILER_SUPPORTS_WINCONSISTENT_MISSING_OVERRIDE
-- Performing Test COMPILER_SUPPORTS_WINCONSISTENT_MISSING_OVERRIDE - Failed
-- Performing Test COMPILER_SUPPORTS_WDUPLICATED_BRANCHES
-- Performing Test COMPILER_SUPPORTS_WDUPLICATED_BRANCHES - Success
-- Enabling warning -Wduplicated-branches
-- Performing Test COMPILER_SUPPORTS_WDUPLICATED_COND
-- Performing Test COMPILER_SUPPORTS_WDUPLICATED_COND - Success
-- Enabling warning -Wduplicated-cond
-- Performing Test COMPILER_SUPPORTS_WVLA
-- Performing Test COMPILER_SUPPORTS_WVLA - Success
-- Enabling error for -Wvla
-- Performing Test COMPILER_SUPPORTS_WIMPLICIT_FALLTHROUGH
-- Performing Test COMPILER_SUPPORTS_WIMPLICIT_FALLTHROUGH - Success
-- Enabling warning -Wimplicit-fallthrough
-- Performing Test COMPILER_SUPPORTS_WRETURN_TYPE
-- Performing Test COMPILER_SUPPORTS_WRETURN_TYPE - Success
-- Enabling error for -Wreturn-type
-- Performing Test COMPILER_SUPPORTS_WSHADOW
-- Performing Test COMPILER_SUPPORTS_WSHADOW - Success
-- Enabling warning -Wshadow
-- Performing Test COMPILER_SUPPORTS_WSIGN
-- Performing Test COMPILER_SUPPORTS_WSIGN - Success
-- Enabling warning -Wsign-compare
-- Performing Test COMPILER_SUPPORTS_WMISSING_INIT
-- Performing Test COMPILER_SUPPORTS_WMISSING_INIT - Success
-- Enabling warning -Wmissing-field-initializers
-- Performing Test COMPILER_SUPPORTS_WEMPTY_BODY
-- Performing Test COMPILER_SUPPORTS_WEMPTY_BODY - Success
-- Enabling warning -Wempty-body
-- Performing Test COMPILER_SUPPORTS_WREORDER
-- Performing Test COMPILER_SUPPORTS_WREORDER - Success
-- Enabling warning -Wreorder
-- Performing Test COMPILER_SUPPORTS_WMISMATCHED_TAGS
-- Performing Test COMPILER_SUPPORTS_WMISMATCHED_TAGS - Success
-- Enabling warning -Wmismatched-tags
-- Performing Test COMPILER_SUPPORTS_WIMPLICIT_FLOAT_CONVERSION
-- Performing Test COMPILER_SUPPORTS_WIMPLICIT_FLOAT_CONVERSION - Failed
-- Performing Test COMPILER_SUPPORTS_WPSABI
-- Performing Test COMPILER_SUPPORTS_WPSABI - Success
-- Disabling warning -Wpsabi
-- Configuring KiCad for the wxGLCanvas EGL backend
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found OpenGL EGL library: /usr/lib/x86_64-linux-gnu/libEGL.so
-- Found GLM: /usr/include (found suitable version "0.9.9.8", minimum required is "0.9.8")
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Check for installed ZLIB -- found
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.74.0")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'cairo'
--   Found cairo, version 1.16.0
-- Found Cairo: /usr/lib/x86_64-linux-gnu/libcairo.so (found suitable version "1.16.0", minimum required is "1.12")
-- Checking for module 'pixman-1'
--   Found pixman-1, version 0.40.0
-- Found Pixman: /usr/lib/x86_64-linux-gnu/libpixman-1.so (found suitable version "0.40.0", minimum required is "0.30")
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.71.0")
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.10.4")
-- Found the following HarfBuzz libraries:
--  HarfBuzz (required): /usr/lib/x86_64-linux-gnu/libharfbuzz.so
-- Found HarfBuzz: /usr/include/harfbuzz (found version "2.7.4")
-- Found Fontconfig: /usr/lib/x86_64-linux-gnu/libfontconfig.so (found version "2.13.1")
-- Checking for module 'ngspice'
--   Found ngspice, version 34
-- Found ngspice: /usr/include
-- Found OCC: /usr/include/opencascade (found version "7.5.1")
-- Found OpenCASCADE Standard Edition version: 7.5.1
--  ++ OpenCASCADE Standard Edition include directory: /usr/include/opencascade
--  ++ OpenCASCADE Standard Edition shared libraries directory: /usr/lib/x86_64-linux-gnu
-- Found SWIG: /usr/bin/swig4.0 (found suitable version "4.0.2", minimum required is "4.0")
-- Found PythonInterp: ROOT/kicad/venv/bin/python3 (found suitable version "3.9.2", minimum required is "3.6")
-- Check for installed Python Interpreter -- found
-- Python module install path: ROOT/kicad/build/debug_install/lib/python3/site-packages
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.9.so (found suitable version "3.9.2", minimum required is "3.6")
-- pybind11 v2.9.2
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.9.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Found wxPython Phoenix 4.2.0/gtk3 (wxWidgets 3.2.0)
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_unofficial_gl-3.2;-lwx_gtk3u_unofficial_aui-3.2;-lwx_gtk3u_unofficial_html-3.2;-lwx_gtk3u_unofficial_core-3.2;-lwx_baseu_unofficial_net-3.2;-lwx_baseu_unofficial-3.2;-lwx_gtk3u_unofficial_propgrid-3.2;-lwx_baseu_unofficial_xml-3.2;-lwx_gtk3u_unofficial_stc-3.2;-lwx_gtk3u_unofficial_richtext-3.2 (found suitable version "3.2.0.1", minimum required is "3.2.0")
-- Found Doxygen: /usr/bin/doxygen (found version "1.9.1") found components: doxygen dot
-- Found UnixCommands: /usr/bin/bash
CMake Warning (dev) at thirdparty/argparse/CMakeLists.txt:10 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'ARGPARSE_INSTALL'.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Module support is disabled.
-- Version: 9.0.0
-- Build type: Debug
-- CXX_STANDARD: 17
-- Performing Test has_std_17_flag
-- Performing Test has_std_17_flag - Success
-- Performing Test has_std_1z_flag
-- Performing Test has_std_1z_flag - Success
-- Required features: cxx_variadic_templates
-- nanodbc version: 2.14.0
-- nanodbc compile: C++14
-- nanodbc feature: ODBC Version Override - OFF
-- nanodbc feature: Disable async features - OFF
-- nanodbc feature: Enable Unicode - ON
-- nanodbc feature: Enable Boost - ON
-- nanodbc feature: Enable SQL_NO_DATA bug workaround - OFF
-- nanodbc build: ODBC on Unix - unixODBC
-- ODBC compile flags: -I/usr/include -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8
-- ODBC link flags:
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.24.24
-- S3DSG version: 2.0.0
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: unit_test_framework filesystem system
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_unofficial_gl-3.2;-lwx_gtk3u_unofficial_aui-3.2;-lwx_gtk3u_unofficial_html-3.2;-lwx_gtk3u_unofficial_core-3.2;-lwx_baseu_unofficial_net-3.2;-lwx_baseu_unofficial-3.2;-lwx_baseu_unofficial_xml-3.2;-lwx_gtk3u_unofficial_stc-3.2 (found suitable version "3.2.0.1", minimum required is "3.0.0")
-- Configuring done
-- Generating done
-- Build files have been written to: ROOT/kicad/build/t

I ran the pcbnew via KICAD_RUN_FROM_BUILD_DIR=1 ./pcbnew/pcbnew

That’s not going to work.

You see it finds system wxpython which is compiled with very old wxwidgets. On debian 11 you have to compile (or get somewhere) both wxwidgets and wxpthon with matching versions.

Hello, thanks for reply.

It actually works, but when I generated this example config I forgot to execute . venv/bin/activate, after regenerated it I only fix lines in pasted config and missed this line.

I have re-ran the cmake and pasted it again. it actually found the wxpython 4.2

And if the cmake find wxWidgets before 3.2 (as shown in old cmake run) the pcbnew will popup that it will not support python console while using wxWidgets lower than 3.2

You are highly likely to run into issues running kicad even if it compiles.
Wxpython is very picky about being compiled exactly with the same exact version of wxwidgets that it is running with. wxpython installed from pip will likely not match the version of wxwidgets you have.

Also you will have to run kicad from virtualenv activated shell every time. Why bother when you can just install wxpython into system properly.

I want to do develop, I need to run it locally without installing , especially avoid sudo to install

Well, try it your way, maybe you will not have issues with what you are trying to do. Otherwise you know how to fix it, you will only have to install wxpython once, same as any other library needed for kicad.

Also if what you are going to work on is not related to python scripting you can disable that feature in cmake.

the problem should not be the virtual env, because I did install wxpython in global python env before it is the same issue

Yes, like I said, the problem is likely mismatch of wxpython and wxwidgets versions. You can’t expect them to match when you install wxpython from pip, doesn’t matter if it’s into global site-packages or into virtualenv.

1 Like