Skip to content

[Bug]: Can't use scottplot in verso notebook #91

Closed

Description

@oxygen-dioxide

Description

When using scottplot in verso, it throws The version of the native libSkiaSharp library (80.2) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [119.0, 120.0).

(This doesn't happen in c# console projects)

Steps to Reproduce

#r "nuget:ScottPlot, 5.1.59"
// create sample data
double[] dataX = new double[] { 1, 2, 3, 4, 5 };
double[] dataY = new double[] { 1, 4, 9, 16, 25 };

// plot the data
ScottPlot.Plot plt = new();
plt.Add.Scatter(dataX, dataY);

// display the plot
plt.SavePng("example.png", 400, 300);

Error Output

TypeInitializationException
System.TypeInitializationException: The type initializer for 'ScottPlot.Fonts' threw an exception.
  ---> System.TypeInitializationException: The type initializer for 'SkiaSharp.SKTypeface' threw an exception.
  ---> System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
  ---> System.InvalidOperationException: The version of the native libSkiaSharp library (80.2) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [119.0, 120.0).
   at ScottPlot.Fonts.get_DefaultFontStyle()
   at ScottPlot.LabelStyle..ctor()
   at ScottPlot.Plottables.Benchmark..ctor()
   at ScottPlot.Plot..ctor()
   at Submission#3.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at Verso.Kernels.ScriptStateManager.RunAsync(String code, Object globals, CancellationToken cancellationToken) in /home/runner/work/Verso/Verso/src/Verso/Kernels/ScriptStateManager.cs:line 39
   at Verso.Kernels.CSharpKernel.ExecuteAsync(String code, IExecutionContext context) in /home/runner/work/Verso/Verso/src/Verso/Kernels/CSharpKernel.cs:line 225

Component

C# Kernel

Frontend

VS Code

Verso Version

1.1.2

.NET Version

10.0.9

Operating System

Windows 11

Notebook Snippet

Loaded Extensions

No response

Severity

High - blocks a workflow, no reasonable workaround

Checklist

  • I searched existing issues and this hasn't been reported yet
  • I can reproduce this with no third-party extensions loaded

Activity

  1. added
    bug
    on Jul 30, 2026
  2. TorreyBetts commented on Jul 30, 2026

    @TorreyBetts
    Contributor

    Hi, thanks for using Verso. You can use ScottPlot like this:

    #r "nuget: ScottPlot, 5.0.36"
    
    using ScottPlot;
    
    double[] xs = Generate.Consecutive(51);
    double[] ys = Generate.Sin(51);
    double[] ys2 = Generate.Cos(51);
    
    var plt = new Plot();
    plt.Add.Scatter(xs, ys);
    plt.Add.Scatter(xs, ys2);
    plt.Title("ScottPlot Example: Sine and Cosine");
    plt.XLabel("X");
    plt.YLabel("Y");
    
    plt.GetImageHtml(600, 400).Display("text/html")
    Image

    If you're wanting to use their latest version it appears their API changed from the snippet I used above. Now it would look like this:

    Cell 1 (show a chart):

    #r "nuget: ScottPlot, 5.1.59"
    
    using ScottPlot;
    
    double[] xs = Generate.Consecutive(51);
    double[] ys = Generate.Sin(51);
    double[] ys2 = Generate.Cos(51);
    
    var plt = new Plot();
    plt.Add.Scatter(xs, ys);
    plt.Add.Scatter(xs, ys2);
    plt.Title("ScottPlot Example: Sine and Cosine");
    plt.XLabel("X");
    plt.YLabel("Y");
    
    plt.GetPngHtml(600, 400).Display("text/html")

    Cell 2 (save an image):

    string path = "scottplot_example.png";
    plt.SavePng(path, 600, 400);

    I'll close this issue, if you have any further questions about ScottPlot, reply here.

  3. oxygen-dioxide commented on Aug 2, 2026

    @oxygen-dioxide
    Author

    Your method doesn't work on my end. I'm still getting the same The version of the native libSkiaSharp library (80.2) is incompatible with this version of SkiaSharp. error with your code, on both .NET 8.0.28 and .NET 10.0.9, and both ScottPlot 5.0.36 and ScottPlot 5.1.59

  4. TorreyBetts commented on Aug 2, 2026

    @TorreyBetts
    Contributor

    Your method doesn't work on my end. I'm still getting the same The version of the native libSkiaSharp library (80.2) is incompatible with this version of SkiaSharp. error with your code, on both .NET 8.0.28 and .NET 10.0.9, and both ScottPlot 5.0.36 and ScottPlot 5.1.59

    Since I wasn't able to reproduce on my own, I fed it to AI and it was able to reproduce the scenario you experienced by starting with 5.0.36 and then later switching to 5.1.59. A fix has been committed and will be included in the next release.

  5. oxygen-dioxide commented on Aug 5, 2026

    @oxygen-dioxide
    Author

    I found out why I can't use scottplot: I have Akorin in my PATH, who has libSkiaSharp 80.2

  6. oxygen-dioxide commented on Aug 5, 2026

    @oxygen-dioxide
    Author

    even microsoft's polyglot noteobook has this bug, but it has never been found because you need to have a dll with the exactly same name but wrong version in your PATH (and who calls it has to be version sensitive) to face this bug

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions