Kicad python pip is working?

I noticed that pip is distributed both with stable and dev releases of kicad…
but I tried to use pip to install a python module both in kicad stable and latest dev without succeed…

is pip functionality working for kicad in windows?

thx
Maurice

@nickoe
I was trying to install through pip a library useful for Via Fence stitching
Particularly the module is

pyclipper

(an other option would be to just add pyclipper to win distribution)

thanks for having a look at it

Maurice

Did you check the pip installation itself… I think there was an option to update it?

yes, already tested with

python -m pip install --upgrade pip

still I cannot install pyclipper

hm… and pyclipper can be installed in run-of-the-mill python installations with pip?

PS: I’m sure you already tried that, it’s just me doodeling around on my keyboard before going to bed :wink:

PPS: … while watching an IoT project of mine going bonkerz and not doing what it’s supposed to around this time of the day. Damnit, now I have to lower that 12m aluminium mast tomorrow… sad.
:head_bandage:

no way…
I’m going to try to install pyclipper in my building mingw chain… that could work

EDIT
bingo! that is working! Now I can add python modules to my win kicad installation… very unfriendly that the standard distro cannot use pip directly…
M

EDIT2
also this trick unfortunately is not working for numpy!

It is supposed to work, but I am not sure if does so or not. From which console do you install it?

I just launch the Command Prompt
and then for example:

cd %programfiles%\Kicad\bin
pip install pyclipper

Do you think it would help if you posted the error messages?

here it is

Microsoft Windows [Version 10.0.14393]
© 2016 Microsoft Corporation. All rights reserved.

C:\Users\userC>cd %programfiles%\Kicad\bin

C:\Program Files\KiCad\bin>pip install pyclipper
Collecting pyclipper
Using cached pyclipper-1.0.6.zip
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/setuptools_scm_git_archive/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) – Some packages may not be found!
Download error on https://pypi.python.org/simple/setuptools-scm-git-archive/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) – Some packages may not be found!
Couldn’t find index page for ‘setuptools_scm_git_archive’ (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) – Some packages may not be found!
No local packages or working download links found for setuptools_scm_git_archive>=1.0
Distribution mode: Compiling Cython generated .cpp sources.
Traceback (most recent call last):
File “”, line 1, in
File “c:\users\userc\appdata\local\temp\pip-build-rvhaub\pyclipper\setup.py”, line 91, in
cmdclass=cmdclass,
File “C:\Program Files\KiCad\lib\python2.7/distutils/core.py”, line 111, in setup
_setup_distribution = dist = klass(attrs)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/setuptools/dist.py”, line 316, in init
self.fetch_build_eggs(attrs[‘setup_requires’])
File “C:\Program Files\KiCad\lib\python2.7\site-packages/setuptools/dist.py”, line 371, in fetch_build_eggs
replace_conflicting=True,
File “C:\Program Files\KiCad\lib\python2.7\site-packages/pkg_resources/init.py”, line 846, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/pkg_resources/init.py”, line 1118, in best_match
return self.obtain(req, installer)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/pkg_resources/init.py”, line 1130, in obtain
return installer(requirement)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/setuptools/dist.py”, line 439, in fetch_build_egg
return cmd.easy_install(req)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/setuptools/command/easy_install.py”, line 659, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse(‘setuptools_scm_git_archive>=1.0’)

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in c:\users\userc\appdata\local\temp\pip-build-rvhaub\pyclipper\

C:\Program Files\KiCad\bin>

but you should be able to replicate it just launching the command I posted

It looks like setuptools_scm_git_archive requires Python 3, although pyclipper claims to work with 2.7.

KiCad is python 2.7. I would raise an issue on pyclipper github, I don’t think it is a KiCad issue.

not really,

I can build and use pyclipper.pyc, as I pointed out before, using my building chain for kicad in python 2.7.11

So this is an issue in kicad pip installation structure

Hmm, yes I think you are right. I tried installing pyclipper into my system python2.7 and it worked fine.

My next hunch is something to do with SSL certificates.

Could you try pip install --cert …\ssl\certs\ca-bundle.crt pyclipper ?

Microsoft Windows [Version 10.0.14393]
© 2016 Microsoft Corporation. All rights reserved.

C:\Users\userC>cd %programfiles%\Kicad\bin

