How do I install pip in Libreoffice's embedded Python on Linux? Macro Python

asked 2020-01-02 15:24:11 +0100

mrkalvin gravatar image

updated 2020-01-02 16:47:19 +0100

How do I install pip in Libreoffice's embedded Python on Linux? I wanted to install the pylint package for use in VS Code and display the syntax errors, but I need the pip first.

If I open Module.py in VS Code using system python, the VSCode Explorer Outline tab is blank and pylint doesn't work in libreoffice macros. image description

If I open Module.py in VS Code using libreoffice's built-in python the VSCode Explorer Outline tab displays all the variables and functions of my macro, but I can't install the pip. image description

NOTE: If I open Module.py in VS Code using libreoffice's built-in python and then switch to system python the VSCode Explorer Outline tab displays the variables and functions and pylint works too!

==========

On Winsows 7 x64 I installed Libreoffice portable Version: 6.3.3.2 (x86) in the folder: C:\Portable\LibreOffice

Libreoffice's built-in python (v3.5.7) executable is: C:\Portable\LibreOffice\App\libreoffice\program\python.exe

I followed this statement: https://pip.pypa.io/en/stable/install...

On Windows I was able to install the pip through get-pip.py script: https://bootstrap.pypa.io/get-pip.py

I copied the get-pip.py file to the directory: C:\Portable\LibreOffice\App\libreoffice\program\

and ran the following command from the prompt [cmd.exe]: C:\Portable\LibreOffice\App\libreoffice\program\python.exe C:\Portable\LibreOffice\App\libreoffice\program\get-pip.py

ready he installed the pip and then installed pylint with this command: C:/Portable/LibreOffice/App/libreoffice/program/python.exe -m pip install -U pylint --user

My VS Code setup on Windows - 'settings.json':

{
  "workbench.colorTheme": "Default Light+",
  "workbench.startupEditor": "newUntitledFile",
  "files.encoding": "windows1252",
  "editor.wordWrap": "on",
  "workbench.colorCustomizations": {
    "terminal.ansiBrightBlue": "#729FCF",
    "terminal.ansiBrightGreen": "#8AE234",
    "terminal.background": "#000000",
    "terminal.foreground": "#D3D7CF",
    "terminal.selectionBackground": "#5cd6933b"
  },
  "workbench.iconTheme": "vscode-icons",
  "python.dataScience.sendSelectionToInteractiveWindow": true,
  "python.linting.enabled": true,
  "python.pythonPath": "C:\\Portable\\LibreOffice\\App\\libreoffice\\program\\python.exe",
  //"python.pythonPath": "C:\\Portable\\LibreOffice\\App\\libreoffice\\program\\python.exe",
  //"python.pythonPath": "C:\\Portable\\Pyhton-3.8.0\\App\\Python\\python.exe",
  //"python.pythonPath": "C:\\Portable\\Pyhton-2.7.17\\App\\Python\\python.exe",
  "editor.formatOnSave": true
}

===========

I tried to use the same logic on Linux, but was unsuccessful: Linux Mint 19.3 x64 Cinnamon, Libreoffice Version: 6.3.3.2 Note: I have the build-essential package installed: $ sudo apt-get install build-essential

It would be normal to install pip through this command on linux: $ sudo apt install python3-venv python3-pip

however it installs the pip in system python not Libreoffice's built-in python.

So I decided to do the same as in Windows:

Libreoffice's built-in python (v3.5.7) executable is: /opt/libreoffice6.3/program/python

I copied the get-pip.py file to the directory: /opt/libreoffice6.3/program/

and ran the following command on gnome-terminal:

$ sudo su

$ /opt/libreoffice6.3/program/python /opt/libreoffice6.3/program/get-pip.py

and it returns the following error:


Collecting pip
  Using cached https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2 ...
(more)
edit retag flag offensive close merge delete