Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wxpython.py example for wxPython 4.0 (wxPhoenix) #348

Closed
cztomczak opened this issue Apr 18, 2017 · 8 comments
Closed

Update wxpython.py example for wxPython 4.0 (wxPhoenix) #348

cztomczak opened this issue Apr 18, 2017 · 8 comments
Labels
Milestone

Comments

@cztomczak
Copy link
Owner

Patch sent by Andrew Leech in this topic:
https://groups.google.com/d/topic/cefpython/2gvlnukJpJ0/discussion

I can't test it right now, because wxPython 4.0 installation fails, but the changes do work fine with old wxPython 2.8, so it can be commited safely.

cztomczak added a commit that referenced this issue Apr 18, 2017
Thanks to Andrew Leech for the patch.
@cztomczak
Copy link
Owner Author

Still TODO: Test it and add top comments on which configurations were tested.

@andrewleech
Copy link

For reference, my tested configuration is:
Windows 10 x64

Main packages installed with pip:
pip install -U --pre wxPython cefpython3

wxPython-4.0.0a1-cp35-cp35m-win32.whl
cefpython3-56.1-py2.py3-none-win32.whl

[wxpython.py] CEF Python 56.1
[wxpython.py] Python 3.5.2 32bit
[wxpython.py] wxPython 4.0.0a1 msw (phoenix)

@cztomczak
Copy link
Owner Author

cztomczak commented Apr 18, 2017

Additional fixes for wxPython 4.0 / 3.0 on Linux were applied in Issue #349. So it works fine now on Windows and Linux.

@andrewleech On the Forum you've said that you have some issues on Mac. I wonder if these issues are similar to Linux issues with handle and maybe a similar fix will work. It seems to me this might be the issue on Mac as well after finding this Phoenix issue: wxWidgets/Phoenix#37

NOTE on installing wxPython 4.0 on Linux:

I've tried installing wheel package for Python 3.5 on Linux, but it failed with error that it couldn't load "libpython3.5m.so" (there is no such file in pyenv installation of Python, only .a file I see). I ended up installing wheel package for system Python 3.4.

The error:

Traceback (most recent call last):
  File "wxpython.py", line 11, in <module>
    import wx
  File "/home/cz/.pyenv/versions/3.5.3/lib/python3.5/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/home/cz/.pyenv/versions/3.5.3/lib/python3.5/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

@andrewleech
Copy link

I've done some further testing on mac and those issues don't seem to matter.
I've found some workarounds to my issues, detailed here: https://groups.google.com/forum/#!topic/cefpython/tM8SXp_a_u0

@cztomczak
Copy link
Owner Author

Issue #350 fixed problems on Mac. So now it runs fine on all platforms. Closing.

@cztomczak
Copy link
Owner Author

Note on installing/running wxPython 4.0 on Mac:

I was able to run it with homebrew Python. When running with pyenv installation of Python I had this error:

[wxpython.py] CEF Python 56.1
[wxpython.py] Python 3.6.0 64bit
[wxpython.py] wxPython 4.0.0a1 osx-cocoa (phoenix)
This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.

@andrewleech
Copy link

Ah yes, I had this same issue with virtualenv
Basically virtualenv/pyvenv appears to be reall broken on macs with regard to apps that open a gui

Apparently it's a really common issue with gui python apps on osx which I couldn't find a clear consensus on how to resolve.
https://wiki.wxpython.org/wxPythonVirtualenvOnMac

Basically it wont run with the python wrapper execrable that's created by pyvenv in .venv/bin/python
It needs the real python exe

The simplest option I've found is to copy the real python exe into the virtualenv and set PYTHONHOME so it looks in the virtualenv folder for libs etc:

cp  /usr/local/bin/python3 .venv/bin/python
PYTHONHOME=$VIRTUAL_ENV python wxpython.py

Not sure if this breaks pip etc though, it may still reference system stuff for some things.

@cztomczak
Copy link
Owner Author

I have resolved issues with pyenv by building Pythons with --enable-shared option on Linux and --enable-framework option on Mac set via PYTHON_CONFIGURE_OPTS env variable. See here for explanation: wxWidgets/Phoenix#288 (comment)

@cztomczak cztomczak added this to the v56 milestone Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants