[Solved] Add Module in LibreOffice
[Solved] Add Module in LibreOffice
Good evening,
In python, I made a script which uses the beautifulsoup4 and requests modules.
These two modules are not present in libreoffice.
All my research on the internet did not come up with anything.
It's a shame because the script works fine when I run it from a python editor.
On the other hand, I will have wished
launch it from an LO Base form, especially since I import the result of the script into a table.
Is there a solution to add them to libreoffice?
Thank you in advance for your replies.
cordially
In python, I made a script which uses the beautifulsoup4 and requests modules.
These two modules are not present in libreoffice.
All my research on the internet did not come up with anything.
It's a shame because the script works fine when I run it from a python editor.
On the other hand, I will have wished
launch it from an LO Base form, especially since I import the result of the script into a table.
Is there a solution to add them to libreoffice?
Thank you in advance for your replies.
cordially
Last edited by El Catala on Sun Mar 21, 2021 10:02 am, edited 1 time in total.
LibreOffice 7.0.4 Xubuntu 20.4
Re: Add Module in LibreOffice
The LibreOffice your distro should use the same Python runtime with the same libs as the rest of your system. I would expect that this is not the case with flatpak or similar packages. Certainly, it is not the case with manually downloaded office suites. My LO 6.0 which was installed with Ubuntu 18.4. can import all the modules that are accessible through the system's python3 runtime. The other office suites come with their own python runtime because the office python needs to be compiled with the same compiler as the office itself. Somehow it might be possible to add libraries to these pythons.
P.S: https://help.libreoffice.org/latest/en- ... mport.html
P.S: https://help.libreoffice.org/latest/en- ... mport.html
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 318
- Joined: Sun Sep 06, 2020 8:27 am
Re: Add Module in LibreOffice
You may check what pythonpath your LibreOffice has set.
entered in the python-shell shows you wher th LO-Version searches for Modules.
You may then place beautifulsoup there.
I've read PIP is not recommended for embedded python ,
but you may try -target as an option.
J.
EDIT: Typos corrected (as I used my mobile phone...)
Code: Select all
import os
print(os.environ['PYTHONPATH'])
You may then place beautifulsoup there.
I've read PIP is not recommended for embedded python ,
but you may try -target as an option.
J.
EDIT: Typos corrected (as I used my mobile phone...)
Last edited by Mountaineer on Sat Mar 13, 2021 10:58 am, edited 1 time in total.
OpenOffice 3.1 on Windows Vista
Re: Add Module in LibreOffice
Hello, thank you for your answers.
Traveling until Thursday March 18, I can not be able to solve this problem before.
As soon as I get back, I look at this and will give you the result of your solutions.
Good day to all.
Traveling until Thursday March 18, I can not be able to solve this problem before.
As soon as I get back, I look at this and will give you the result of your solutions.
Good day to all.
LibreOffice 7.0.4 Xubuntu 20.4
Re: Add Module in LibreOffice
Good evening,
Travel income, I read your message.
The command:
returns:
On the other hand, the end of your text leaves me perplexed.
Actually, I don't know how to set the command to install the modules for example:
I get the following error message:
Could you tell me more?
cordially
Cordially
Travel income, I read your message.
The command:
Code: Select all
import os
print (os.environ['PYTHONPATH'])
Code: Select all
/opt/libreoffice7.0/program/../program/python-core-3.7.7/lib:/opt/libreoffice7.0/program/../program/python-core-3.7.7/lib/lib-dynload:/opt/libreoffice7.0/program/../program/python-core-3.7.7/lib/lib-tk:/opt/libreoffice7.0/program/../program/python-core-3.7.7/lib/site-packages:/opt/libreoffice7.0/program/../program
Actually, I don't know how to set the command to install the modules for example:
Code: Select all
sudo pip3 install requests /opt/libreoffice7.0/program/python-core-3.7.7/lib/site-packages/
Code: Select all
ERROR: Directory '/opt/libreoffice7.0/program/python-core-3.7.7/lib/site-packages/' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
Cordially
LibreOffice 7.0.4 Xubuntu 20.4
Re: Add Module in LibreOffice
I think it is a question for a Python forum.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Add Module in LibreOffice
Hello,
Eureka, I found it. Thanks to the command below, I was able to install the files necessary for the proper functioning of beautifulsoup4.
Thank you for your support which allowed me to solve this problem.
Cordially
Eureka, I found it. Thanks to the command below, I was able to install the files necessary for the proper functioning of beautifulsoup4.
Code: Select all
sudo cp -r /usr/lib/libreoffice/program/soupsieve-2.0.1.dist-info /opt/libreoffice7.0/program/python-core-3.7.7/lib
Cordially
LibreOffice 7.0.4 Xubuntu 20.4
Re: [Solved] Add Module in LibreOffice
Thank you very much for sharing your knowledge. Is soupsieve-2.0.1.dist-info a file or a directory? Would a symlink work as well?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved] Add Module in LibreOffice
Hello,
I also copied the two soupsiève directories.
Sorry, I should have made that clear.
Good night
I also copied the two soupsiève directories.
Sorry, I should have made that clear.
Good night
LibreOffice 7.0.4 Xubuntu 20.4