Skip to content

what are the required shared libraries in a linux container? #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jaguarxii opened this issue Jul 11, 2022 · 9 comments
Closed

what are the required shared libraries in a linux container? #324

jaguarxii opened this issue Jul 11, 2022 · 9 comments

Comments

@jaguarxii
Copy link

Description

I have deployed a webapp to azure using plotly.net but it throws several errors of missing shared libraries.
The webapp works perfectly on the development environment (windows 10).

Repro steps

Perhaps I am doing something wrong it is the first time I am using this library, this is the code I am using:

`*
Layout newChartLayout = Layout.init(
Title: Title.init(Text: "Visitas (cantidad de visitas)"),
BarMode: BarMode.Stack,
UniformText: UniformText.init(Mode: UniformTextMode.Show, MinSize: 6),
PaperBGColor: Color.fromARGB(0, 0, 0, 0),
PlotBGColor: Color.fromARGB(0, 0, 0, 0),
Font: Font.init(Family:FontFamily.Consolas, Color:Color.fromRGB(255,0,0))
//Font: Font.init(Family:FontFamily.NewCustom("Nunito"))
);

                LinearAxis newXAxis = LinearAxis.init<IConvertible, IConvertible, IConvertible, IConvertible, IConvertible, IConvertible>(
                    Title: Title.init(Text: "Fecha (Mes Dia - Hora)"),
                    ShowGrid: true,
                    TickFont: Font.init(Family:FontFamily.Consolas, Color:Color.fromRGB(255,0,0))
                );

                LinearAxis newYAxis = LinearAxis.init<IConvertible, IConvertible, IConvertible, IConvertible, IConvertible, IConvertible>(
                    Title: Title.init(Text: "Cantidad"),
                    ShowGrid: true,
                    AutoMargin: true,
                    DTick: 1,
                    TickFont: Font.init(Family:FontFamily.Consolas, Color:Color.fromRGB(255,0,0))
                );

                int[] xData = new int[] { 320, 170, 17, 9, 6, 1 };
                string[] yLabels = new string[] { "GIMNASIO", "PISCINA", "BBQ TERRAZA", "BUSINESS CENTER", "SALA DE JUEGOS", "EDIFICIO CARAVAGGIO" };

                var newChart = Chart2D.Chart.Bar<int, string, int, int, int>(
                    values: xData,
                    Keys: yLabels, 
                    Name: "Area")
                .WithLayout(newChartLayout)
                .WithXAxis(newXAxis)
                .WithYAxis(newYAxis);

                svgChart = newChart.ToSVGString(Plotly.NET.ImageExport.ExportEngine.PuppeteerSharp, 600, 300);

*`

Expected behavior

Get SVG string to embed into a pdf report

Actual behavior

It crashes, so far I have installed these libraries in the production enviroment:
libnss3
libatk1.0-0
libatk-bridge2.0-0
cups

Error messages like these are thown

`*
PuppeteerSharp.ProcessException: Failed to launch browser! /home/site/wwwroot/.local-chromium/Linux-884014/chrome-linux/chrome: error while loading shared libraries: libxkbcommon.so.0: cannot open shared object file: No such file or directory

at PuppeteerSharp.States.ChromiumStartingState.StartCoreAsync(LauncherBase p) in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\States\ChromiumStartingState.cs:line 83
at PuppeteerSharp.States.ChromiumStartingState.StartCoreAsync(LauncherBase p) in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\States\ChromiumStartingState.cs:line 89
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\Launcher.cs:line 68
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\Launcher.cs:line 91 | Stack: .lambda_method530 => ReportController.ballotResult => ReportService.getBallotResult
*`

Related information

  • Operating system: Linux 5a5597962fdd 4.15.0-169-generic x86_64
  • Branch:
    "Plotly.NET" Version="3.0.0"
    "Plotly.NET.ImageExport" Version="3.0.0"
  • .NET Runtime: ASP .NETCore Version: 6.0.3
@kMutagene
Copy link
Collaborator

kMutagene commented Jul 11, 2022

Possibly related: #319 , #323

@kMutagene
Copy link
Collaborator

For running Puppeteersharp (the lib used internally for image export) on linux, here are some links for prerequisites and troubleshooting: https://github.com/hardkoded/puppeteer-sharp#prerequisites

@kMutagene
Copy link
Collaborator

In your case, it might just be missing X-server (which is something most likely not included in a minimal linux container)

@jaguarxii
Copy link
Author

I think I got to a dead end, after following the prerequisites, this error is thrown:

Running as root without --no-sandbox is not supported. See https://crbug.com/638180

@kMutagene
Copy link
Collaborator

You can set that on the PuppeteerSharp launch options object:

using Plotly.NET;
using Plotly.NET.ImageExport;

PuppeteerSharpRendererOptions.launchOptions.Args = new string [] {"--no-sandbox"};

@kMutagene
Copy link
Collaborator

see also hardkoded/puppeteer-sharp#1211

@WhiteBlackGoose
Copy link
Contributor

WhiteBlackGoose commented Jul 11, 2022

We bumped the version of Puppeteer Sharp recently. Try using the prerelease version too.

dotnet new nugetconfig
dotnet nuget add source https://www.myget.org/F/plotly-net-nightly/api/v3/index.json
dotnet add package Plotly.NET.ImageExport --prerelease

@UncleUgl
Copy link

You can try to install extra dependencies. For me worked.

sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev

@jaguarxii
Copy link
Author

I gave up, found another library to chart from the server side by running an external js file (nodejs).
Works pretty well so far, thanks for your comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants