I am not sure, but just FYI, the approach that Adam is investigating will not involve wrangle-bundle in the end in order to use system Python.
For now I have decided to just use the Python 3.8 and wxpython builtby kicad-mac-builder because it works, and hopefully eventually it will be easy to use a different Python. -Jon On Thu, Apr 29, 2021 at 9:23 AM Jonatan Liljedahl <li...@kymatica.com> wrote: > Hi, > > So I continued to try building with my local python3 (installed via > homebrew), and wxpython installed via pip. > > Running wrangle-bundle first gave this output: > > lijon@lijon-mbp master_py3 % wrangle-bundle --python-version 3.9 --fix > ../install_py3/KiCad.app > Looking for issues in ../install_py3/KiCad.app, and fixing what we can... > ERROR: Dependency > /usr/local/Cellar/python@3.9 > /3.9.4/Frameworks/Python.framework/Versions/3.9/Python > of > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/MacOS/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python > isn't inside the app directory. > ERROR: Dependency > /usr/local/Cellar/python@3.9 > /3.9.4/Frameworks/Python.framework/Versions/3.9/Python > of > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python > isn't inside the app directory. > ERROR: Dependency /usr/local/opt/opencascade/lib/libTKVCAF.7.dylib of > > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/PlugIns/3d/libTKVCAF.7.dylib > isn't inside the app directory. > ERROR: Dependency /usr/local/opt/freeimage/lib/libfreeimage.dylib of > > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/PlugIns/3d/libTKVCAF.7.dylib > isn't inside the app directory. > ...snip... > Issues found: > Found dependency issues. > > Still no 'wx' inside the bundle, so pcbnew scripting console can't import > wx. > Tried this: > cp -a /usr/local/lib/python3.9/site-packages/* > > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ > > And then re-ran wrangle-bundle, which now crashes: > > lijon@lijon-mbp master_py3 % wrangle-bundle --python-version 3.9 --fix > ../install_py3/KiCad.app > Looking for issues in ../install_py3/KiCad.app, and fixing what we can... > Traceback (most recent call last): > File "/usr/local/bin/wrangle-bundle", line 8, in <module> > sys.exit(main()) > File > "/usr/local/lib/python3.9/site-packages/dyldstyle/bundle_wrangler.py", > line 505, in main > handle_bundle(app_path, args.python_version, fix=True) > File > "/usr/local/lib/python3.9/site-packages/dyldstyle/bundle_wrangler.py", > line 166, in handle_bundle > macho_types = utils.get_macho_types(app_path) > File "/usr/local/lib/python3.9/site-packages/dyldstyle/utils.py", > line 231, in get_macho_types > macho_type = get_macho_type(p) > File "/usr/local/lib/python3.9/site-packages/dyldstyle/utils.py", > line 202, in get_macho_type > magic = get_file_magic(path) > File "/usr/local/lib/python3.9/site-packages/dyldstyle/utils.py", > line 151, in get_file_magic > subprocess.check_output(cmd, stderr=subprocess.STDOUT) > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position > 194: invalid continuation byte > > Any ideas? > > On Thu, Apr 29, 2021 at 2:30 PM Jon Evans <j...@craftyjon.com> wrote: > > > > Hi Jonatan, > > > > Adam and I have been bouncing ideas back and forth and he helped me get > to a working setup, most recently with Seth's new_python branch but I think > this should work with current master too. > > > > The key point is that we don't yet have a working way to use your system > Python (but Adam has ideas on that and is working on it) > > > > So, the steps that worked for me are: > > > > 1) Use kicad-mac-builder to set up the dependencies. > > As described in the readme: > https://gitlab.com/kicad/packaging/kicad-mac-builder > > run ./build.py --target setup-kicad-dependencies > > > > Note: this will install everything, including wxwidgets, wxpython, etc. > There isn't currently a way to skip some if you already have them built > outside kicad-mac-builder. > > Really you and I mostly need Python out of this, as it's the only > dependency that is hard to manage right now. > > > > 2) At the end of its run, build.py will spit out a lot of suggested > CMake flags. Save these, and then do a merge with your current CMake flags > that you are building with. > > In particular, you'll want to carry over the flags that point at the > Python framework created by build.py. > > > > 3) Use Adam's wrangle-bundle script to fixup the installed bundle. > > Obtain that from https://gitlab.com/adamwwolf/dyldstyle and install it > (I used the venv method suggested by Adam in the readme) > > Run something like wrangle-bundle --python-version 3.8 --fix > path/to/KiCad.app > > > > 4) At this point, your build should work and make install should also > work (at least it did for me). Please let us know if you don't have success > > > > 5) There are additional steps and complications if you want to run and > debug targets without first doing make install, as is possible on other > platforms. I have figured out a workaround that makes this work, but it is > not awesome, so Adam and I are discussing an easier route. > > > > We will update the documentation accordingly, things are just moving > quickly at the moment and we're trying to have them settle down in a way > that is easy to follow for developers. > > > > Best, > > Jon > > > > On Thu, Apr 29, 2021 at 7:16 AM Jonatan Liljedahl <li...@kymatica.com> > wrote: > >> > >> I now tried manually copying my system site-packages into the bundle: > >> > >> cp -a /usr/local/lib/python3.9/site-packages/* > >> > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ > >> > >> Now when starting pcbnew, console gives a lot of: > >> > >> Class wxSTCPopupBaseView is implemented in both > >> > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/libwx_osx_cocoau-3.1.5.0.0.dylib > >> (0x10f13c8d8) and > >> > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wx/libwx_osx_cocoau_stc-3.1.5.0.0.dylib > >> (0x1198ddbf8). One of the two will be used. Which one is undefined. > >> > >> And trying to open scripting console says: > >> > >> Traceback (most recent call last): > >> File "<string>", line 5, in <module> > >> File > "/Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/SharedSupport/scripting/kicad_pyshell/__init__.py", > >> line 230, in makePcbnewShellWindow > >> pyshell = PcbnewPyShell(parent, id=-1, title=INTRO) > >> File > "/Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wx/py/editor.py", > >> line 265, in __init__ > >> EditorFrame.__init__(self, parent, id, title, pos, > >> File > "/Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wx/py/editor.py", > >> line 29, in __init__ > >> frame.Frame.__init__(self, parent, id, title, pos, size, style) > >> File > "/Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wx/py/frame.py", > >> line 69, in __init__ > >> wx.Frame.__init__(self, parent, id, title, pos, size, style) > >> wx._core.PyNoAppError: The wx.App object must be created first! > >> > >> Hopefully this helps! > >> > >> On Thu, Apr 29, 2021 at 1:09 PM Jonatan Liljedahl <li...@kymatica.com> > wrote: > >> > > >> > So, I updated my CMake and tweaked some variables, and now 'make > >> > install' succeeds without "app verification failed". Also I can start > >> > pcbnew without crashing. However, trying to open the scripting console > >> > in pcbnew gives an error popup. The console reveals that it couldn't > >> > import the 'wx' module. > >> > > >> > During make install, I saw this: > >> > > >> > cp: cannot overwrite directory > >> > > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages > >> > with non-directory > >> > /usr/local/Cellar/python@3.9 > /3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages > >> > > >> > It's non-directory because it's a symlink. It points to > >> > /usr/local/lib/python3.9/site-packages, which does contain the 'wx' > >> > module. > >> > > >> > I've tried rerunning cmake with > >> > -DPYTHON_SITE_PACKAGE_PATH=/usr/local/lib/python3.9/site-packages but > >> > I get the same error at make install. Perhaps it's cached somewhere, > >> > how can I clear that without doing the whole build again from scratch? > >> > (which takes a couple of hours on my slow machine...) > >> > > >> > -- > >> > /Jonatan > >> > http://kymatica.com > >> > >> > >> > >> -- > >> /Jonatan > >> http://kymatica.com > >> > >> _______________________________________________ > >> Mailing list: https://launchpad.net/~kicad-developers > >> Post to : kicad-developers@lists.launchpad.net > >> Unsubscribe : https://launchpad.net/~kicad-developers > >> More help : https://help.launchpad.net/ListHelp > > > > -- > /Jonatan > http://kymatica.com >
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp