Current status of GUI support in PyPy
After a casual bit of googling I'm not sure what is the current status of GUI support in PyPy. Does tkinter work with PyPy yet (It doesn't in the version I have installed here)? Is there any other GUI that you recommend? I'm looking to make a Python-based physics simulator that should be able to show animations in some kind of GUI. I would like to have some kind of web-based format as one output of this (so that results can be shown on the web) but I'm not sure how good that would be for interactive simulation. The physics calculations require that I need to use either PyPy or Cython or something (not plain CPython) to get reasonable performance. One possibility is that I could run PyPy in a subprocess from a CPython-based GUI which I guess is not dissimilar to getting it to work in the browser except I get to write the front-end in Python. -- Oscar
Hi Oscar, On Wed, Dec 16, 2015 at 1:39 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
Does tkinter work with PyPy yet (It doesn't in the version I have installed here)?
It should work. Did you install a recent official release, or compile it yourself? In the latter case, do you have the "tk-dev" headers installed on your machine? If you get an obscure crash, please open a bug report. :-) A bientôt, Armin.
On 16 December 2015 at 12:45, Armin Rigo <arigo@tunes.org> wrote:
On Wed, Dec 16, 2015 at 1:39 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
Does tkinter work with PyPy yet (It doesn't in the version I have installed here)?
It should work. Did you install a recent official release, or compile it yourself? In the latter case, do you have the "tk-dev" headers installed on your machine? If you get an obscure crash, please open a bug report. :-)
Thanks Armin. I guess I just don't have a recent enough version. This machine is running Ubuntu 12.04 and I have PyPy from the repos: $ pypy Python 2.7.2 (1.8+dfsg-2, Feb 19 2012, 19:18:08) [PyPy 1.8.0 with GCC 4.6.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: ``pypy is a race between the industry trying to build machines with more and more resources, and the pypy developers trying to eat all of them. So far, the winner is still unclear''
import Tkinter Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/lib/pypy/lib-python/2.7/lib-tk/Tkinter.py", line 39, in <module> import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter
I'll try installing a newer version... Looking here there seems to be binaries built for 12.04-14.04: http://pypy.org/download.html This one import tkinter without error: https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux64.tar.bz2 $ bin/pypy3 Python 3.2.5 (b2091e973da6, Oct 19 2014, 18:29:55) [PyPy 2.4.0 with GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import Tkinter Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named Tkinter import tkinter # correct Py3 module name
import Tkinter Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/users/enojb/src/pypy-4.0.1-linux64/lib-python/2.7/lib-tk/Tkinter.py",
This one does not: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux64.tar.bz2 $ bin/pypy Python 2.7.10 (5f8302b8bf9f, Nov 18 2015, 10:46:46) [PyPy 4.0.1 with GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. line 39, in <module> import _tkinter # If this fails your Python may not be configured for Tk File "/users/enojb/src/pypy-4.0.1-linux64/lib_pypy/_tkinter/__init__.py", line 13, in <module> from .tklib_cffi import ffi as tkffi, lib as tklib ImportError: unable to load extension module '/users/enojb/src/pypy-4.0.1-linux64/lib_pypy/_tkinter/tklib_cffi.pypy-26.so': libtcl8.5.so: cannot open shared object file: No such file or directory Is that an obscure crash? -- Oscar
Hi Oscar, On Wed, Dec 16, 2015 at 2:05 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
libtcl8.5.so: cannot open shared object file: No such file or directory
Is that an obscure crash?
Sadly not. It just means it was compiled for libtcl8.5.so, and your machine has a different version installed. You can recompile it simply by running: cd /users/enojb/src/pypy-4.0.1-linux64/lib_pypy/_tkinter/ ../../bin/pypy tklib_build.py A bientôt, Armin.
On 16 December 2015 at 14:43, Armin Rigo <arigo@tunes.org> wrote:
On Wed, Dec 16, 2015 at 2:05 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
libtcl8.5.so: cannot open shared object file: No such file or directory
Is that an obscure crash?
Sadly not. It just means it was compiled for libtcl8.5.so, and your machine has a different version installed.
I'm not sure about that: enojb@it054759:~$ ls /usr/lib/libtcl* /usr/lib/libtcl8.5.so.0 enojb@it054759:~$ ls /usr/lib/libtk* /usr/lib/libtk8.5.so.0 Maybe it's just missing the symlink from libtcl8.5.so -> libtcl8.5.so.0. I'm not sure why it would be setup like that.
You can recompile it simply by running:
cd /users/enojb/src/pypy-4.0.1-linux64/lib_pypy/_tkinter/ ../../bin/pypy tklib_build.py
The above gave me an error about "tk.h" so I installed tk8.5-dev. I recompiled tkinter and can now import Tkinter without error. Afterwards I noticed that installing tk8.5-dev gave me this: enojb@it054759:~$ ls /usr/lib/libtk* /usr/lib/libtk8.5.a /usr/lib/libtk8.5.so /usr/lib/libtk8.5.so.0 /usr/lib/libtkstub8.5.a enojb@it054759:~$ ls /usr/lib/libtcl* /usr/lib/libtcl8.5.a /usr/lib/libtcl8.5.so /usr/lib/libtcl8.5.so.0 /usr/lib/libtclstub8.5.a -- Oscar
Hi Oscar, On Thu, Dec 17, 2015 at 3:33 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
Maybe it's just missing the symlink from libtcl8.5.so -> libtcl8.5.so.0. I'm not sure why it would be setup like that.
Yes. I mostly gave up understanding the differences in binary distributions in Linux. It just turns out that on the particular distribution where this pypy was built, it's called "libtcl8.5.so". Maybe it is indeed just a symlink to "libtcl8.5.so.0", and so if we put "libtcl8.5.so.0" in the "_tklib_cffi.so" then everybody would be happy. However I have no clue how to do that in the .so without tons of non-portable tricks. gcc is invoked with "-ltcl", and figures out at compilation time that it means "link with libtcl8.5.so". A bientôt, Armin.
On 17 December 2015 at 15:00, Armin Rigo <arigo@tunes.org> wrote:
On Thu, Dec 17, 2015 at 3:33 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
Maybe it's just missing the symlink from libtcl8.5.so -> libtcl8.5.so.0. I'm not sure why it would be setup like that.
Yes. I mostly gave up understanding the differences in binary distributions in Linux. It just turns out that on the particular distribution where this pypy was built, it's called "libtcl8.5.so". Maybe it is indeed just a symlink to "libtcl8.5.so.0", and so if we put "libtcl8.5.so.0" in the "_tklib_cffi.so" then everybody would be happy. However I have no clue how to do that in the .so without tons of non-portable tricks. gcc is invoked with "-ltcl", and figures out at compilation time that it means "link with libtcl8.5.so".
I just tested and re-downloading it works out of the box without any need to recompile. Perhaps an easier solution is just to mention that tk8.5-dev may be needed as a dependency for those binaries. -- Oscar
Hi Armin, hi Oscar, I think that the mystery lies in the packaging differences between Ubuntu 12.04 and Ubuntu 14.04 releases: root@1204:/# readelf -d /usr/lib/libtk8.5.so.0 | grep tk 0x000000000000000e (SONAME) Library soname: [libtk8.5.so.0] root@1404:/# readelf -d /usr/lib/x86_64-linux-gnu/libtk8.5.so | grep tk 0x000000000000000e (SONAME) Library soname: [libtk8.5.so] On Ubuntu 12.04 they split libtk8.5.so.0 and libtk8.5.so, and the latter is only shipped in the tk8.5-dev package, whereas on Ubuntu 14.04 they ship libtk8.5.so.0 and libtk8.5.so together in libtk-8.5 package. So, to run a binary compiled on Ubuntu 14.04 on Ubuntu 12.04, you do, indeed, need to install tk8.5-dev to get the libtk8.5.so symlink, that is, unfortunately, backwards compatibility hasn't been preserved in this case, which you have just witnessed... However, a binary compiled on Ubuntu 12.04 should still "just work" on Ubuntu 14.04 (at least in as far as TK is concerned). The reasons why they changed the SONAME are not clear to me, but it might be that they decided to ditch the major number, because TK encodes it in the library name anyways, and left the symlink for forwards compatibility. -- Sincerely yours, Yury V. Zaytsev On Thu, 17 Dec 2015, Oscar Benjamin wrote:
On 17 December 2015 at 15:00, Armin Rigo <arigo@tunes.org> wrote:
On Thu, Dec 17, 2015 at 3:33 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
Maybe it's just missing the symlink from libtcl8.5.so -> libtcl8.5.so.0. I'm not sure why it would be setup like that.
Yes. I mostly gave up understanding the differences in binary distributions in Linux. It just turns out that on the particular distribution where this pypy was built, it's called "libtcl8.5.so". Maybe it is indeed just a symlink to "libtcl8.5.so.0", and so if we put "libtcl8.5.so.0" in the "_tklib_cffi.so" then everybody would be happy. However I have no clue how to do that in the .so without tons of non-portable tricks. gcc is invoked with "-ltcl", and figures out at compilation time that it means "link with libtcl8.5.so".
I just tested and re-downloading it works out of the box without any need to recompile. Perhaps an easier solution is just to mention that tk8.5-dev may be needed as a dependency for those binaries.
-- Oscar _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
On December 16, 2015 7:05:43 AM CST, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
On 16 December 2015 at 12:45, Armin Rigo <arigo@tunes.org> wrote:
On Wed, Dec 16, 2015 at 1:39 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
Does tkinter work with PyPy yet (It doesn't in the version I have installed here)?
It should work. Did you install a recent official release, or
compile
it yourself? In the latter case, do you have the "tk-dev" headers installed on your machine? If you get an obscure crash, please open a bug report. :-)
Thanks Armin. I guess I just don't have a recent enough version. This machine is running Ubuntu 12.04 and I have PyPy from the repos:
$ pypy Python 2.7.2 (1.8+dfsg-2, Feb 19 2012, 19:18:08) [PyPy 1.8.0 with GCC 4.6.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: ``pypy is a race between the industry trying to build machines with more and more resources, and the pypy developers trying to eat all of them. So far, the winner is still unclear''
import Tkinter Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/lib/pypy/lib-python/2.7/lib-tk/Tkinter.py", line 39, in <module> import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter
I'll try installing a newer version...
The version Ubuntu 12.04 comes with is pretty old. PyPy 2.0 is WAY better. I like Ubuntu, but I hate how packages can go out of date so easily.
Looking here there seems to be binaries built for 12.04-14.04: http://pypy.org/download.html
This one import tkinter without error: https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux64.tar.bz2
$ bin/pypy3 Python 3.2.5 (b2091e973da6, Oct 19 2014, 18:29:55) [PyPy 2.4.0 with GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import Tkinter Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named Tkinter import tkinter # correct Py3 module name
This one does not: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux64.tar.bz2
import Tkinter Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/users/enojb/src/pypy-4.0.1-linux64/lib-python/2.7/lib-tk/Tkinter.py",
$ bin/pypy Python 2.7.10 (5f8302b8bf9f, Nov 18 2015, 10:46:46) [PyPy 4.0.1 with GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. line 39, in <module> import _tkinter # If this fails your Python may not be configured for Tk File "/users/enojb/src/pypy-4.0.1-linux64/lib_pypy/_tkinter/__init__.py", line 13, in <module> from .tklib_cffi import ffi as tkffi, lib as tklib ImportError: unable to load extension module '/users/enojb/src/pypy-4.0.1-linux64/lib_pypy/_tkinter/tklib_cffi.pypy-26.so': libtcl8.5.so: cannot open shared object file: No such file or directory
Is that an obscure crash?
-- Oscar _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.
On 16 December 2015 at 15:46, Ryan Gonzalez <rymg19@gmail.com> wrote:
The version Ubuntu 12.04 comes with is pretty old. PyPy 2.0 is WAY better.
I like Ubuntu, but I hate how packages can go out of date so easily.
To be fair I should just update my Ubuntu version. I don't use 12.04 at home but the situation with IT here means that updating my OS is not as simple as it should be. -- Oscar
On 16 December 2015 at 12:45, Armin Rigo <arigo@tunes.org> wrote:
If you get an obscure crash, please open a bug report. :-)
I found a bug with PyPy 3.2.5 (2.4.0). The offending code looks like: s = s.encode('utf-8') if '\x00' in s: # <- This line guaranteed to raise on Py3 raise TypeError It seems to have already been fixed on the py3k branch so I'm not sure if it needs reporting: https://bitbucket.org/pypy/pypy/src/6da866a9e7d54a016c8b554fdb961b56de7ac2da/lib_pypy/_tkinter/app.py?at=py3k&fileviewer=file-view-default#app.py-446 Is that the right branch? -- Oscar
Hi Oscar, On Fri, Dec 18, 2015 at 1:56 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
It seems to have already been fixed on the py3k branch so I'm not sure if it needs reporting:
We usually look at the py3.3 branch, which is for Python 3.3 compatibility; if it's also fixed there then there is nothing more to report. A bientôt, Armin.
On 19 December 2015 at 08:24, Armin Rigo <arigo@tunes.org> wrote:
On Fri, Dec 18, 2015 at 1:56 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
It seems to have already been fixed on the py3k branch so I'm not sure if it needs reporting:
We usually look at the py3.3 branch, which is for Python 3.3 compatibility; if it's also fixed there then there is nothing more to report.
Finally found time to check this. It's fixed on py3k and py3.3 so nothing to report. -- Oscar
Best GUI for every language these days is HTML5. Use PyPy as backend process , and use HTML5 as UI. Check out Electron .http://electron.atom.io/ HTML5 Desktop UI that powers Atom editor. On Wed, Dec 16, 2015 at 7:09 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
After a casual bit of googling I'm not sure what is the current status of GUI support in PyPy. Does tkinter work with PyPy yet (It doesn't in the version I have installed here)? Is there any other GUI that you recommend?
I'm looking to make a Python-based physics simulator that should be able to show animations in some kind of GUI. I would like to have some kind of web-based format as one output of this (so that results can be shown on the web) but I'm not sure how good that would be for interactive simulation. The physics calculations require that I need to use either PyPy or Cython or something (not plain CPython) to get reasonable performance.
One possibility is that I could run PyPy in a subprocess from a CPython-based GUI which I guess is not dissimilar to getting it to work in the browser except I get to write the front-end in Python.
-- Oscar _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
I find HTML5 overkill if you're not using JS... On December 18, 2015 7:52:40 AM CST, Phyo Arkar <phyo.arkarlwin@gmail.com> wrote:
Best GUI for every language these days is HTML5.
Use PyPy as backend process , and use HTML5 as UI.
Check out Electron .http://electron.atom.io/ HTML5 Desktop UI that powers Atom editor.
On Wed, Dec 16, 2015 at 7:09 PM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
After a casual bit of googling I'm not sure what is the current status of GUI support in PyPy. Does tkinter work with PyPy yet (It doesn't in the version I have installed here)? Is there any other GUI that you recommend?
I'm looking to make a Python-based physics simulator that should be able to show animations in some kind of GUI. I would like to have some kind of web-based format as one output of this (so that results can be shown on the web) but I'm not sure how good that would be for interactive simulation. The physics calculations require that I need to use either PyPy or Cython or something (not plain CPython) to get reasonable performance.
One possibility is that I could run PyPy in a subprocess from a CPython-based GUI which I guess is not dissimilar to getting it to work in the browser except I get to write the front-end in Python.
-- Oscar _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
------------------------------------------------------------------------
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.
Rapydscript is pure pythonic javascript. HTML5 + http://www.pyjeon.com/rapydscript On Fri, Dec 18, 2015 at 10:55 PM, Ryan Gonzalez <rymg19@gmail.com> wrote:
I find HTML5 overkill if you're not using JS...
On December 18, 2015 7:52:40 AM CST, Phyo Arkar <phyo.arkarlwin@gmail.com> wrote:
Best GUI for every language these days is HTML5.
Use PyPy as backend process , and use HTML5 as UI.
Check out Electron .http://electron.atom.io/ HTML5 Desktop UI that powers Atom editor.
On Wed, Dec 16, 2015 at 7:09 PM, Oscar Benjamin < oscar.j.benjamin@gmail.com> wrote:
After a casual bit of googling I'm not sure what is the current status of GUI support in PyPy. Does tkinter work with PyPy yet (It doesn't in the version I have installed here)? Is there any other GUI that you recommend?
I'm looking to make a Python-based physics simulator that should be able to show animations in some kind of GUI. I would like to have some kind of web-based format as one output of this (so that results can be shown on the web) but I'm not sure how good that would be for interactive simulation. The physics calculations require that I need to use either PyPy or Cython or something (not plain CPython) to get reasonable performance.
One possibility is that I could run PyPy in a subprocess from a CPython-based GUI which I guess is not dissimilar to getting it to work in the browser except I get to write the front-end in Python.
-- Oscar _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
------------------------------
pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.
participants (5)
-
Armin Rigo
-
Oscar Benjamin
-
Phyo Arkar
-
Ryan Gonzalez
-
Yury V. Zaytsev