I run KiCad v5.99 built locally from the git repo. I am trying to figure out how to install the corresponding Python libraries as have old v5.1 version for the Ubuntu package. I can’t see to figure out what make target will do that. Thanks!
Details:
This is the v5.1 version that comes from the Ubuntu package:
pdp7@x1:~/dev/kicad/kicad/build/debug$ find /usr/lib |grep -i pcbnew
/usr/lib/python3/dist-packages/pcbnew.py
/usr/lib/python3/dist-packages/_pcbnew.so
pdp7@x1:~/dev/kicad/kicad/build/debug$ python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcbnew
>>> print(pcbnew)
<module 'pcbnew' from '/usr/lib/python3/dist-packages/pcbnew.py'>
>>>
pdp7@x1:~/dev/kicad/kicad/build/debug$ dpkg -L kicad |grep python
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/_pcbnew.so
/usr/lib/python3/dist-packages/pcbnew.py
pdp7@x1:~/dev/kicad/kicad/build/debug$ dpkg -l kicad
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-===========================================-============-============================================
ii kicad 5.1.6-202005120822+c6e7f7d~86~ubuntu19.10.1 amd64 Electronic schematic and PCB design software
Here is the v5.99 install:
pdp7@x1:~/dev/kicad/kicad/build/debug$ which kicad
/usr/local/bin/kicad
$ python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcbnew
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pdp7/dev/kicad/kicad/build/debug/pcbnew/pcbnew.py", line 38, in <module>
import _pcbnew
ImportError: dynamic module does not define module export function (PyInit__pcbnew)
//Build for Python 3 instead of 2 (default OFF).
KICAD_SCRIPTING_PYTHON3:BOOL=OFF
//Build wxPython implementation for wx interface building in Python
// and py.shell (default ON).
KICAD_SCRIPTING_WXPYTHON:BOOL=ON
//Use new wxPython binding (default OFF).
KICAD_SCRIPTING_WXPYTHON_PHOENIX:BOOL=OFF
pdp7@x1:~/dev/kicad/kicad/build/debug$ cmake -DKICAD_SCRIPTING_PYTHON3=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/usr/local -DCMAKE_INSTALL_PREFIX=/usr/local -DDEFAULT_INSTALL_PATH=/usr/local -DKICAD_CONFIG_DIR=kicad-master ../../
-- KiCad install dir: </usr/local>
-- Enabling warning -Wsuggest-override
-- Enabling warning -Wduplicated-branches
-- Enabling warning -Wduplicated-cond
-- Enabling error for -Wvla
-- Enabling warning -Wimplicit-fallthrough
-- Enabling error for -Wreturn-type
-- Enabling warning -Wshadow
-- Enabling warning -Wsign-compare
-- Enabling warning -Wmissing-field-initializers
-- Enabling warning -Wempty-body
-- Enabling warning -Wreorder
-- Disabling warning -Wpsabi
-- Check for installed GLEW -- found
-- Check for installed ZLIB -- found
-- Could NOT find PythonInterp: Found unsuitable version "2.7.18", but required is at least "3.3" (found /usr/bin/python2)
-- Check for installed Python Interpreter -- not found
CMake Error at CMakeModules/CheckFindPackageResult.cmake:6 (message):
Python Interpreter was not found - it is required to build Kicad
Call Stack (most recent call first):
CMakeLists.txt:751 (check_find_package_result)
-- Configuring incomplete, errors occurred!
See also "/home/pdp7/dev/kicad/kicad/build/debug/CMakeFiles/CMakeOutput.log".
See also "/home/pdp7/dev/kicad/kicad/build/debug/CMakeFiles/CMakeError.log".
//Python module install path.
PYTHON_DEST:PATH=lib/python2.7/dist-packages
//Path to a program.
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python2
//Path to a file.
PYTHON_INCLUDE_DIR:PATH=/usr/include/python2.7
//Path to a library.
PYTHON_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython2.7.so
Yeah, it is probably something cached by CMake already. I’m not sure the details of how the python finder works, but probably it has set a number of variables for Python2 already.
Thanks @nickoe and @craftyjon. I deleted build and recreated but now am running into:
pdp7@x1:~/dev/kicad/kicad$ rm -rf build/
pdp7@x1:~/dev/kicad/kicad$ mkdir -p build/release
pdp7@x1:~/dev/kicad/kicad$ mkdir build/debug # Optional for debug build.
(reverse-i-search)`c': ^C ..
pdp7@x1:~/dev/kicad/kicad$ cd deb
bash: cd: deb: No such file or directory
pdp7@x1:~/dev/kicad/kicad$ cd debu^C
pdp7@x1:~/dev/kicad/kicad$ cd build/debug/
pdp7@x1:~/dev/kicad/kicad/build/debug$ cmake -DKICAD_SCRIPTING_PYTHON3=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/usr/local -DCMAKE_INSTALL_PREFIX=/usr/local -DDEFAULT_INSTALL_PATH=/usr/local -DKICAD_CONFIG_DIR=kicad-master ../../
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- KiCad install dir: </usr/local>
-- 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 - Failed
-- 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
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found GLEW: /usr/include
-- Check for installed GLEW -- found
-- Found GLM: /usr/include (found suitable version "0.9.9.7", 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.68.0")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- 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.38.4
-- Found Pixman: /usr/lib/x86_64-linux-gnu/libpixman-1.so (found suitable version "0.38.4", minimum required is "0.30")
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.59.0")
-- Checking for module 'ngspice'
-- Found ngspice, version 31
-- Found ngspice: /usr/include
-- Found SWIG: /usr/bin/swig4.0 (found suitable version "4.0.1", minimum required is "3.0")
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.5", minimum required is "3.3")
-- Check for installed Python Interpreter -- found
-- Python module install path: lib/python3/dist-packages
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so (found suitable version "3.8.5", minimum required is "3.3")
CMake Error at CMakeLists.txt:810 (message):
Unable to find wxPython Classic, instead found wxPython Phoenix 4.0.7
-- Configuring incomplete, errors occurred!
See also "/home/pdp7/dev/kicad/kicad/build/debug/CMakeFiles/CMakeOutput.log".
See also "/home/pdp7/dev/kicad/kicad/build/debug/CMakeFiles/CMakeError.log".
on Ubuntu 20.04.1 LTS
I turned off KICAD_SCRIPTING_WXPYTHON and cmake completed:
pdp7@x1:~/dev/kicad/kicad/build/debug$ cmake -DKICAD_SCRIPTING_WXPYTHON=OFF -DKICAD_SCRIPTING_PYTHON3=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/usr/local -DKICAD_CONFIG_DIR=kicad-master ../../
-- KiCad install dir: </usr/local>
-- Enabling warning -Wsuggest-override
-- Enabling warning -Wduplicated-branches
-- Enabling warning -Wduplicated-cond
-- Enabling error for -Wvla
-- Enabling warning -Wimplicit-fallthrough
-- Enabling error for -Wreturn-type
-- Enabling warning -Wshadow
-- Enabling warning -Wsign-compare
-- Enabling warning -Wmissing-field-initializers
-- Enabling warning -Wempty-body
-- Enabling warning -Wreorder
-- Disabling warning -Wpsabi
-- Check for installed GLEW -- found
-- Check for installed ZLIB -- found
-- Check for installed Python Interpreter -- found
-- Python module install path: lib/python3/dist-packages
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_gl-3.0;-lwx_gtk3u_aui-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0;-lwx_gtk3u_propgrid-3.0;-lwx_baseu_xml-3.0;-lwx_gtk3u_stc-3.0 (found suitable version "3.0.4", minimum required is "3.0.0")
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.17") found components: doxygen dot
-- Creating linux metadata
-- Found Git: /usr/bin/git (found version "2.25.1")
-- Using Git to determine build version string.
-- Checking for module 'gtk+-3.0'
-- Found gtk+-3.0, version 3.24.20
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")
-- S3DSG version: 2.0.0
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: unit_test_framework filesystem system
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_gl-3.0;-lwx_gtk3u_aui-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0;-lwx_baseu_xml-3.0;-lwx_gtk3u_stc-3.0 (found suitable version "3.0.4", minimum required is "3.0.0")
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: unit_test_framework
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pdp7/dev/kicad/kicad/build/debug
pdp7@x1:~/dev/kicad/kicad/build/debug$
I’ve not pursued getting WxPython to work, but I can import pcbnew from v5.99 now ok:
pdp7@x1:~/dev/kicad/kicad/build/debug$ PYTHONPATH=$PWD/pcbnew python3 ~/dev/oshpark/valet/vendor/kicad-cam.py ~/dev/oshpark/art/pumpkin-medium.kicad_pcb plot /tmp
/home/pdp7/dev/oshpark/art/pumpkin-medium.kicad_pcb
Executing full plot plan: Printing all to /tmp
Traceback (most recent call last):
File "/home/pdp7/dev/oshpark/valet/vendor/kicad-cam.py", line 243, in <module>
plot=board.plotAll(sys.argv[3])
File "/home/pdp7/dev/oshpark/valet/vendor/kicad-cam.py", line 203, in plotAll
self.__setPlotOptions(outputDir)
File "/home/pdp7/dev/oshpark/valet/vendor/kicad-cam.py", line 152, in __setPlotOptions
self.plotoptions.SetPlotPadsOnSilkLayer(False)
AttributeError: 'PCB_PLOT_PARAMS' object has no attribute 'SetPlotPadsOnSilkLayer'
pdp7@x1:~/dev/kicad/kicad/build/debug$
which shows me that it seems we will need to update our CAM script for V6.
I just realized that KICAD_SCRIPTING_WXPYTHON=OFF seems to mean I can’t run any plugins ( V5.99: plugins missing after recent build ) so I do need to find a solution to getting past the error when KICAD_SCRIPTING_WXPYTHON=ON: