Closed bogen85 closed 2 years ago
This issue is not the finding of python by CudaText. Python (not the system wide python) is found and most plugins work fine. That aspect is discussed in #2 and is not the problem here.
(What is found is a python that flatpak installs for the io.github.cudatext.CudaText-Qt5 package, which, as I said, works fine).
The issue is when a CudaText plugin depends on some pip module (such as the cudatext ftp plugin dependency on paramiko) and that pip module is not in the flatpak python installation that the io.github.cudatext.CudaText-Qt5 package uses.
Since CudaText adds path "py" (location of this "py" - is shown in the Wiki), you can copy Paramiko lib and all other python libs to "py"! did you try it? note - use correct version of python lib if it has binary .so files.
Seems like a rabbit trail in regard to paths to dynamically linked paths in said binary .so files... (as they will be resolved in the flatpak sandbox for cudatext)
I dont understand what you said here.
Menu command "Plugins / addon manager / edit plugin" can open some plugin. it is opened in the "py" dir. so why not to put python libs there?
@Alexey-T I removed all my user pip modules so I'd start out fresh. I just installed paramiko. Did an ldd on all the .so files under the /.local/lib/python3.10 path. The so paths those .so files dependent on don't seem match exactly what is in the flatpak cudatext sandbox view.
By rabbit trail I mean going down the path of making it work this way I'd be trying to resolve paths between two system views.
Also, the python version used inside the io.github.cudatext.CudaText-Qt5 package is not the same as the system available versions in my distro.
Why not to do this
I know what you mean (yes, I'm already familiar with the py
path), but most python installs are not 100% self contained. So I would need to:
I called it a rabbit trail
because I'd have no idea how long that would take and if it would even be practical to get what I need out of that.
Any file in a standard system path that is referred to by some python module (binary or not) in the py path will resolve to a path in the cudatext flatpak sandbox view.
Plugins that launch external apps from the system don't work either when using cudatext installed via flatpak (At least I've not gotten them to work) most likely for the same reason (they are not in the cudatext flatpak sandbox view).
I did a pip user install of just paramko
. (deleted my user specific pip tree first)
$ pip list --user
Package Version
-------- -------
bcrypt 4.0.0
paramiko 2.11.0
PyNaCl 1.5.0
I did not install bcrypt
and PyNaCl
, paramiko
depends on them so they were installed automatically.
To do what you are suggesting I'd need to build all of those for python 3.9.9 (which is the python version flatpak is using for cudatext, not what is available on my system)
I'd need to copy/map all those into the py
folder.
I'd need to make sure all the system paths in every file in those python packages is resolvable in the cudatext flatpak sandbox view.
I did a pip user install of just
paramko
. (deleted my user specific pip tree first)
if done outside the sandbox, it's irrelevant. It won't see it.
the gist of the problem is that if you rely on system wide dependencies installed that way, it will not work.
if done outside the sandbox, it's irrelevant. It won't see it. the gist of the problem is that if you rely on system wide dependencies installed that way, it will not work.
@hfiguiere Yes, agreed. That is why I said trying to make it work in the way that @Alexey-T suggested would likely end up being a rabbit trail
So, if we all agree on the following:
Then I don't see a point in keeping this issue open and will just have accept these as limitations of the flatpak cudatext install.
@Alexey-T Oh, I meant rabbit hole
when I said rabbit trail
https://www.thefreedictionary.com/rabbit+hole
Something that is intricate or convoluted like a labyrinth and often has no outlet or resolution
you can also work them out, it's problably some work, including upstream.
For example FreeCAD relies on pip (to be added to the package) to install the python dependencies as needed. Not sure the detail of their implementation, but I would just create a python venv in the XDG_DATA_HOME.
Seems like for this to work cohesively that all the flatpak cudatext modules (that are in the py
directory) would have to be in said venv?
I'll look into the XDG_DATA_HOME python venv approach.
But it seems like overall to not have to rely completely on this closed sandbox that the CudaText flatpak install would need to use the approach used by FreeCAD, and this may not be easily solvable on a plugin by plugin basis.
I'm closing this as this would take a rework of io.github.cudatext.CudaText-Qt5 (or be an alternate flatpak) to make this work generically like was mentioned for FreeCAD.
This was originally filed at https://github.com/Alexey-T/CudaText/issues/4357 but that is not the correct location.
For the most part the flatpak install of CudaText-Qt5 works great. I have been using for several months now on multiple Linux distributions.
However, there is no straight forward to use cudatext plugins (such as the ftp one that depends on the paramiko python package) that depend on more than just a generic python install.
CudaText ftp plugin: https://github.com/pohmelie/cuda_ftp
I'm not sure how this can be remedied (or if there is any possible solution for this), as I'm not familiar with making flatpak packages.