Installing packages (e.g. Numpy) to LO python interpreter on MacOS

I need to write a python script that makes use of a lot of libraries that are not included in LO python, but I can’t get any packages installed.
I’m using LO 6.2.8 on MacOS High Sierra 10.13.6. I do have two existing python installations on my system. A python 2 installation and one with python 3.7. When searching for the topic there is usually suggested to use pip install, which I always used before to install packages to my existing python installations. “$ pip install” seems to aim at my python 2 and “$ pip3 install” to my python 3.7 installation. Executing those does not affect LO python installation.

I tried 2 methods to install packages to the LO python.

  1. Calling the LO python executable (with and without sudo) and using the pip module by:
    “$ sudo ./python -m pip install numpy”
  2. Using pip from the running LO python shell by:
    import pip
    pip.main([‘install’, ‘numpy’])

In both cases lumpy gets downloaded, but the installation always fails with:
“distutils.errors.DistutilsPlatformError: invalid Python installation: unable to open /Applications/LibreOffice.app/Contents/Frameworks/LibreOfficePython.framework/lib/python3.5/config-3.5m/Makefile (No such file or directory)”

The Makefile does exist in the directory though. Reinstalling LO did not help either. Any help would be highly appreciated.

I am develop an extension for admin PIP in LibreOffice. I can test in Linux and Windows, you can see a video.

I tested install numpy correctly. You can test install it and help me tested this extension in MAC.

Best regards

I followed your instruction in the video and installed your extension. When opening it, it tells me pip is not installed yet, same as in your video. When trying to use the install function it gives me an error. pip is downloaded, but the installation fails with the following error message:
File “/Applications/LibreOffice.app/Contents/Resources/…/Resources/…Frameworks/LibreOfficePython.framework/Versios/Current/lib/python3.5/site.py”, line 176
file=sys.stderr)

SyntaxError: invalid syntax

Thank, I’m going to try to get a MAC to debug this error.

Your LibreOffice, you installed from repositories of distribution or manually?

The difference into install from repositories and manually is like integrate the Python core. In the first, used Python in system, in the second used embedded Python. Under Linux, I assumed that LibreOffice always is install from repositories, in this case, the extension only is for facilited to user for installed other libraries.

If you want try install with embedded Python, always install with argument --user.

path_python get_pip.py --user

I review code and test in LinuxMint, other problem, in Mint, Py3 is python3, for that not detect, and fix and feedback.

I tested in LinuxMint 19.3 and LibreOffice 6.2 from repositories.

Important: Only develop version: https://gitlab.com/mauriciobaeza/zaz-pip/tree/develop/files

Tomorrow and test with LibreOffice and embedded Python

image description

I tested it on a real HD, installed Mint 19.3 x64 Cinnamon

$sudo apt install python3-venv python3-pip -y

$sudo add-apt-repository ppa:libreoffice/ppa
$sudo apt-get update
$sudo apt-get install libreoffice-script-provider-python -y

Installed the extension version ZAZPip_v0.4.0.oxt

https://gitlab.com/mauriciobaeza/zaz-pip/tree/develop/files

And that way it worked!

Thanks for your test… this weekend merge in master.

This post was flagged by the community and is temporarily hidden.