Running moderngl (and glcontext) python library
Hello! I'm trying to get moderngl python library working on termux.
First of all, I encountered this issue during installation 
pip install moderngl
And fixed it with apt install xorgproto, after which it installed correctly 
Then I got an issue when running moderngl.create_context(standalone=True) which complained about lack of libGL.so, which I also fixed with apt install mesa
But now I get the following error, that I cannot solve
To clarify, the only thing I need moderngl library for is to attempt to compile GLSL shaders and check them for errors, via Context.program() and Context.compute_shader()Solution:Jump to solution
Ahh nvm, I'm an idiot. I had a typo 
env DISPLAY:=1 instead of env DISPLAY=:1
So the solution to installing and running moderngl (and glcontext) python library in termux is:
Install necessary packages
```sh...GitHub
GitHub - termux/termux-x11: Termux X11 add-on application.
Termux X11 add-on application. Contribute to termux/termux-x11 development by creating an account on GitHub.
9 Replies
pkg i libx11Already have that installed, didn't fix
CPPFLAGS="-I$PREFIX/include" CFLAGS="-I$PREFIX/include" pip install modernglDidn't fix. I uninstalled moderngl and glcontext libraries, cleared cache (
pip cache purge), then installed moderngl with your command, but it still shows the same issue with XOpenDisplay: cannot open displayyou need an X11 display
GitHub
GitHub - termux/termux-x11: Termux X11 add-on application.
Termux X11 add-on application. Contribute to termux/termux-x11 development by creating an account on GitHub.
Alright, so I had it for a second there, but then I cleared termux data to try & do it again, to make an exact step by step instructions, and now it no longer works. I've installed the following packages 
mesa xorgproto libx11 x11-repo termux-x11-nightly, installed latest apk, launched the server via termux-x11 :1 & and then run the python tool with env DISPLAY=:1 command prefix.
the same XOpenDisplay: cannot open display error
Ok, got it working again, when I ran it with termux-x11 :1 -xstartup "command goes here". Is there a way to fix it so that the server can run in the background while I can interactively run command directly in the shell? So basically the method that I've used in previous message.Solution
Ahh nvm, I'm an idiot. I had a typo 
env DISPLAY:=1 instead of env DISPLAY=:1
So the solution to installing and running moderngl (and glcontext) python library in termux is:
Install necessary packages
Install python library
Install companion app APK from https://github.com/termux/termux-x11
Launch X11 server
Launch python script with a DISPLAY=:1 prefix
GitHub
GitHub - termux/termux-x11: Termux X11 add-on application.
Termux X11 add-on application. Contribute to termux/termux-x11 development by creating an account on GitHub.
Ty for help!