Difference between revisions of "Installation windows Python x86-32 minGW"

From relax wiki
Jump to navigation Jump to search
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{Warning|STOP:  This does not work yet.}}
 +
 
= Download preparation =
 
= Download preparation =
 
This guide should follow [http://www.nmr-relax.com/windows_devel.html Homepage for MS Windows development platform]
 
This guide should follow [http://www.nmr-relax.com/windows_devel.html Homepage for MS Windows development platform]
Line 26: Line 28:
 
=== Trick to set variables in cmd ===
 
=== Trick to set variables in cmd ===
 
Make a folder '''own''' in '''C:\WinPython27\WinPython-32bit-2.7.x\scripts''' and <br>
 
Make a folder '''own''' in '''C:\WinPython27\WinPython-32bit-2.7.x\scripts''' and <br>
copy '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\env.bat''' to '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\own\pyt32.bat'''<br>
+
copy '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\env.bat''' to '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\own\pytming.bat'''<br>
and copy '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\cmd.bat''' to '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\own\cmdpyt32.bat'''<br>
+
and copy '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\cmd.bat''' to '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\own\cmdpytming.bat'''<br>
  
Modify '''pyt32.bat''' from
+
Modify '''pytming.bat''' from
 
<source lang="python">
 
<source lang="python">
 
set WINPYDIR=%~dp0..\python-2.7.5
 
set WINPYDIR=%~dp0..\python-2.7.5
Line 38: Line 40:
 
</source>
 
</source>
  
Modify '''cmdpyt32.bat''' from
+
Modify '''cmdpytming.bat''' from
 
<source lang="python">
 
<source lang="python">
 
call %~dp0env.bat
 
call %~dp0env.bat
Line 44: Line 46:
 
to
 
to
 
<source lang="python">
 
<source lang="python">
call %~dp0pyt32.bat
+
call %~dp0pytming.bat
 
</source>
 
</source>
  
 
=== Trick to add .bat files to PATH ===
 
=== Trick to add .bat files to PATH ===
If you have permission to change the Environment Variables in windows, you can add the '''pyt32.bat''' and '''cmdpyt32.bat''' to your path.<br>
+
If you have permission to change the Environment Variables in windows, you can add the '''pytming.bat''' and '''cmdpytming.bat''' to your path.<br>
 
Right click Computer -> properties -> Advanced system settings -> Environment Variables -> User variables ->  Edit: PATH <br>
 
Right click Computer -> properties -> Advanced system settings -> Environment Variables -> User variables ->  Edit: PATH <br>
 
Add to end of the Variable value:
 
Add to end of the Variable value:
Line 54: Line 56:
 
In any folder, hold "Shift" and right click, "Open command window here". Write:
 
In any folder, hold "Shift" and right click, "Open command window here". Write:
 
<source lang="powershell">
 
<source lang="powershell">
pyt32
+
pytming
 
python
 
python
 
</source>
 
</source>
  
= Install Visual Studio Express 2012 for Windows Desktop =
+
= Install minGW =
[http://msdn.microsoft.com/en-us/library/vstudio/hs24szh9.aspx See versions of VS 2012 here].<br>
+
Download [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst], and run it. [http://www.mingw.org/wiki/Getting_Started If you need more help, read this], but you should just do this.
 +
# Install to: C:\MinGW
 +
# Take all options when installing (about 450 MB)
 +
# Take the "pre" package option
  
For 32 bit compiling, you will only need, '''Visual Studio Express for Windows Desktop'''.<br>
+
After install, edit '''C:\MinGW\msys\1.0\msys.bat'''. <br>
From http://www.microsoft.com/visualstudio/eng/downloads, download and install: [http://go.microsoft.com/?linkid=9816758 Visual Studio 2012 Express for Windows Desktop].<br>
+
Insert at second line a call to our variables:
Skip all extra packages install. After install, just exit any program, which opened after install.
+
<source lang="powershell">
 +
@echo off
 +
call C:\WinPython27\WinPython-32bit-2.7.5.1\scripts\env.bat
 +
rem Copyright (C):  2001, 2002, 2003, 2004, 2005  Earnie Boyd
 +
</source>
  
 
= Install Subversion checkout of relax =
 
= Install Subversion checkout of relax =
 +
{{historical svn}}
 
Install a subversion client. For example: http://tortoisesvn.net/
 
Install a subversion client. For example: http://tortoisesvn.net/
  
 
Right click in winpython folder: '''C:\WinPython27''', and select '''SVN Checkout'''. Write the path:
 
Right click in winpython folder: '''C:\WinPython27''', and select '''SVN Checkout'''. Write the path:
svn://svn.gna.org/svn/relax/trunk
+
  svn://svn.gna.org/svn/relax/branches/relax_disp relax_disp_32_ming
  svn://svn.gna.org/svn/relax/branches/relax_disp relax_disp_32
 
 
 
== Bugfix scons for 32bit building ==
 
Due to a bug, versions of scons '''<=2.3''' should alter a line in:<br>
 
'''C:\WinPython27\WinPython-32bit-2.7.5.1\python-2.7.5\Lib\site-packages\scons-2.3.0\SCons\Tool\MSCommon\vc.py'''
 
 
 
Line '''364''':
 
<source lang="python">
 
    if not req_target_platform and target_platform in ('amd64','x86_64'):
 
        try_target_archs.append('x86')
 
</source>
 
Should be:
 
<source lang="python">
 
    #if not req_target_platform and target_platform in ('amd64','x86_64'):
 
    #    try_target_archs.append('x86')
 
    if target_platform in ('amd64','x86_64'):
 
        try_target_archs.append('x86')
 
    print "requested", req_target_platform
 
    print "target", target_platform
 
    print "try", try_target_archs
 
</source>
 
 
 
If not fixing the bug, you will get:
 
<source lang="powershell">
 
C:\WinPython27\relax_disp_32>scons
 
scons: Reading SConscript files ...
 
scons: done reading SConscript files.
 
scons: Building targets ...
 
 
 
###########################
 
# Compiling the C modules #
 
###########################
 
Building the relaxation curve fitting module 'target_functions\\relax_fit.pyd'
 
 
 
cl /Fotarget_functions\c_chi2.obj /c target_functions\c_chi2.c /nologo /I"C:\Win
 
Python27\WinPython-32bit-xxx\scripts\..\python-xxx\include"
 
'cl' is not recognized as an internal or external command,
 
operable program or batch file.
 
scons: *** [target_functions\c_chi2.obj] Error 1
 
scons: building terminated because of errors.
 
</source>
 
  
 
= Build relax =  
 
= Build relax =  
Open the '''WinPython Command Prompt''' <br>
+
Open the '''MinGW Shell''' from the start menu. <br>
Navigate to the SVN checked out relax folder.<br>
+
Write here: NOTE, you can paste into the terminal, using the little icon in top left corner, Edit, Paste
cd C:\WinPython27\relax_disp_32
+
<source lang="bash">
scons
+
cd /c/WinPython27/relax_disp_32_ming
 
+
python /c/WinPython27/WinPython-32bit-2.7.5.1/python-2.7.5/Scripts/scons.py install
Or navigate to C:\WinPython27\relax_disp_32, hold "Shift" and right click, "Open command window here". Write:
 
pyt32
 
scons
 
 
 
== Modify pyt32.bat ==
 
Modify '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\pyt32.bat''', and add to end of file
 
<source lang="powershell">
 
set PATH=%PATH%;C:\WinPython27\relax_disp_32
 
 
</source>
 
</source>
  
Test installation, by clicking '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\cmdpyt32.bat''', and write
 
<source lang="powershell">
 
relax
 
relax -g
 
</source>
 
 
=== Tip - shortcut to cmdpyt32.bat ===
 
Make shortcut to '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\cmdpyt32.bat''', and modify the shortcut. Set
 
'''Start in:''' %PWD%
 
You can now copy this shortcut around, which open a command prompt at the current folder, and set the paths correctly.
 
 
= Install other software =
 
== xmgrace - for the plotting results of NMR-relax ==
 
relax produces xmgrace "'.agr" files for plotting. There exist two ports for xmgrace to windows [http://sourceforge.net/projects/qtgrace/ QtGrace] and [http://sourceforge.net/projects/gracegtk/ GraceGTK].
 
 
Download [http://sourceforge.net/projects/qtgrace/ QtGrace], and unpack to '''C:\WinPython27\qtgrace_windows_binary'''. <br>
 
Then copy '''C:\WinPython27\qtgrace_windows_binary\bin\qtgrace.exe'''  to '''C:\WinPython27\qtgrace_windows_binary\bin\xmgrace.exe'''
 
 
Modify '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\pyt32.bat''', and add to end of file
 
<source lang="powershell">
 
set PATH=%PATH%;C:\WinPython27\qtgrace_windows_binary\bin
 
</source>
 
 
Test installation, by clicking '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\cmdpyt32.bat''', and write
 
<source lang="powershell">
 
xmgrace
 
</source>
 
which should start xmgrace.
 
 
== Python editor ==
 
A good lightweight editor for windows could [[Pyscripter]]
 
 
= TEST INSTALLATION =
 
After an installation you should really run an [Installation_test]
 
 
= Trouble shooting =
 
 
== How-to ==
 
Download [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst], and run it.
 
# Install to: C:\MinGW
 
# Take all options when installing (about 450 MB)
 
# Take the "pre" package option
 
 
<source lang="text">
 
It`ll use mingw compiler with msvc options in this case. Will not it?
 
I think we have to use
 
env = Environment(tools = ['default','mingw'])
 
instead.
 
 
env = Environment(tools = ['mingw'])
 
</source>
 
  
== See also ==
+
= See also =
[http://www.bozzograo.net/radiancewiki/doku.php?id=how_to_compile_radiance_using_the_mingw_tools_and_scons Guide to radiance compilation]
 
  
 
[[Category:Installation]]
 
[[Category:Installation]]

Latest revision as of 09:46, 21 October 2020

Warning  STOP: This does not work yet.

Download preparation

This guide should follow Homepage for MS Windows development platform

First: Download these packages, do not unpack them yet.

  1. (.exe): wxPython: http://www.lfd.uci.edu/~gohlke/pythonlibs/#wxpython
  2. (.exe): scons: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scons
  3. (.zip): minfx: http://download.gna.org/minfx/
  4. (.zip): bmrblib: http://download.gna.org/bmrblib/

take the win32 bit versions.

Install python and necessary packages

I recommend to install a python distribution which is packed with several packages already.

Winpython

You could consider winpython, which includes Ipython, numpy, scipy. matplotlib etc.:
Homepage

Make a folder: C:\WinPython27.
Run the downloaded winpython exe file, and extract to: C:\WinPython27.
Open WinPython Control Panel in ex. C:\WinPython27\WinPython-32bit-2.7.x
Drag the 4 above mentioned packakes, into the window, and install the packages.
For a command window, use the WinPython Command Prompt found in C:\WinPython27\WinPython-32bit-2.7.x, which fixes path issues for finding python.

Trick to set variables in cmd

Make a folder own in C:\WinPython27\WinPython-32bit-2.7.x\scripts and
copy C:\WinPython27\WinPython-32bit-2.7.x\scripts\env.bat to C:\WinPython27\WinPython-32bit-2.7.x\scripts\own\pytming.bat
and copy C:\WinPython27\WinPython-32bit-2.7.x\scripts\cmd.bat to C:\WinPython27\WinPython-32bit-2.7.x\scripts\own\cmdpytming.bat

Modify pytming.bat from

set WINPYDIR=%~dp0..\python-2.7.5

to include ..\

set WINPYDIR=%~dp0..\..\python-2.7.5

Modify cmdpytming.bat from

call %~dp0env.bat

to

call %~dp0pytming.bat

Trick to add .bat files to PATH

If you have permission to change the Environment Variables in windows, you can add the pytming.bat and cmdpytming.bat to your path.
Right click Computer -> properties -> Advanced system settings -> Environment Variables -> User variables -> Edit: PATH
Add to end of the Variable value:

;C:\WinPython27\WinPython-32bit-2.7.x\scripts\own

In any folder, hold "Shift" and right click, "Open command window here". Write:

pytming
python

Install minGW

Download mingw-get-inst, and run it. If you need more help, read this, but you should just do this.

  1. Install to: C:\MinGW
  2. Take all options when installing (about 450 MB)
  3. Take the "pre" package option

After install, edit C:\MinGW\msys\1.0\msys.bat.
Insert at second line a call to our variables:

@echo off
call C:\WinPython27\WinPython-32bit-2.7.5.1\scripts\env.bat
rem Copyright (C):  2001, 2002, 2003, 2004, 2005  Earnie Boyd

Install Subversion checkout of relax

Caution  The information in this section is out of date but is kept for historical reasons. The relax source code is now hosted in a git rather than svn repository.

Install a subversion client. For example: http://tortoisesvn.net/

Right click in winpython folder: C:\WinPython27, and select SVN Checkout. Write the path:

svn://svn.gna.org/svn/relax/branches/relax_disp relax_disp_32_ming

Build relax

Open the MinGW Shell from the start menu.
Write here: NOTE, you can paste into the terminal, using the little icon in top left corner, Edit, Paste

cd /c/WinPython27/relax_disp_32_ming
python /c/WinPython27/WinPython-32bit-2.7.5.1/python-2.7.5/Scripts/scons.py install


See also