install both wxPython 2.8 and wxPython 2.9 with Python 2.7

The download page states (for OS X) that to install both wxPy 2.8 and
wxPy 2.9, to install one for Python 2.6 and the other for Python 2.7.

I presume this is still the case ??
Does Windows or Linux have the same issue, or can wxPy 2.8/2.9 be
installed together with the same Py install ??

I need to use Py 2.7 with wxPy 2.8 to support an existing application,
but I also want to use wxPy 2.9 for a new application. I could use Py
2.6 with wxPy 2.9 but that seems silly -- going backwards to an old Py
version.

Ideally I would like to move to Py 3.3 but wxPy or wxPhoenix is not
ready yet (no ETA wxPhoenix). I presume that is still the case ??

So, I was wondering if it was possible to install another version of Py
2.7, but tricking the system that it was another version. i.e. have two
versions of Py 2.7 installed (different directories, etc). Anyone know
if that is possible/easy to do and would/could it work ??

Thanks, Brendan.

Hi Brendan,

···

On 01/02/2013 11:59, Brendan Simon (eTRIX) wrote:

The download page states (for OS X) that to install both wxPy 2.8 and
wxPy 2.9, to install one for Python 2.6 and the other for Python 2.7.

I presume this is still the case ??
Does Windows or Linux have the same issue, or can wxPy 2.8/2.9 be
installed together with the same Py install ??

I need to use Py 2.7 with wxPy 2.8 to support an existing application,
but I also want to use wxPy 2.9 for a new application. I could use Py
2.6 with wxPy 2.9 but that seems silly -- going backwards to an old Py
version.

Ideally I would like to move to Py 3.3 but wxPy or wxPhoenix is not
ready yet (no ETA wxPhoenix). I presume that is still the case ??

So, I was wondering if it was possible to install another version of Py
2.7, but tricking the system that it was another version. i.e. have two
versions of Py 2.7 installed (different directories, etc). Anyone know
if that is possible/easy to do and would/could it work ??

I have 3 or 4 versions of wxPython all in the same Python install - but on Windows, but would think that works also on Mac.

I use use:
http://wiki.wxpython.org/MultiVersionInstalls

Werner

Werner wrote:

Hi Brendan,

The download page states (for OS X) that to install both wxPy 2.8 and
wxPy 2.9, to install one for Python 2.6 and the other for Python 2.7.

I presume this is still the case ??
Does Windows or Linux have the same issue, or can wxPy 2.8/2.9 be
installed together with the same Py install ??

I need to use Py 2.7 with wxPy 2.8 to support an existing application,
but I also want to use wxPy 2.9 for a new application. I could use Py
2.6 with wxPy 2.9 but that seems silly -- going backwards to an old Py
version.

Ideally I would like to move to Py 3.3 but wxPy or wxPhoenix is not
ready yet (no ETA wxPhoenix). I presume that is still the case ??

So, I was wondering if it was possible to install another version of Py
2.7, but tricking the system that it was another version. i.e. have two
versions of Py 2.7 installed (different directories, etc). Anyone know
if that is possible/easy to do and would/could it work ??

I have 3 or 4 versions of wxPython all in the same Python install - but
on Windows, but would think that works also on Mac.

I use use:
MultiVersionInstalls - wxPyWiki

Because of how the "install names" of shared libraries work and a few other issues I wasn't able to get the MultiVersionInstalls working the same way on OSX. I thought that I would be able to get it working another way but I never came back to the problem to work out how to do it. However, it should be doable with a little manual tweaking instead.

Almost everything in wxPython on OSX is installed under a versioned directory located in /usr/local/lib. The most recent 2.8 install will also have a symlink there called wxPython-unicode, and the most recent 2.9 install will have a symlink called just wxPython. So it is already keeping most of the different installs separate from each other.

The bit that will need to be manually tweaked when you want to switch between them is the pth file that tells Python to add the wxPython folders to the sys.path. For Python 2.7 it is located at:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wxredirect.pth

Changing the contents of that file will let you switch which version of wxPython is found with "import wx". You may also be able to do it via setting PYTHONPATH, but I seem to recall that there was some reason why that may not work as expected, although that may have been only when using Apple's Python.

···

On 01/02/2013 11:59, Brendan Simon (eTRIX) wrote:

--
Robin Dunn
Software Craftsman

You can perfectly fine use Python 2.7 for both versions. You can also have multiple wxPython versions installed and switch any time.

I’m on Linux, but this should work on all systems:
Try to install all but the default wxPython into custom directories.

Then create a shell script called python-wx29 and put inside two path settings and a call to python.

Mine looks like this:

export PYTHONPATH=/home/n1nsun/wxpython-git/wxPython:$PYTHONPATH

export LD_LIBRARY_PATH=/home/n1nsun/wxpython-git/wxPython/wxpy-bld/lib:$LD_LIBRARY_PATH

python $*

Make the script executable (chmod +x “python-wx29”) and make sure it is on your PATH.

If you now use this script instead of “python” on command line, you’ll get the same results, but Python will prefer the set version over all others.

See below.

Because of how the “install names” of shared libraries work and a few
other issues I wasn’t able to get the MultiVersionInstalls working the
same way on OSX. I thought that I would be able to get it working
another way but I never came back to the problem to work out how to do
it. However, it should be doable with a little manual tweaking instead.

Almost everything in wxPython on OSX is installed under a versioned
directory located in /usr/local/lib. The most recent 2.8 install will
also have a symlink there called wxPython-unicode, and the most recent
2.9 install will have a symlink called just wxPython. So it is already
keeping most of the different installs separate from each other.

The bit that will need to be manually tweaked when you want to switch
between them is the pth file that tells Python to add the wxPython
folders to the sys.path. For Python 2.7 it is located at:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wxredirect.pth

Changing the contents of that file will let you switch which version of
wxPython is found with “import wx”. You may also be able to do it via
setting PYTHONPATH, but I seem to recall that there was some reason why
that may not work as expected, although that may have been only when
using Apple’s Python

I installed wxPython 2.9.4.0 osx cocoa py2.7 along side my wxPython 2.8.12.1 unicode install.
wxversion.select() would only detect 2.9.4.0 :frowning:

I then changed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wxredirect.pth to point to the 2.8.12.1 directory and wxversion.select() now finds the 2.8.12.1 install :slight_smile:
This was expected but it also found the 2.9.4.0 install. This was not expected !!

I presume this means there is a bug in the 2.9.4.0 version of wxversion.select() ??

Does this make sense to anyone ??

I installed wxPython 2.9.4.0 osx cocoa py2.7 along side my wxPython 2.8.12.1 unicode install.
wxversion.select() would only detect 2.9.4.0 :frowning:

I then changed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wxredirect.pth to point to the 2.8.12.1 directory and wxversion.select() now finds the 2.8.12.1 install :slight_smile:
This was expected but it also found the 2.9.4.0 install. This was not expected !!

I presume this means there is a bug in the 2.9.4.0 version of wxversion.select() ??

Does this make sense to anyone ??

I diffed the two versions of wxversion.py and they are identical (apart from a few comments), so I guess it’s probably a default path issue. i.e. 2.8 is found due to addition of path in wxredirect.pth and 2.9 is found due to a default path.

ok. I added both paths in wxredirect.pth and it works as expected.

Having a look through the wxversions.py code, I can’t help wondering if there is a better or additional method to find installed versions of wxpy. e.g. find or know the root prefix directory where all wxPythons are stored and traverse these looking for valid directory install patterns. Anyone see any issues with that ??