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
>>>