New Python Processing project: Py5

I’ve been experimenting with py5. It’s a creative coding framework for Python 3.8 and up – a Python version of Processing – and potentially a new engine for Python Mode in the Processing IDE. Internally, py5 employs Processing’s core libraries via JPype.

I spent the weekend experimenting with py5 coupled with Thonny (for an IDE/editor). If anybody is keen to know more, I wrote a post on this: https://tabreturn.github.io/code/python/thonny/2021/06/21/thonny_and_py5.html

8 Likes

I’ll definitely give this a go, it might be worth trying out with graal I found significant performance improvements with my ruby-processing projects. The big plus for me is ability to use numpy etc, which was available in pyprocessing but performance was not great.

For me setup was dead simple on my linux box

pip install py5

I then added ~/.local/bin to my path
Then I used vim to create the quick example and ran it from vim with

:!python3 %

. That was using the ibm jdk java-14. More fun to follow…

2 Likes

Hi! i want to try this version too, I’m running ubuntu 21.04 (i’m new into linux), and i only installed pip3 install py5. Running the test example with the command python3 test.py it gives me the following error


Is something related with the

Which version of Python are you using?
python3 --version

Hi! currently v.3.9.5

I’m on Mint (Ubuntu-based). Maybe try a different version of Java –

I created a new directory:

mkdir <directory name>
cd <directory name>

And within that a virtual environment for py5:

apt-get install python3.9-dev python3.9-venv 
python3.9 -m venv env
source env/bin/activate
pip install py5

python --version

Python 3.9.5

Then I downloaded and setup an alternative version of JDK:

wget https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz
tar -xzvf openjdk-11+28_linux-x64_bin.tar.gz
export JAVA_HOME=$PWD/jdk-11/

jdk-11/bin/java --version

openjdk 11 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

Made a quick sketch (the Quick Example), saved it in my new directory, and tested it (python quick_example.py)

Runs fine for me.

Thanks! i follow your steps and it worked just fine!. I want to collaborate in this project, but as you can see, I struggled to make this worked. Can you give an advice about my setup to work with the source code, and how I should approach this? And thanks again :slight_smile:

1 Like

From http://py5.ixora.io/help/

Right now, the most important thing I need is for people to try py5 and provide feedback.

– so, you can start with that right away! You can log issues and get involved in discussions on the project’s GitHub pages.

For help with py5 sketches, I think it’s okay to post questions here on discourse.processing.org. The admins can even set up a separate py5 category if things grow unwieldy (there’s already one for p5py).

Code Contributions

More from http://py5.ixora.io/help/

It would also be great if someone was willing to help write tutorials and example code. Right now, that area of the documentation is seriously lacking. I could also use help with the Windows and OSX specific GUI problems listed on Github. In particular, the Special Notes for Mac Users describes numerous problems with Mac computers. I do all of my development work on Linux and know very little about platform-specific GUI programming. All of the bugs I’d like help with are listed on Github with the help wanted tag.

To help out here, you’ll need to familiarise yourself with the workings of GitHub first:

- If you’re contributing to documentation, it’s this repo: https://github.com/hx2A/py5website
- For the py5 source, it’s this repo: https://github.com/hx2A/py5generator
- Build process - http://py5.ixora.io/tutorials/build-process/

I’m not familiar enough with the project’s source code to provide any further advice about modifying it.

On debian systems I generally use update-alternatives tool to control which jvm I’m using, and on Archlinux there’s archlinux-java, both super convenient when experimenting with different jvms. In fact I find update-alternatives super convenient in my ruby-processing projects for selecting different versions of jruby etc, mind you I never got on with rvm (favoured by many rubyists) which futzes with your system.

1 Like

Also works for me on RaspberryPI4 (ManjaroArm [64 bit]). However stock manjaroarm distribution python does not come with wheel, which is required for build.

sudo pip install wheel

Further you have to be super-patient if you’ve only got 4G ram, I presume that is something to do with pypy being a memory hog. The Quick Example runs fine from vim.

1 Like

Using the newton fractal sketch as a test java-16-openjdk actually slightly out performed java-11-graalvm though the difference was not significant.

hi @tabreturn , just for corrections: you should change the link to your post to :
this one

1 Like