Can't load library

Hi! This is my first topic in this forum, and I’m not English native speaker. So it may be difficult for you to understand what the problem is. But please help me.

I want to use Processing.py from command-line. Refer to this page, I made a directory in C:\Users\h1rono\Documents\ like this:

process-py
    |- libraries
    |   |- PixelFlow
    |       |- some files...
    |- processing-py.jar
    |- sketch.py

PixelFlow is a third party library of Processing, processing-py.jar is the .jar file in this zip file (please see the previous site) and sketch.py is the main file of a sketch. I installed PixelFlow in the Processing IDE, find the folder of PixelFlow, and moved it into process-py\libraries\. The content of sketch.py is:

add_library("PixelFlow")

def setup():
    size(400, 400, P2D) 
    global F,G
    F=DwFluid2D(DwPixelFlow(this), width, height, 1)
    G=createGraphics(width, height, P2D)

def draw():
    with G.beginDraw():
        G.background(255)
    F.addTemperature(mouseX, height-mouseY, 40, 1)
    F.update()
    F.renderFluidTextures(G, 1)
    image(G,0,0)

Then, I tried this command: java -jar processing-py.jar sketch.py, received the error:

C:\Users\h1rono\Documents\process-py> java -jar processing-py.jar sketch.py
java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\h1rono\Documents\process-py\natives\windows-i586\\gluegen-rt.dll

There is no such a file process-py\natives\windows-i586\\gluegen-rt.dll. What is wrong, and what should I do to resolve this problem?

note

I use VSCode of the latest version to write code and PowerShell to run commands. My Java version is:

C:\Users\h1rono\Documents\process-py> java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) Client VM (build 25.261-b12, mixed mode)

new information (26th Aug)

I found that the Java version must be 8u202, so I installed it. I wrote a batch file runner.bat in process-py:

@echo off
cd /d %~dp0
set PATH=C:\Program Files\Java\jdk1.8.0_202\bin;%PATH%
java -version
java -jar processing-py.jar sketch.py
exit 0

This script runs like this:

  1. @echo off: disable to output script contents.
  2. cd /d %~dp0: set current directory to the folder in which this script is.
  3. change the file that java command refers.
  4. output current Java version
  5. run sketch

I tried, received like this:

C:\Users\h1rono\Documents\process-py> .\runner.bat
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\h1rono\Documents\process-py\natives\windows-amd64\\gluegen-rt.dll
2 Likes

That is a great question @H1rono_K, let’s see if someone else who uses Python Mode outside the Processing IDE can help us.

I can confirm tha it works inside the Processing IDE.

1 Like

@H1rono_K – Does this error happen for you with any library import from the command line, or only with PixelFlow?

Thanks also for opening the issue: https://github.com/jdf/processing-py-site/issues/176

1 Like

@jeremydouglass I think some libraries causes the error, others don’t.

For example, I tried Sound. I installed it in the same way as PixelFlow, and placed the folder in process-py\libraries\. I wrote a code using Sound, it worked correctly.

And I tried some other libraries, but no one worked. I didn’t try any library from Processing Foundation except Sound. I guess they would work.

I had a similar problem when trying to use grafica in a class.

For some reason it works, when i import the library in the python style:

add_library(grafica)
import grafica as g

Then referring to all objects with g. and so on.

However, if i do that once and then delete the first line it works. If i close the sketch and reload it doesn’t. Looks like the library is only installed at runtime??

Strange.

1 Like

the add_library() is mandatory in Python mode, it replaces an import in Java mode (the sketch menu, add library, will add it to the code for you, the argument string name sometimes is different!).

It is unfortunate that my image example did not capture the add_library() line before setup() :frowning:

2 Likes

Hello, I hope it’s okay to reply to an old topic, but I have run into a similar problem and couldn’t find the solution anywhere.

When I tried to use P3D in command line, I received the same message about gluegen-rt.dll. The sketch also worked fine using the Processing IDE.

I managed to make it work by trial and error. When I moved the sketch to the python processing folder, it did work in command line. With the file processing-py-natives-windows-amd64.jar copied in the sketch folder in addition to processing-py.jar, it finally worked.

2 Likes

I have such problem with the gluegen-rt.dll, when I try to use P3D also,
but I don’t use python.
My problem occurs when I run it from the processing IDE,
and haven’t find solution till now