Installing LibreOffice on Databricks

semsim
Contributor

Hi,

 

I need to install libreoffice to do a document conversion from .docx to .pdf. The requirement is no use of containers. Any idea on how I should go about this? 

Environment: Databricks 13.3 LTS

Thanks,

Sem

Yeshwanth
Databricks Employee
Databricks Employee

Hi @semsim Good day!

I just wanted to check if you have tried the following commands already.

%sh 
sudo apt-get install -y libreoffice
sudo apt-get install -y unoconv

 

Hi Yeshwanth,

Where would I run these commands? I tried running it in a notebook but it didn't solve the problem.

Thanks,

Sem

Hi @Yeshwanth ,

I've ran these commands and others at the notebook level. I have also ran the commands as an init script. Neither has worked so far. 

Here is what I am seeing when I run the commands:

semsim_0-1717778077489.png

and here is the error message I receive when I try to run the function that needs libreoffice:

semsim_1-1717778122286.png

 

Hey @Yeshwanth ,

Finally got it installed. Here is what worked for me:

%sh 
sudo apt update && sudo apt upgrade -y

%sh
sudo apt install libreoffice-common libreoffice-java-common libreoffice-writer openjdk-8-jre-headless -y

Thanks,

Sem

View solution in original post

furkan
Databricks Partner

Hi @semsim 

I'm attempting to install LibreOffice for converting DOCX files to PDF and tried running your shell commands from notebook. However, I encountered the 404 errors shown below. Do you have any suggestions on how to resolve this issue? I really appreciate any help.

Screenshot 2024-08-22 at 14.37.54.png

 

alevilla
New Contributor II

Hi @furkan ,

I had the same issue.

Fixed it running the following in the notebook:

%sh sudo add-apt-repository ppa:libreoffice/ppa
%sh sudo apt update && sudo apt-get -y dist-upgrade
%sh sudo apt install libreoffice-common libreoffice-java-common libreoffice-writer openjdk-8-jre-headless libreoffice-calc -y

 Hope it helps!