C:\Program Files\KiCad\bin>pip install --cert …\ssl\certs\ca-bundle.crt pyclipper
Collecting pyclipper
Using cached pyclipper-1.0.6.zip
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/setuptools_scm_git_archive/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) – Some packages may not be found!
Download error on https://pypi.python.org/simple/setuptools-scm-git-archive/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) – Some packages may not be found!
Couldn’t find index page for ‘setuptools_scm_git_archive’ (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) – Some packages may not be found!
No local packages or working download links found for setuptools_scm_git_archive>=1.0
Distribution mode: Compiling Cython generated .cpp sources.
Traceback (most recent call last):
File “”, line 1, in
File “c:\users\userc\appdata\local\temp\pip-build-wj3he3\pyclipper\setup.py”, line 91, in
cmdclass=cmdclass,
File “C:\Program Files\KiCad\lib\python2.7/distutils/core.py”, line 111, in setup
_setup_distribution = dist = klass(attrs)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/setuptools/dist.py”, line 316, in init
self.fetch_build_eggs(attrs[‘setup_requires’])
File “C:\Program Files\KiCad\lib\python2.7\site-packages/setuptools/dist.py”, line 371, in fetch_build_eggs
replace_conflicting=True,
File “C:\Program Files\KiCad\lib\python2.7\site-packages/pkg_resources/init.py”, line 846, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/pkg_resources/init.py”, line 1118, in best_match
return self.obtain(req, installer)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/pkg_resources/init.py”, line 1130, in obtain
return installer(requirement)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/setuptools/dist.py”, line 439, in fetch_build_egg
return cmd.easy_install(req)
File “C:\Program Files\KiCad\lib\python2.7\site-packages/setuptools/command/easy_install.py”, line 659, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse(‘setuptools_scm_git_archive>=1.0’)

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in c:\users\userc\appdata\local\temp\pip-build-wj3he3\pyclipper\

C:\Program Files\KiCad\bin>

I don’t know how pip works, please let me know if you find a way to fix this.

I know this is really late but prepare for some grade A some thread necromancy.

I’ve got pip working in KiCad by starting a BoM generator script, editing the command given in the dialog to be

pip install <package>

running it and changing it back to the command when done.

Sounds like this could be it’s own script “pipkicad.” Is there a way you could create it or provide enough details for someone else to trivially create it?

Well, I gave it a try with @maui command and it still fails, however, it does look very promising. Thanks @ben_waese-perlman

Run command:
pip install pyclipper

Command error. Return code 1
Info messages:
Collecting pyclipper
  Downloading https://files.pythonhosted.org/packages/fc/65/8fff10c463f1f60ea8ec9fbb3e592636d0b259fb25bbe2ace3c050c6471e/pyclipper-1.1.0.post3.zip (138kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'

Error messages:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
  ERROR: Command errored out with exit status 1:
   command: 'C:/Program Files/KiCad_v5_1_6/bin/python.exe' 'C:\Program Files\KiCad_v5_1_6\lib\python2.7\site-packages\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\***\appdata\local\temp\tmpggacgg'
       cwd: c:\users\***\appdata\local\temp\pip-install-dzieki\pyclipper
  Complete output (4 lines):
  Traceback (most recent call last):
    File "C:\Program Files\KiCad_v5_1_6\lib\python2.7\site-packages\pep517\_in_process.py", line 22, in <module>
      import compat
  ImportError: No module named compat
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:/Program Files/KiCad_v5_1_6/bin/python.exe' 'C:\Program Files\KiCad_v5_1_6\lib\python2.7\site-packages\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\***\appdata\local\temp\tmpggacgg' Check the logs for full command output.

just for kicks, here is the version:

pip --version

Success
Info messages:
pip 19.2.3 from C:\Program Files\KiCad_v5_1_6\lib\python2.7\site-packages\pip (python 2.7)

and the KiCAD version:

Application: Eeschema
Version: (5.1.6)-1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.71.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.66.0
    Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

@HiGreg

Just change the command of any of the BOM tools or make a new one:

Well, this is going to be a problem…

Run command:
python -m pip install -U pip

Command error. Return code 1
Info messages:
Collecting pip
  Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:

Error messages:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not install packages due to an EnvironmentError: [Error 5] Zugriff verweigert: 'c:\\program files\\kicad_v5_1_6\\bin\\pip-script.py'
Consider using the `--user` option or check the permissions.