Portable Leo from scratch on Windows

131 views
Skip to first unread message

Matt Wilkie

unread,
Apr 17, 2013, 2:47:31 PM4/17/13
to leo-e...@googlegroups.com
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/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 of concept. It pulls together a couple of my different projects, and is very satisfying in that regard (yay! they work!), but is not ready for prime time. Feedback welcome.

Explanations will follow in later messages. I just had to share this important milestone immediately. :-)

-matt


Ville M. Vainio

unread,
Apr 17, 2013, 3:13:04 PM4/17/13
to leo-editor
Whoa, apt on windows, cool.


--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To post to this group, send email to leo-e...@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jacob Peck

unread,
Apr 17, 2013, 4:21:57 PM4/17/13
to leo-e...@googlegroups.com
On 4/17/2013 3:13 PM, Ville M. Vainio wrote:
Whoa, apt on windows, cool.


I second, third, and fourth this sentiment.  Apt = amazing.

-->Jake

Matt Wilkie

unread,
Apr 17, 2013, 6:10:27 PM4/17/13
to leo-e...@googlegroups.com
> Whoa, apt on windows, cool.

Thanks! It's been the gravity well powering my plunge into python. It's a testament to python's power that it enables someone like me, with no programming background, to build something that does real work. :)

The original genius is Jan Nieuwenhuizen, who wrote `cyg-apt` in python but made lots of calls to bash and tools like tar and curl. All I've done is take each function and convert them as best I could to pure python, to the point where it now has zero dependencies on cygwin (though it does still use the cygwin package and mirror structure).

More history and details at http://trac.osgeo.org/osgeo4w/wiki/pkg-apt

-matt


Matt Wilkie

unread,
Apr 17, 2013, 6:23:17 PM4/17/13
to leo-e...@googlegroups.com
>> Explanations will follow in later messages. I just had to share this important milestone immediately. :-)

>SET OSGEO4W_ROOT=%~dp0\root
>apt setup
>apt update
>apt install pyqt4 sip

Use the `apt` command line package management tool from Osgeo4w [1] to install python and all the other requirements that can't be installed with `pip` or `easy_install`, meaning PyQt and SIP.

The resultant dir structure follows a cygwin model, which in turn follows linux:

...\apps\Python27 - python libraries, site-packages, etc. This is PYTHONHOME.

..\bin - exe's and dll's, including python.exe, qt*.dll, etc.

There are also `etc, include, lib, var` which can all be discarded, unless you intend to use apt again or other programs from the osgeo4w ecosystem). `var` in particular you might want to clean out, it is the local cache for apt downloaded packages.

[1] http://trac.osgeo.org/osgeo4w/ Open Source Geographic Information Systems for Windows

...more to come.

-matt

Matt Wilkie

unread,
Apr 17, 2013, 7:31:15 PM4/17/13
to leo-e...@googlegroups.com
>call root\osgeo4w.bat

Adds ...\bin (for python) and ...\apps\python27\scripts (for pip) to PATH, and sets PYTHONHOME.

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

Download and install `distribute` and `pip`, the python tools which enable automated downloading and installing of programs and modules from the Python Package Index. `install-pip.py` is of my own devising. All it does is reduce the dependency on curl or wget by one step, using native urlib (py3) or urllib2 (py2) instead.

   http://pythonhosted.org/distribute/
   http://www.pip-installer.org/en/latest/
   https://pypi.python.org/pypi

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

Install Leo (more background for this one in next message).


> python apps\Python27\Scripts\leo

All done, let's run Leo! :)

-matt

Matt Wilkie

unread,
Apr 18, 2013, 1:15:22 AM4/18/13
to leo-e...@googlegroups.com
Edward, Ville, please pay attention to this message even if just nodding at the others passing by.

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

I built and uploaded to this package to the pypi testing server. Other than the fact it seems to work in so far as it installs without spewing errors I've no idea if it was done properly. Or even if it was appropriate for me to build a leo package. This is the first pypi package I've built.
I'll upload the changed `setup.py` and the build recipe I used for your inspection after I re-learn how to create a branch and issue a pull/merge request in bazaar.

best regards,

-matt

Ville M. Vainio

unread,
Apr 18, 2013, 1:44:34 AM4/18/13
to leo-editor
Ok, looking forward to reviewing it. Making leo installable with pip certainly sounds attractive.


--

Matt Wilkie

unread,
Apr 18, 2013, 1:56:48 AM4/18/13
to leo-e...@googlegroups.com
It appears that since I was the first one to use the testing server for 'leo-editor' I've become the owner. If you send me your usernames I'll make you the owner(s) instead of me. (Usernames do not appeared to be shared across regular and testing pypi servers, so you may need to register again.)

-matt


Matt Wilkie

unread,
Apr 18, 2013, 11:32:42 AM4/18/13
to leo-e...@googlegroups.com

Ville M. Vainio

unread,
Apr 18, 2013, 3:40:48 PM4/18/13
to leo-editor
Yep, it was quite uncontoversial, merged it in.

Matt Wilkie

unread,
Apr 18, 2013, 4:04:39 PM4/18/13
to leo-e...@googlegroups.com
> Here is a recipe for installing Leo from scratch on Windows (Win7 tested).

...and the results of that recipe, with some very small hand edits, packaged up in an all-in-one ready to go portable Leo zipfile (52mb). Simply unpack somewhere and run Leo.bat.

https://googledrive.com/host/0BxjYoJ7VMm5VbE11NHM3Q3RIRVk/

I'm interested in how well it does or doesn't work on different flavours of Windows.

-matt

HaveF

unread,
Apr 18, 2013, 8:56:02 PM4/18/13
to Leo-editor-googlegroup
That's great. I'll test it on my virtualbox winxp later.
Btw, I strongly suggest add this recipe and this link to leo's doc.

There are so much of recipes(like pearls) bury under googlegroups instead of doc for permanent saving.


-matt

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To post to this group, send email to leo-e...@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
--
Sincerely,

HaveF

HaveF

unread,
Apr 18, 2013, 9:12:28 PM4/18/13
to Leo-editor-googlegroup
On Fri, Apr 19, 2013 at 8:56 AM, HaveF <iamap...@gmail.com> wrote:
On Fri, Apr 19, 2013 at 4:04 AM, Matt Wilkie <map...@gmail.com> wrote:
> Here is a recipe for installing Leo from scratch on Windows (Win7 tested).

...and the results of that recipe, with some very small hand edits, packaged up in an all-in-one ready to go portable Leo zipfile (52mb). Simply unpack somewhere and run Leo.bat.

https://googledrive.com/host/0BxjYoJ7VMm5VbE11NHM3Q3RIRVk/

I'm interested in how well it does or doesn't work on different flavours of Windows.

That's great. I'll test it on my virtualbox winxp later.
When execute Leo.bat on winxp, it says,
"The system cannot execute the specified program"

Just  add some echo to OSGeo4W.bat, 
the problem seems at this line:

    for %%f in ("%OSGEO4W_ROOT%\etc\ini\*.bat") do call "%%f"

By quick search this error message, I found
does some dll files are only used for win7?
 
Btw, I strongly suggest add this recipe and this link to leo's doc.

There are so much of recipes(like pearls) bury under googlegroups instead of doc for permanent saving.


-matt

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To post to this group, send email to leo-e...@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
--
Sincerely,

HaveF



--
--
Sincerely,

HaveF

Matt Wilkie

unread,
Apr 18, 2013, 11:16:38 PM4/18/13
to leo-e...@googlegroups.com
Does this leo.bat work better?

{{{
setlocal
set PYTHONHOME=%~dp0\root\apps\Python27
set PATH=%~dp0\root\bin
%~dp0\root\bin\python.exe %PYTHONHOME%\Scripts\leo
endlocal
pause
}}}

If not please send me the results of what it prints to the console window.

thanks,

-matt

HaveF

unread,
Apr 18, 2013, 11:35:36 PM4/18/13
to Leo-editor-googlegroup
On Fri, Apr 19, 2013 at 11:16 AM, Matt Wilkie <map...@gmail.com> wrote:
Does this leo.bat work better?

{{{
setlocal
set PYTHONHOME=%~dp0\root\apps\Python27
set PATH=%~dp0\root\bin
%~dp0\root\bin\python.exe %PYTHONHOME%\Scripts\leo
endlocal
pause
}}}

If not please send me the results of what it prints to the console window.
it still can't.
same msg. "The system cannot execute the specified program"

log msg:

C:\Leo-editor-portable>setlocal

C:\Leo-editor-portable>set PYTHONHOME=C:\Leo-editor-portable\\root\apps\Python27


C:\Leo-editor-portable>set PATH=C:\Leo-editor-portable\\root\bin

C:\Leo-editor-portable>C:\Leo-editor-portable\\root\bin\python.exe C:\Leo-editor
-portable\\root\apps\Python27\Scripts\leo
"The system cannot execute the specified program"

C:\Leo-editor-portable>endlocal


Btw, why you all use three {{{ or }}} to quote the code?
It is standard or something?



--
--
Sincerely,

HaveF

Matt Wilkie

unread,
Apr 19, 2013, 12:51:42 AM4/19/13
to leo-e...@googlegroups.com
> "The system cannot execute the specified program"

ugh. I think maybe the previous link you referred to is correct, and there are either some .dll's missing or incompatible, which in turn means this isn't really a great leap forward after all. :(

Thanks for testing and the follow up.

> Btw, why you all use three {{{ or }}} to quote the code?

Triple curly bracket {{{...}}}  is used by MoinMoin wiki to mark verbatim blocks. You might also run into tilde, ~~~, or backtick, ```, used to fence code in other markup parsers, like markdown-extra.  I don't have any particular reason for using moinmoin syntax, other than I got used to it first. ;-)

cheers,

-matt

HaveF

unread,
Apr 19, 2013, 1:36:07 AM4/19/13
to Leo-editor-googlegroup
got it.

Or you can use leo-way(or Edward-way) here ;-)

QQQ
    balabala
QQQ



cheers,

-matt

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To post to this group, send email to leo-e...@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
Sincerely,

HaveF
Reply all
Reply to author
Forward
0 new messages