How to import external Python libraries from an extension?

Hi, everybody.

I am developing an extension for Calc in Python where I need to use pandas and numpy.
I don’t want to distribute the wheels of those libraries inside my extension as this would require to make different versions for different platforms.
Is there a way to import packages from $PYTHONPATH?

Thanks in advance.

Like this extension?

Pandas for LibreOffice » Extensions.

like this?
[Pandas for LibreOffice » Extensions]> (Pandas for LibreOffice » Extensions).

no, no, no please dont use these scams from @vib because they installs in the first place the whole dependency-tree from ooodev!
None of them is a dependency for pandas!

you should use the generic third-party-pip-installer which is included in in this fork of apso.oxt

1 Like

I am working on an extension for LibreOffice Calc that adds feature similar to Python in MS Excel.
It is still in alpha aversion right now but can demonstrate some of the functionality.
The current state can be found on the Addon Branch here. Adding a python cell to a Calc sheet is currently done by clicking on Add Python Cell in the Tools → Addon Menu.


A example file is found in the Document/Examples/Calc in the melt.ods file.

The extension in it current state can be found in the dist folder.
Because this is still in alpha state I recommend installing in an isolated environment if possible.


Be aware this extension installs many Python packages including Pandas, Numpy, matplotlib, Seaborn and others and may not install in window properly yet. May work if My Pandas extension which is explained here again why the extension is needed, especially on windows, is installed first on windows.

Most all my testing has been done on Linux so far. Although I did a little testing on windows.


Not sure of your timeline or if this meets your needs but thought I would give you this information.


I also so wrote a Include Python Path for LibreOffice that can add external python paths into LibreOffice. This is great for development or if you just need to include python paths in your Local LibreOffice installation.


And Then there is Importing Python Modules which used sessions. I wrote a class Session class for this in OOO Development tools.

Hmm… Well this seems very misleading. This is not the first unwarranted slanderous statement from @karolus . The last one was address here

In my opinion this is an outright lie and must be breaking some community guidelines here. I have no dealing with @karolus and am astonished by such misleading statements. Not a good look.

@karolus in this and my only statement to you on this mater is: Please just let this end here and now.

Thats your opinion…
In my opinion its a outright lie, to call this Extension »Pandas for Libreoffice« !!

Call it Another oodev installer that also installs pandas if you like, at least you wouldn’t be lying to your customers

The OooDev package is included for convenience and future works. If uses ask for it not be be include I am more then happy to make it optional or not include it in future releases. This it not any reason to call good works a scam. The extension solve some real issues for installing Pandas, Same for Numpy extension. You recommendations would leave user on Mac and Windows bewildered why Pandas would not work.

The question is: in this sense, does…

…do a worse job than your proposal?

Accepted, a smaller footprint of the extension is an advantage.
.
The remaining problem is: All authors of extensions will need to bring their own copy or some kind of test, if pip is available to be used “inside” LO, even when the new version matures beyond the stated alpha. One can not rely on this on other peoples devices.