Closed AmeyaPatwardhan closed 2 years ago
And where would pip install things?
We could add pv-slvs to the flatpak, but there is no source package on pypi available.
IMHO the workbench should bundle it and not depend on "system wide" installation. (it's not the only one that require external python modules)
Just CCing @realthunder on this as well so it's on his radar.
py-slvs
cannot by bundled because of licensing issue. Using system pip
will only work if the system Python is compatible with the one used to build FreeCAD. So I think the problem should be fixed by bundling pip
into FreeCAD build.
I couldn't find a source distribution on pypi.
And what is the licensing problem you are mentioning, because if you can bundle it, I don't think we can either.
The pipy package home links to the repo. It is licensed under GPL, while FreeCAD is LGPL. I don't mean to bundle py-slvs. I mean to bundle pip itself, which is what I assume what's missing here. py-slvs will be installed on demand by user explicitly.
So I will reiterate the question https://github.com/flathub/org.freecadweb.FreeCAD/issues/88#issuecomment-1179136571: where will pip install this module?
Just to clarify. The file system is READ ONLY inside the sandbox.
And my armchair analysis of licensing is that if you can't bundle py_slvs
with your workbench, then surely we can't with the Flatpak.
I am not sure how flatpak
works. For snap
, it will store common data associated with a particular app in ~/snap/<app_name>/common
directory. For user installed pip package, it will be installed in ~/snap/<app_name>/common/.local/lib/python<version>/site-packages
.
I think the add-on manager uses a freecad specific directory for pip packages, if I'm not mistaken they are installed somewhere in $XDG_DATA_HOME which should available to write for the flatpak. @chennes would know better about this
@AmeyaPatwardhan maybe try this with the adjustments for the FreeCAD app. You will need to override the PATH
environment var and set it to /app/bin:/usr/bin:/var/data/python/bin
.
@tinywrkb tried using the suggested approach. I could not get it to work. However, this may be because of my lack of knowledge of flatpak environment variables, chroot etc. Is there any way to create a python virtual environment and simply add this to the flatpak path?
The Addon Manager installs Python dependencies in a directory immediately adjacent to the Mod directory itself, called AdditionalPythonPackages
. If you have write permissions to install mods, you have write permissions to install Python packages in that location. It does depend on the version of Python that is used by the FreeCAD installation having pip, however. We ship it with the Windows installation, for example. There is also a configuration variable in the Addon Manager preferences where you can set the path to that Python executable, so I suppose a possible workaround is to set that path to your system's Python and see if it will install the library you need.
@AmeyaPatwardhan it works fine for me over here. I suggest that you wait for pip to be bundled with this Flatpak, but if really want to try, then it's pretty easy.
$ flatpak install flathub $(flatpak info --show-sdk org.freecadweb.FreeCAD)
$ flatpak run --devel --command=pip3 org.freecadweb.FreeCAD install --user --ignore-installed pip wheel
$ flatpak uninstall $(flatpak info --show-sdk org.freecadweb.FreeCAD)
$ flatpak run --env=PATH=/app/bin:/usr/bin:/var/data/python/bin org.freecadweb.FreeCAD
You can also explicitly set PYTHONUSERBASE=/var/data/python
, but it's not really needed.
Unable to install Assembly3 in Freecad 0.20 (Flatpak) on Ubuntu 20.04
Upon using the addon manager-> Assembly3->Install, and clicking yes to install the python dependencies (py-slvs) the following message pops up:
Failed to execute pip, which may be missing from your Python installation. Please ensure your system has pip installed and try again. The failed command was:
/usr/bin/python3 -m pip --version
Continue with installation of Assembly3 anyway?
Freecad version: FreeCAD - An open source parametric 3D CAD modeler
ID: org.freecadweb.FreeCAD Ref: app/org.freecadweb.FreeCAD/x86_64/stable Arch: x86_64 Branch: stable Version: 0.20.0.29177 License: LGPL-2.1 Origin: flathub Collection: org.flathub.Stable Installation: user Installed: 1.0 GB Runtime: org.kde.Platform/x86_64/5.15-21.08 Sdk: org.kde.Sdk/x86_64/5.15-21.08