none
igraph png not working on SQL Server 2019 RRS feed

  • Question

  • Hi,

    I made some tests with Graph Databases and was trying to use R services do create an image file of the graph. I'm not an R specialist but I was able to write an R script to create the image, it works very well on SQL Server 2017.

    The R script:

    exec sp_execute_external_script @language = N'R', 
    @script = N'
    require(igraph)
    g <- graph.data.frame(graphdf)
    V(g)$label.cex <- 2
    png(filename = "c:/R/plot1.png", height = 1200, width = 1200, res = 100); 
    plot(g, vertex.label.family = "sans", vertex.size = 40)
    dev.off() ', 
    @input_data_1 = N'select LikeMember.MemberName as LikeMember,    LikedMember.MemberName as LikedMember         from dbo.ForumMembers as LikeMember,  dbo.ForumMembers as LikedMember,  Likes
            where Match(LikeMember-(Likes)->LikedMember)', 
    @input_data_1_name = N'graphdf'
    GO

    It works perfectly in SQL Server 2017 but I couldn't make it work in SQL Server 2019. The error message is:

    Error in png(filename = "c:/R/plot1.png", height = 1200, width = 1200,  : 
      unable to start png() device
    Calls: source -> withVisible -> eval -> eval -> png
    In addition: Warning messages:
    1: In png(filename = "c:/R/plot1.png", height = 1200, width = 1200,  :
      unable to open file 'c:/R/plot1.png' for writing
    2: In png(filename = "c:/R/plot1.png", height = 1200, width = 1200,  :
      opening device failed

    Error in execution.  Check the output for more information.
    Error in eval(ei, envir) : 
      Error in execution.  Check the output for more information.
    Calls: runScriptFile -> source -> withVisible -> eval -> eval -> .Call
    Execution halted

    Although the error message seems obvious, I already checked the permissions on the folder, the user of the services (SQL Server and Launchpad) and even used the audit over the folder but could not identify how to solve this problem.

    Any idea?

    Thank you!

    Dennes


    • Edited by Dennes Sunday, September 29, 2019 6:49 PM
    Sunday, September 29, 2019 6:49 PM

All replies