-{ a hewer of maps }-

Python fixit snippets

Very short problems about python, found and fixed.

failed to create process.

whups, this worked yesterday. Whatup? --> drive letters/paths have been changed. The path to python.exe specified in pip.exe has moved. Solution: reinstall pip (and any other py programs similarly impacted).

Portable Leo from scratch on Windows

Here is a recipe for installing Leo from scratch on Windows (Win7 tested). The only prerequisites are command line wget in PATH and an internet connection.

About 50mb of files are downloaded and 200mb consumed when done.

Open a command prompt and run:

mkdir X:\testing
pushd X:\testing

wget -O apt.exe --no-clobber http://download.osgeo.org/osgeo4w/x86/release/apt/apt-r1193M.exe
SET OSGEO4W_ROOT=%~dp0\root
apt setup
apt update
apt install pyqt4 sip

call root\osgeo4w.bat

wget --no-check-certificate http://gist.github.com/maphew/5393935/raw/install-pip.py
python install-pip.py GO
python install-pip.py GO

pip install -i https://testpypi.python.org/pypi leo-editor

python apps\Python27\Scripts\leo

After this the directory X:\testing\root can be renamed and/or moved anywhere.

To run leo in future sessions, simply call x:\path\to\root\osgeo4w.bat python apps\Python27\Scripts\leo, either as a batch file or windows shortcut.

IMPORTANT NOTE - this is just a proof continue.

Install Pip script

Introducing a pure python means to install pip and it's requirements all in one go.

Installing pip on Windows is relatively straightforward, now, but still a tad bumpy. Basically it consists of

  1. Download distribute or setuptools
  2. Install it with python distribute_setup.py
  3. Download the get-pip script
  4. Install with python get-pip.py

(Aside: curiously the distribute docs say you can use pip to install distribute!)

On Windows this means installing wget or curl in order to follow the install instructions as given, or pointing and clicking your through click-this-url >> save as >> choose a spot >> open a python shell >> ...etc.. Easy, but boring and easy to continue.