python_libre_pythonista_ext icon indicating copy to clipboard operation
python_libre_pythonista_ext copied to clipboard

Fail installing python dependencies behind a proxy

Open clavay opened this issue 1 year ago • 6 comments

Hello,

I tried to install your extension behind a proxy. The proxy is configured in the LibreOffice Calc options.

It remains blocked during PIP installation for a few seconds, then the window disappears. After that, clicking on the LibrePy menu crashes LibreOffice Calc.

I don't know if the problem comes from the proxy. Do you know how to configure the proxy for the dependency installation process?

Thank you

clavay avatar Mar 10 '25 16:03 clavay

Thanks for reporting this. At this time there has not been any consideration to proxy settings.

If you could install the latest version of APSO. Version 1.4.2.7 or greater. You may have to open the extension manager and check for updates after installing to get the latest version.

The APSO extension also has a pip installer. I would like to know if you can install python packages using this with proxy setting turn on.

In the extension options for APSO turn on the pip package manager.

Image

Go to Tools -> Macros -> Organize Python Scripts and start the Package Manager. See if it is possible to install a python package such as verr

Image

Image

Amourspirit avatar Mar 17 '25 17:03 Amourspirit

I'm trying this on Windows 10.

It doesn't work using APSO. I had an error even if I configure the proxy in the OS or in LibreOffice.

But it works using the APSO python interpreter with these commands :

output = subprocess.check_output(["C:\\Program Files\\LibreOffice\\program\\python.exe", "C:\\Users\myuser\Downloads\get-pip.py",  "--user", "--no-warn-script-location", "--proxy=http://IP:PORT/"], stderr=subprocess.STDOUT, shell=True)
output = subprocess.check_output(["C:\\Program Files\\LibreOffice\\program\\python.exe", "-m",  "pip", "install", "verr", "--proxy=http://IP:PORT/"], stderr=subprocess.STDOUT, shell=True)

Do you know why clicking on the LibrePy menu crashes LibreOffice Calc if the pip installation didn't pass ?

clavay avatar Mar 18 '25 13:03 clavay

This is useful information. Thanks for your testing and sharing.

So It is possible to use proxy settings.

First I would have to add the ability to read the LibreOffice Proxy Setting to the installer, that is if the API supports it.

Next I need to update the the installer code to use the proxy if it supports it. I guess I would need a proxy to test against. I don't know right now if there is a way to mock this.

It will take a while to get this feature working. I have a backlog right now and there is only me.

Do you know why clicking on the LibrePy menu crashes LibreOffice Calc if the pip installation didn't pass ?

LibrePythonista depends on certain python dependencies to be installed. If the basics are not installed there will be errors. I will have to check to see if there is something I can do to prevent crashing in such cases.

Amourspirit avatar Mar 18 '25 15:03 Amourspirit

I added a feature request for this.

Amourspirit avatar Mar 18 '25 15:03 Amourspirit

I can give you more informations:

With the windows proxy set I have:

import urllib.request; print(urllib.request.getproxies())
{'http': 'http://IP:PORT', 'https': 'https://IP:PORT', 'ftp': 'ftp://IP:PORT'}

The problem comes from the https which should use http://IP:PORT (without the s). It is not possible to set a per protocol proxy in windows.

With the LibreOffice proxy set I have:

import urllib.request; print(urllib.request.getproxies())
{}

clavay avatar Mar 20 '25 11:03 clavay

With the LibreOffice proxy set I have:

import urllib.request; print(urllib.request.getproxies())
{}

That makes sense to me. The getproxies() method is not aware of the proxy setting that have been configured in LibreOffice. The LibreOffice proxy setting would have to be gotten from the LibreOffice API, that is if it supports it. I am guessing it does support it; However, I have found implementing such things from the API challenging and complex.

Amourspirit avatar Mar 20 '25 18:03 Amourspirit