Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install wxPython using virtualenv

I am trying to begin a new python GUI application and I have decided to use wxPython as GUI because I want a multi-platform one.

The problem is that I want to use virtualenv ( with virtualenvwrapper ) to isolate the environment and be able to reproduce it in other machines where I will work, but i cannot install wxPython.

I have it installed in my ubuntu machine via apt-get but that is not enough

I have searched the web for a solution and i have found ...

  • This page http://batok.github.com/virtualenvwxp/ where it is explained a way to hack the virtualenv environment to use the local installation of wxPython. Not the best solution, but it would be a good workaround. The problem is that it is explained for Mac, and I couldnt make it work in my ubuntu.

  • Also found this page Installing wxPython in virtualenv under Linux where someone ask something similar. I have tried to build wxPython that way with no success.

Any help would be appreciated.

In the end, I have choose wxPython beacuse it is multiplatform and i can use it without license problems, but as i have not started yet i can change my mind if there is another easier to install framework.

Thanks In advance

20110925: Sorry for the delay and thanks for the answers. I just have tried to install wxpython using buildout and the links given here, but i still have the same problem. It seems as if I need libgtk2.0-dev package to be able to compile wxpython...

So there is any way to install this package locally to the buildout environment?

Thanks again.

like image 910
thamurath Avatar asked Aug 21 '11 17:08

thamurath


People also ask

Does wxPython work on Linux?

With wxPython software developers can create truly native user interfaces for their Python applications, that run with little or no modifications on Windows, Macs and Linux or other unix-like systems.


2 Answers

At the end I could not resolve this problem.

I want to create a reproducible python environment with all the requirements inside using buildout and/or virtualenv so I could work in any linux system with just virtualenv, python and a C++ compiler installed.

It seems that the only way to do this is to use buildout cmmi recipes to download and build wxpython and ALL its dependencies. This is a really painful way, and I have no time now.

I have decided to use a workaround: I am going to work on my ubuntu laptop most of the time, so I have installed wxpython from the repositories and use a wx.pth file to make it available to the virtual environment.

This is not a good solution, but seems the best till now ... so if someone knows any better solution please let me know.

When my python project is more mature, I will turn again to this problem and I will probably try the hard way ...

Thanks for all your answers and comments.

like image 158
thamurath Avatar answered Oct 21 '22 08:10

thamurath


The solution I ended up using was to install python to my main system:

Then make a symbolic link from the wx in my system python to my virtual environment:

ln -s /usr/lib/python2.7/dist-packages/wxversion.py <virtual_env_path>/lib/python2.7/site-packages/wxversion.py

Where is the path in my case to a virtual environment named "fibersim" for example is:

/home/adam/anaconda/envs/fibersim

Then import wx worked

Got this from: http://qopml.org/wp-content/uploads/2013/01/README.txt

like image 22
Adam Hughes Avatar answered Oct 21 '22 07:10

Adam Hughes