pip-integration in addon-manager
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
pip-integration in addon-manager
Installing FreeCAD-wokbenches with pip is supported for quite some time. But until now it wasn't very easy to use this feature. (At least for someone not used to pip-command-line tools) To change this we need a GUI similar to the addon-manager.
As pip allready handles all the difficult stuff, implementing this is much simpler compared to the traditional addon-manager.
The tool is not yet fully ready, but I think there is not much missing. The current implementation looks like this:
we simple provide a list of package-names which can be installed with this tool. This list is fetched by the installer and represented in the gui. Currently this list exists in the module, but once we add the widget to the addon-manager we should think about providing the list in the FreeCAD-AddonManager repo [2].
I am not yet sure how to add this to the addon-manager, but I think we find a solution.
[1] https://github.com/looooo/freecad_pipintegration
[2] https://github.com/FreeCAD/FreeCAD-addons
edit:
ref: https://github.com/FreeCAD/FreeCAD-addons/issues/71
As pip allready handles all the difficult stuff, implementing this is much simpler compared to the traditional addon-manager.
The tool is not yet fully ready, but I think there is not much missing. The current implementation looks like this:
we simple provide a list of package-names which can be installed with this tool. This list is fetched by the installer and represented in the gui. Currently this list exists in the module, but once we add the widget to the addon-manager we should think about providing the list in the FreeCAD-AddonManager repo [2].
I am not yet sure how to add this to the addon-manager, but I think we find a solution.
[1] https://github.com/looooo/freecad_pipintegration
[2] https://github.com/FreeCAD/FreeCAD-addons
edit:
ref: https://github.com/FreeCAD/FreeCAD-addons/issues/71
Re: pip-integration in addon-manager
This is an awesome idea. Thanks looo
Edit: we should also think about the Addon Manager Pre-requisite checker https://github.com/FreeCAD/FreeCAD-addons/issues/29 moving forward with this.
Edit: we should also think about the Addon Manager Pre-requisite checker https://github.com/FreeCAD/FreeCAD-addons/issues/29 moving forward with this.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: pip-integration in addon-manager
yes I guess checking dependencies is still necessary. I am not sure if it's a good idea to use the dependency-handling of pip. pip tries to install also more difficult dependency (like numpy) which are not working on all plattforms/ distros and often it's better to install these deps with the system package-manager.Kunda1 wrote:Edit: we should also think about the Addon Manager Pre-requisite checker https://github.com/FreeCAD/FreeCAD-addons/issues/29 moving forward with this.
Re: pip-integration in addon-manager
Sorry for my ignorance, but what is the advantage of using pip? Also, it doesn't handle updating, or using threads to download in the background, or fetching workbench info, so we would end up having to recreate all that, which would be duplicating all the work done in the addon manager, no?
Re: pip-integration in addon-manager
yes there are quite some things missing. But integrating this in the addon-manager would need at least 10x more time. (It's pretty hard to understand the concept)yorik wrote:Sorry for my ignorance, but what is the advantage of using pip? Also, it doesn't handle updating, or using threads to download in the background, or fetching workbench info, so we would end up having to recreate all that, which would be duplicating all the work done in the addon manager, no?
My tool runs in the background with python threads, updating should be no problem...
While I absolutely appreciate the work done on the addon-manager, I think the addon-manager is already duplicated work. pip was always there and we simple couldn't use it because Workbenches for freecad were implemented in a way not compatible with normal python-modules.
This introduce several problems like name-clashes. The workarounds are not difficult, but it's realy not an ideal design.
A usecase of a freecad-package installed with pip is freecad_glider with openglider and pyrates with the additional freecad_packages. With pip it's possible to install everything with one command (python-packages get installed as a normal python module and freecad-packages get installed as namespace packages) How would you solve this with the addon-manager.
Then there are tools to create packages from standard-python modules for different distributions. I know there are tools for ubuntu and debian to do this (Ever wondered how they package all the python-.... packages?)
You may ask: why to we need this?
We don't need this for pure python-modules. The addon-manager is perfect for this. (As long as we don't have to deal with addons depending on different versions of freecad) But if an addon is compiled or depends on compiled (non common) libraries things get more difficult.
So in my opinion the addon-manager works good and is nice as long as things stay simple. But the pip approach for freecad-addons is for sure the more future-prove concept.
Re: pip-integration in addon-manager
Likely you should create a PR and just add the proposed GUI feature as a new tab. Code likely should stay separated for now (two files). And by doing that to further develop and maintain the "pip part" of the addon manager as the need arises. As likely both module types will need to coexist for years to come.
Re: pip-integration in addon-manager
yes exactly this is the idea. I don't want to make this a replacement of the addon installer. It should simple be another option (tab) next to the existing two tabs.
Re: pip-integration in addon-manager
looo wrote: ↑Tue Jul 03, 2018 10:15 pm We don't need this for pure python-modules. The addon-manager is perfect for this. (As long as we don't have to deal with addons depending on different versions of freecad) But if an addon is compiled or depends on compiled (non common) libraries things get more difficult.
Okay got it. Seems fine!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: pip-integration in addon-manager
Hi there. I'm trying to use pip to install an example workbench, like for development. From here: https://github.com/FreeCAD/Workbench-St ... to-freecad
I have an unzipped portable freecad (typical dev snapshot):
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13935 (Git)
Build type: Release
Branch: master
Hash: cb133767464337e4b5c8589a1fe33b4d7dad7721
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Russian/RussianFederation (ru_RU)
Running pip in windows command propmt complains it has no clue what is pip. I can however import pip in freecad's console. So I tried this:
So far, no luck. Any ideas? I am attempting to use pip for the first time ever, please forgive my stupidity.
I have an unzipped portable freecad (typical dev snapshot):
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13935 (Git)
Build type: Release
Branch: master
Hash: cb133767464337e4b5c8589a1fe33b4d7dad7721
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Russian/RussianFederation (ru_RU)
Running pip in windows command propmt complains it has no clue what is pip. I can however import pip in freecad's console. So I tried this:
Code: Select all
>>> import pip
>>> pip.main(['install', '-e', r'S:\_vt\dev\PC\Qt\FreeCAD\macros\Workbench-Starterkit-master'])
Obtaining file:///S:/_vt/dev/PC/Qt/FreeCAD/macros/Workbench-Starterkit-master
2
Error environment can only contain strings while executing command python setup.py egg_info
Exception:
Traceback (most recent call last):
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\site-packages\pip\req\req_set.py", line 518, in _prepare_file
abstract_dist.prep_for_dist()
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
command_desc='python setup.py egg_info')
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\site-packages\pip\utils\__init__.py", line 667, in call_subprocess
cwd=cwd, env=env)
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\subprocess.py", line 390, in __init__
errread, errwrite)
File "C:\FreeCAD\builds-snapshots\Default\bin\lib\subprocess.py", line 640, in _execute_child
startupinfo)
TypeError: environment can only contain strings
You are using pip version 9.0.2, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
>>> pip.main(['install', '-e', r'S:\_vt\dev\PC\Qt\FreeCAD\macros\Workbench-Starterkit-master\freecad\template_extension'])
1
Directory 'S:\\_vt\\dev\\PC\\Qt\\FreeCAD\\macros\\Workbench-Starterkit-master\\freecad\\template_extension' is not installable. File 'setup.py' not found.
You are using pip version 9.0.2, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
>>>
Re: pip-integration in addon-manager
Packaging of pip is still messed in your version. It should be fixed in the newest x64 builds.
Or you can add it yourself, see here: https://forum.freecadweb.org/viewtopic.php?t=16851
Also see here for ongoing integration of pip on Win https://forum.freecadweb.org/viewtopic. ... 60#p253175
"fight the good fight"