# Can't load library

**URL:** <https://discourse.processing.org/t/cant-load-library/23466>\
**Category:** Processing.py\
**Created:** [August 24, 2020, 12:06pm UTC](https://discourse.processing.org/t/cant-load-library/23466 "2020-08-24T12:06:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![H1rono\_K](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/h1rono_k/32/16945_2.png) [@H1rono\_K](https://discourse.processing.org/u/H1rono_K)\
**Post date:** [August 24, 2020, 12:06pm UTC](https://discourse.processing.org/t/cant-load-library/23466/1 "2020-08-24T12:06:04Z")

</div>

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](https://py.processing.org/tutorials/command-line/), I made a directory in `C:\Users\h1rono\Documents\` like this:

```auto
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](http://py.processing.org/processing.py-windows64.zip) (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:

```python
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:

```auto
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:

```auto
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`:

```auto
@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:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [August 24, 2020, 12:58pm UTC](https://discourse.processing.org/t/cant-load-library/23466/2 "2020-08-24T12:58:40Z")

</div>

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.

 ![pixelFlow](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/dd4aa860f7255ee544ddc70b0f7073c022096561.gif)

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [September 12, 2020, 9:22pm UTC](https://discourse.processing.org/t/cant-load-library/23466/3 "2020-09-12T21:22:03Z")

</div>

@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](https://github.com/jdf/processing-py-site/issues/176)

---

<div class="post-metadata">

**Author:** ![H1rono\_K](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/h1rono_k/32/16945_2.png) [@H1rono\_K](https://discourse.processing.org/u/H1rono_K)\
**Post date:** [September 13, 2020, 1:45am UTC](https://discourse.processing.org/t/cant-load-library/23466/4 "2020-09-13T01:45:11Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![syngola](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@syngola](https://discourse.processing.org/u/syngola)\
**Post date:** [May 11, 2021, 12:15pm UTC](https://discourse.processing.org/t/cant-load-library/23466/5 "2021-05-11T12:15:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [May 17, 2021, 6:32pm UTC](https://discourse.processing.org/t/cant-load-library/23466/6 "2021-05-17T18:32:33Z")

</div>

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()` ☹

---

<div class="post-metadata">

**Author:** ![Setsuna](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@Setsuna](https://discourse.processing.org/u/Setsuna)\
**Post date:** [January 5, 2022, 12:00pm UTC](https://discourse.processing.org/t/cant-load-library/23466/7 "2022-01-05T12:00:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yalaniv](https://avatars.discourse-cdn.com/v4/letter/y/7993a0/32.png) [@yalaniv](https://discourse.processing.org/u/yalaniv)\
**Post date:** [February 9, 2022, 5:11pm UTC](https://discourse.processing.org/t/cant-load-library/23466/8 "2022-02-09T17:11:53Z")

</div>

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
