1

I am trying to create a Python 3.4 virtual environment for experimenting with wxPython Phoenix, after finding out about that wxPython is only available for Python2.7. For this purpose I ran the following command using Anaconda3:

conda create --name wxpython-tutorial python=3
source activate wxpython-tutorial

Then I found the following install command for pip on the wxPython website:

pip install --upgrade --trusted-host wxpython.org --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix > pip_install_log.log

This gives my CPU a lot to work, but unfortunately, it doesn't install correctly and gives me a huge terminal output. I'll paste the red lines of that output here and link the complete log file:

Failed building wheel for wxPython-Phoenix
Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-5_va3b5w/wxPython-Phoenix/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-uzo3pvq4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-5_va3b5w/wxPython-Phoenix

I couldn't find anything on with such a general fail message (1. line about wheel) or such a complex one (2. line starting with command), so I don't know what could be wrong. Also I don't see any better source of information on how to install it in my virtual environment than the official wxPython website.

Here is the link to the complete log file.

I could not use pastebin, the file is 1.39Mb in size and that exceeds the limit for pastebin : /

What is wrong and how can I manage to install wxPython for Python 3.4 in a virtual environment?

EDIT#1: All requirements listed on the wxPython website are installed. I checked that before I ran the pip command.

EDIT#2: After following the advide of Robin Dunn (to install libwebkit-dev), I was able to get the pip install running without errors. However, now I still can't use it, because when I try to import it, another error pops up:

(wxpython-phoenix-tutorial)xiaolong@xiaolong-VPCF13J0E:~$ python
Python 3.4.3 |Continuum Analytics, Inc.| (default, Jun  4 2015, 15:29:08) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/__init__.py", line 17, in <module>
from wx.core import *
File "/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/core.py", line 6, in <module>
from ._core import *
ImportError: libwx_gtk2u_core-3.0.so.0: cannot open shared object file: No such file or directory
>>>

Sounds like a library, which should be there but is not. Should it have been compiled and was not?

EDIT#3

I ran the ldd command RobinDunn suggested and it turns out that there are 3 files missing:

xiaolong@xiaolong-VPCF13J0E:~$ ldd /home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/_core*.so
linux-vdso.so.1 =>  (0x00007ffe867ed000)
libwx_gtk2u_core-3.0.so.0 => not found
libwx_baseu_net-3.0.so.0 => not found
libwx_baseu-3.0.so.0 => not found
libpython3.4m.so.1.0 => /home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/libpython3.4m.so.1.0 (0x00007fa08164c000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa081348000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa081042000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa080e2c000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa080c0e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa080849000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa080645000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fa080442000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa0827ec000)

So it seems, that the compilation process didn't put them there. A search for them reveals, that they have been created:

find /home/xiaolong/development/ -name "*libwx_gtk2u_core-3.0*"
/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/libwx_gtk2u_core-3.0.so
/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/libwx_gtk2u_core-3.0.so.0
/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/libwx_gtk2u_core-3.0.so.0.3.0

find /home/xiaolong/development/ -name "*libwx_baseu_net-3.0.so.0*"
/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/libwx_baseu_net-3.0.so.0.3.0
/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/libwx_baseu_net-3.0.so.0

find /home/xiaolong/development/ -name "*libwx_baseu-3.0.so.0*"
/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/libwx_baseu-3.0.so.0
/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/libwx_baseu-3.0.so.0.3.0

I'll try to export their locations next.

EDIT#4 Although I added the location of the library as adviced:

export LD_LIBRARY_PATH=/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx

(I also tried the full path to the library) I added that line to my ~/.profile file and to my ~/.bashrc file. I still get the same error, after restarting the terminal, when trying to do import wx in my virtual envs python:

(wxpython-phoenix-tutorial)xiaolong@xiaolong-VPCF13J0E:~/development/anaconda3/envs/wxpython-phoenix-tutorial$ python
Python 3.4.3 |Continuum Analytics, Inc.| (default, Jun  4 2015, 15:29:08) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/core.py", line 6, in <module>
    from ._core import *
ImportError: libwx_gtk2u_core-3.0.so.0: cannot open shared object file: No such file or directory
>>> 
2
  • Did you run pip from your virtual environment path? See e.g.: dabapps.com/blog/introduction-to-pip-and-virtualenv-python Commented Aug 10, 2015 at 13:19
  • Yes, I did : ) I've been using virtualenvs for some time now ; ) I like them, but sometimes I still stumble upon something that doesn't work without any further effort. Commented Aug 10, 2015 at 14:57

1 Answer 1

1

The first compilation error is:

  ../../../sip/cpp/sip_html2cmodule.cpp:386:1: error: ‘wxWebView’ does not name a type

Backtracking to the wxWidgets configure and build you can see this:

  checking for WEBKIT... configure: WARNING: webkitgtk not found.
  configure: WARNING: WebKit not available, disabling wxWebView

So basically it's telling you that you need to install the dev packages for webkitgtk.

For EDIT #2:

By default Phoenix's build.py will copy the wxWidgets shared libraries it built to the wx package folder, and will set the rpath in the extension modules to look for those libraries using a relative path instead of the stock fixed paths like usual. This is done to make the wxPython-Phoenix package be relocatable, to allow different versions in different virtualenvs, etc.

To check that this happened properly, look in /home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx and see if there are a bunch of libwx_* files. These are the wxWidgets shared libraries. You can also run this to see if the extensions are able to find those libraries (probably not since you're getting the error, but it may give some clues):

ldd /home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx/_core*.so

If all else fails, then you can set an environment variable to enable the dynamic linker to find those libs the old fashioned way:

export LD_LIBRARY_PATH=/home/xiaolong/development/anaconda3/envs/wxpython-phoenix-tutorial/lib/python3.4/site-packages/wx
Sign up to request clarification or add additional context in comments.

2 Comments

I tried on a newly installed distribution and had some trouble with another error about not enough space: fatal error: can’t write PCH file: No space left on device, but that went away when I cleared the trash bin and unmounted /tmp: sudo umount -l /tmp. I have no idea why that happened, but other than that, after installing libwebkit-dev the pip install ran without issues.
I was a bit too hasty, adding informtion to the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.