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

Multiple install issues when using pyenv on Linux/Mac #288

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

Multiple install issues when using pyenv on Linux/Mac #288

cztomczak opened this issue Apr 18, 2017 · 6 comments

Comments

@cztomczak
Copy link

cztomczak commented Apr 18, 2017

I am having multiple issues installing Phoenix when using pyenv Python installations. pyenv is a simple Python version management: https://github.com/pyenv/pyenv

Issue 1 / 3 (Linux)

This error when running pip install wxPython on Ubuntu 14.04:

The configuration failed
    (complete log in /tmp/pip-build-j042bsx8/wxPython/build/waf/3.6/config.log)
    Command '"/home/cz/.pyenv/versions/3.6.0/bin/python3.6" /tmp/pip-build-j042bsx8/wxPython/bin/waf-1.7.15-p1 --wx_config=/tmp/pip-build-j042bsx8/wxPython/build/wxbld/wx-config --python="/home/cz/.pyenv/versions/3.6.0/bin/python3.6" --out=build/waf/3.6 configure build ' failed with exit code 1.
    Finished command: build_py (0m1.222s)
    Finished command: build (0m1.852s)
    Command '"/home/cz/.pyenv/versions/3.6.0/bin/python3.6" -u build.py build' failed with exit code 1.

OS: Ubuntu 14.04 64-bit
wxPython 4.0.0a1 gtk2 (phoenix)

Issue 2 / 3 (Linux)

Since online pip install failed, I've downloaded wheel package from here:
https://wxpython.org/Phoenix/snapshot-builds/linux/

It installed fine, but got an error when importing wx package:

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

In ~/.pyenv/versions/3.5.3/ there is no such file, I have only found "libpython3.5m.a" (in /home/cz/.pyenv/versions/3.5.3/lib/ directory).

OS: Ubuntu 14.04 64-bit
wxPython 4.0.0a1 gtk2 (phoenix)

Issue 3 / 3 (Mac)

Ran pip install wxPython, it installed fine, but got error when running:

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.

OS: 10.9 Mavericks
wxPython 4.0.0a1 osx-cocoa (phoenix)
Python 3.6.0 64bit


I ended up installing Phoenix using system / homebrew Pythons - no problems then. Only with pyenv.

@RobinD42
Copy link
Member

RobinD42 commented Apr 18, 2017

I had a discussion elsewhere regarding pyenv issues. Unfortunately I don't remember details and can't find that conversation now, but maybe enough of

  1. Please attach the log file it mentioned, although I think it may be the same issue as 2.

  2. Python on Linux can be built to produce a shared library or a static library of the Python core, and every linux distro I know of goes the shared library route, and that is the assumption that wxPython's build (the waf tool actually) makes. Pyenv apparently went the static library route, which is okay for many things, but I think it would cause trouble with something complex like wxPython (and all the other extension modules that may be loaded at the same time). In theory, you could end up with multiple copies of the Python runtime in memory. Check to see if pyenv has an option for building its pythons with the python shared library instead of the static lib, or if it lets you control what flags are passed to Python's configure command then you can probably override it there.

  3. There are two factors at play here. First OSX does not let plain/simple unix programs have direct access to the screen by default. They have to be restructured into a framework or application bundle so there is metadata associated with the application and etc. The next factor is that again Python can be built in two main modes on OSX, plain unix or plain unix plus a framework version. Python 3 releases from the last few years have made it so the distinction between the two is hidden from the user and you don't have to worry about it, you always get a framework version running if you need it. It looks like pyenv is not supporting that kind of build. Check to see if there is a pythonw executable in the environment. If they are doing the split build then that may be the framework version you need to run. If not then you may need to alter how those python environments are built and override the configure command line options if pyenv doesn't give you options to do it itself.

@williamgibb
Copy link

See the pyenv wiki if you need to build python installations w/ shared or framework builds https://github.com/pyenv/pyenv/wiki

Testing a virtualenv made from a 3.5.3 installation on OSX with the --enable-framework & wxPython 4.0.0a1 allowed me to run a simple hello world test.

@cztomczak
Copy link
Author

cztomczak commented Apr 18, 2017

Thank you @RobinD42 for the detailed explanation. You were right and Linux issues (but not all, read later) were resolved by building Python with shared library option. On Mac issues were resolved by building Python with framework option. Thanks @williamgibb for the wiki link.

I can build successfully using wheel packages, however it still fails when installing with pip install wxPython on Linux, but this time with yet another error. There is no config.log, only errors in console when building wxWebView:

    [608/851] cxx: sip/cpp/sip_html2wxWebViewArchiveHandler.cpp -> build/waf/3.6/sip/cpp/sip_html2wxWebViewArchiveHandler.cpp.17.o
    [609/851] cxx: sip/cpp/sip_html2wxWebViewEvent.cpp -> build/waf/3.6/sip/cpp/sip_html2wxWebViewEvent.cpp.17.o
    ../../../sip/cpp/sip_html2wxWebView.cpp:49:45: error: ‘wxWebView’ was not declared in this scope
         PyObject* _wxWebView_GetBackwardHistory(wxWebView* self)
                                                 ^
    ../../../sip/cpp/sip_html2wxWebView.cpp:49:56: error: ‘self’ was not declared in this scope
         PyObject* _wxWebView_GetBackwardHistory(wxWebView* self)

Attaching complete logs from the console: install-error.log.tar.gz (47 KB)
install-error.log.tar.gz

@RobinD42
Copy link
Member

RobinD42 commented Apr 18, 2017

This is due to the webkitgtk development files not being installed. On debian, ubuntu or similar try installing the libwebkitgtk-dev and libwebkitgtk-3.0-dev packages.

What happens is that wxWIdgets detects that it is not there and then disables the wxWebView and related classes. When wxPython builds it is assuming that all dependencies and required features are present and doesn't (yet) know how to deal with them when they are not and you get build errors like that.

I do have a plan for addressing things like this, (generate C++ stubs that raise a NotImplementedError) but haven't gotten to it yet.

@cztomczak
Copy link
Author

Installing libwebkitgtk-dev and libwebkitgtk-3.0-dev packages resolved the issue. Thanks.

@davidroeca
Copy link

This is still an issue with linux compatibility with pyenv. See pyenv/pyenv#691 (more notably the last 2 comments).

I have to set LD_LIBRARY_PATH to wxpython's library directory, and I view this as an issue (either on pyenv's or on wxpython's end), since this requires an external script specific to the location of each python version's wxpython library. Another work-around is to use the system python, but that has nothing to do with the title of this issue as it relates to pyenv.

I have all of the required libraries installed and installed python through pyenv with the following command PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.2.

Currently on Linux Mint 18.2 (based on Ubuntu 16.04 xenial).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants