Portable wxPython and easy_install.

905 views
Skip to first unread message

ted_lilley

unread,
Aug 5, 2008, 7:14:59 PM8/5/08
to PortablePython
A gentleman named Martin had previously been so kind as to package a
2.8.7.1 version of wxPython that could be dropped in a few different
directories to enable portable wxPython. Unfortunately these files
were taken down but he explained to me how he derived them, so I
repeated some of the work on the latest wxPython (2.8.8.1 I believe).
The file list I used is attached at the end of this post.

I captured the list using Process Monitor from Sysinsternals
(www.sysinternals.com) filtering just for file operations. Exporting
the result to CSV and opening in Excel, then making a pivot table of
the filenames made the list. I removed the obvious temp files and
other files that didn't make sense to yield the final version.

I think it is working since I've been able to easy_install winpdb, a
wx-based debugger for Python, on my Portable Python. Between Portable
Komodo Edit, Portable WinMerge, Portable Python and winpdb, I pretty
much have my favorite full-fledged python development environment on a
stick.

All I'm missing is TortoiseSVN, but that's hard to see a portable
version coming around since it is all context-menu based. Command-
line subversion would suffice, but I prefer not even to run version
control on my source on USB anyway, instead using SyncToy 2.0 Beta
(http://www.microsoft.com/prophoto/downloads/synctoybeta.aspx) to sync
my source files to my desktop.

I set SyncToy to ignore hidden directories, so the subversion files
don't come across to the USB stick, saving me some space and avoiding
conflict issues with the sync. Synchronization can cause consistency
issues with inter-file dependencies when changes have occurred on both
sides. These consistency issues can destroy subversion's ability to
use the metadata it needs to track changes, so I leave the metadata
out and let subversion's normal mechanisms track the source file
changes once they have been synced back to the desktop.

On to easy_install (http://peak.telecommunity.com/DevCenter/
EasyInstall). This is a very, very handy tool for any python that is
"isolated" from the normal windows environment. It is a command-line
utility (python package with a wrapper) that will automatically search
for the best and latest version of any package registered with the
python package index online, download and install it for you based
just on the name of the package. While it did not work installing
every package I've tried, it has installed several and some I thought
it might not.

For example, I installed the previously mentioned winpdb by using
easy_install with the command "easy_install winpdb". It grabbed and
installed the latest, which I was able to run with the portable
wxpython.

The only caveat so far with it is that it codes the drive letter in
somewhere in the easy_install runner's configuration, which I have not
yet been able to track down. Easy_install from another PC with a
different drive letter errored out. However, manually running "python
Scripts\easy_install-script.py <package>" yields the desired result in
such a case.

The other note is that I used a command-line that made the portable
python first in the path. PortableApps Command Prompt Portable does
this nicely by letting you modify the shell's path at startup with Data
\Batch\commandprompt.bat. See it's docs for details. Remember to
use %~d0 so the path dynamically determines the drive letter.

This all means that many packages should be able to become portable
just using the easy_install command. Remember, easy_install needs to
be set up using the portable python's .exe, not your system one. As
long as you do that, it will install the packages you specify in the
portable python's site-packages. If you do this from the portable
command prompt, it's easy.

Here is the set of files for wxpython. I don't know if everything is
exactly right, but it's working for me so far.

For those directories that obviously only contain wxpython files, I
haven't listed all of the files.
The Scripts directory also contains .bat versions of the files listed
below. Copy those as well.

C:\Python25\Lib\site-packages
C:\Python25\Lib\site-packages\wx.pth
C:\Python25\Lib\site-packages\wx-2.8-msw-unicode
C:\Python25\Lib\site-packages\wxaddons
C:\Python25\Lib\site-packages\wxversion.py
C:\Python25\msvcr71.dll
C:\Python25\python.exe.manifest
C:\Python25\pythonw.exe.manifest
C:\Python25\Scripts
C:\Python25\Scripts\CreateBatchFiles.py
C:\Python25\Scripts\CreateMacScripts.py
C:\Python25\Scripts\editra
C:\Python25\Scripts\helpviewer
C:\Python25\Scripts\img2png
C:\Python25\Scripts\img2py
C:\Python25\Scripts\img2xpm
C:\Python25\Scripts\pyalacarte
C:\Python25\Scripts\pyalamode
C:\Python25\Scripts\pycrust
C:\Python25\Scripts\pyshell
C:\Python25\Scripts\pywrap
C:\Python25\Scripts\pywxrc
C:\Python25\Scripts\xrced
C:\Python25\unicows.dll


A reference of all of the tools I've used for my Portable Python
environment:
PortableApps.com
http://www.portableapps.com/

Notepad++ Portable
http://portableapps.com/apps/development/notepadpp_portable

Command Prompt Portable
http://portableapps.com/apps/utilities/command_prompt_portable

WinMerge Portable
http://portableapps.com/apps/utilities/winmerge_portable

Komodo Edit Portable
http://www.obsidianproject.co.uk/index.ob?do=komodoport

Process Monitor
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

Easy Install
http://peak.telecommunity.com/DevCenter/EasyInstall

wxPython
http://www.wxpython.org/

Winpdb
http://winpdb.org/

SyncToy 2.0 Beta
http://www.microsoft.com/prophoto/downloads/synctoybeta.aspx

Python for .NET
http://pythonnet.sourceforge.net/

Matt Wilkie

unread,
Aug 6, 2008, 1:51:10 PM8/6/08
to portabl...@googlegroups.com
Wow.

Ted: thank you for very much for your contribution. I am especially
grateful for your outline of how you determined which files to copy,
having just tried a similar process manually for (attempting to)
figure out how to make pyinstaller portable.


--
-matt

ted_lilley

unread,
Aug 6, 2008, 7:11:04 PM8/6/08
to PortablePython
Interesting to see another python-to-executable package. I think I
had tried to find pyinstaller when it was a dead project at
macmillan. Nice to see an alternative to py2exe back.

Unfortunately pyinstaller doesn't seem to do much in the way of being
installable itself like other python packages. easy_install was
unable to find it and the instructions on the website are unusual.

Do you have enough experience with it to know that it is worth the
effort? I'm interested in the pros/cons versus py2exe.

With regard to my first post, I've learned a couple new things since
then:

1. The easy_install (as well as ipython http://ipython.scipy.org/moin/,
now that I've easy_installed that) runners in the Scripts directory
are .exe's that simply run corresponding .py files (e.g. easy_install-
script.py). The py files are the culprits that cause drive-letter
problems when the USB drive letter changes. They contain a reference
to python.exe in the shebang line. Probably the best solution is to
remove the line entirely. This lets the python in your path be run.
You could also simply remove the drive-letter, which will let it work
as long as you run the command from a directory under the USB drive
(e.g. #!\PortableApps\PortablePython1.0\python.exe)

2. Just like easy_install, the wxpython batch files also contain
references to the python interpreter. Re-run the CreateBatchFiles.py
once you've moved the wx files over to the USB drive. This doesn't
solve the changing drive-letter issue, so you still have to manually
edit each of the batch files after they've been created, but there are
so many I'm only doing that as I need to. In the meantime, there's at
least a fifty-fifty chance that the drive-letter will be right on its
own.

3. I was able to run the wxPython demos by moving the installed files
from my PC install to a separate directory on the USB drive. I'll
plug PyCrust, my favorite IDE-like shell. IPython is great, but
sometimes it's nicer to have variables and completion/docstrings
presented without have to type extra commands.

4. Mentioning IPython, I had to lift the pyreadline files from my PC
install. Although IPython easy-installed without pyreadline,
pyreadline wouldn't easy-install.

5. I was looking through the list of desired portable software and saw
easygui. What a great little idea. It doesn't easy-install, but it's
trivial to drop the unzipped package into Portable Python's site-
packages directory. It requires Tk, which is thankfully there already
by default. Voila, simple guis without event-driven programming.

6. There is a project on PortableApps.com to package a Python
distribution (http://portableapps.com/node/12031). Perhaps there is
an opportunity for collaboration/learning?

I think that's all that my fevered brain has got for now!

Ted

Perica Zivkovic

unread,
Aug 7, 2008, 3:25:09 AM8/7/08
to portabl...@googlegroups.com
Ted,

great contribution! Your point nr. 6 is very interesting, I will try to contact the authors to see can we work together.

keep pythoning!

grtz,

Perica

Matt Wilkie

unread,
Aug 7, 2008, 12:50:16 PM8/7/08
to portabl...@googlegroups.com
> Interesting to see another python-to-executable package. I think I
> had tried to find pyinstaller when it was a dead project at
> macmillan. Nice to see an alternative to py2exe back.
>
> Unfortunately pyinstaller doesn't seem to do much in the way of being
> installable itself like other python packages. easy_install was
> unable to find it and the instructions on the website are unusual.
>
> Do you have enough experience with it to know that it is worth the
> effort? I'm interested in the pros/cons versus py2exe.

My experience is limited to single trial on a single a small project.
I followed the out-of-box instructions for each and did not
troubleshoot. Pyinstaller created a working executable and py2exe
created one which ran but was incomplete, some functions would error
out.

Do it it's design, pyinstaller will never be easy_install'able as it's
not a python package. The same deployment works with any python
version on the host computer (though Configure.py needs to be re-run
when switching versions).

The pyinstaller project is a little non-standard (for example the
manual is not on a webpage, but only in the download archive.) It took
me a little while to get oriented but once I got started everything
went smoothly; the documentation is good.

--
-matt

ted_lilley

unread,
Aug 8, 2008, 1:03:50 PM8/8/08
to PortablePython
Thanks for the info. Sounds like it's worth giving a try.

Mauler

unread,
Aug 22, 2008, 1:50:30 PM8/22/08
to PortablePython
The problem is that we don't have a stable place to save the
contributions, just like it happened with the wxPython that i've
packaged some time before, the free file hosting services are not a
very good solution. I can repackage wxPython, SPE and a couple of
other libraries.
John Haller's Portable Apps uses sourceforge to distribute the files,
can't we do the same?
I think we can even integrate Python into PortableApps together with a
better (portable) package manager

On Aug 5, 8:14 pm, ted_lilley <ted_lil...@yahoo.com> wrote:
> A gentleman named Martin had previously been so kind as to package a
> 2.8.7.1 version of wxPython that could be dropped in a few different
> directories to enable portable wxPython.  Unfortunately these files
> were taken down but he explained to me how he derived them, so I
> repeated some of the work on the latest wxPython (2.8.8.1 I believe).
> The file list I used is attached at the end of this post.
>
> I captured the list using Process Monitor from Sysinsternals
> (www.sysinternals.com) filtering just for file operations.  Exporting
> the result to CSV and opening in Excel, then making a pivot table of
> the filenames made the list.  I removed the obvious temp files and
> other files that didn't make sense to yield the final version.
>
> I think it is working since I've been able to easy_install winpdb, awx-based debugger for Python, on my Portable Python.  Between Portable

Perica Zivkovic

unread,
Aug 22, 2008, 3:48:02 PM8/22/08
to PortablePython
I already packaged SPE and wxPython here on this group for alpha
testing for next release. It would be nice if you people can test it.
If you have any other things you packaged and you want to distribute
it for testing, send it to me (or mail me the link) and I can post it
here on this group for alpha testing and if it is good enough (no
critical issues) it will go out with next release.

cheers,

Perica
Message has been deleted

effie_jayx

unread,
Oct 2, 2008, 8:57:40 AM10/2/08
to PortablePython
I am trying to run a simple script with wxpython but it seems I am not
referencing the library well...

I import with

import wx

I also tried
from wxPython.wx import *

is ther anything else I need to do to get wxpython working apart from
unziping the file in the PortablePython1.0 folder?

Thanks for all the hard work. It is great stuff

On Aug 22, 3:49 pm, Perica Zivkovic <perica.zivko...@gmail.com> wrote:
> http://groups.google.com/group/portablepython/files

Perica Zivkovic

unread,
Oct 2, 2008, 3:13:59 PM10/2/08
to PortablePython
wx works currently like in "multi version installation" so you need to
select version before importing wx. Example:

import wxversion
wxversion.select("2.8")
import wx

more info:
http://wxpython.org/docs/api/wxversion-module.html

keep pythoning!

Perica
Reply all
Reply to author
Forward
0 new messages