Difference between revisions of "Installation windows Python x86-32 Visual Studio Express for Windows Desktop"

From relax wiki
Jump to navigation Jump to search
 
(44 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Download preparation =
+
__TOC__
 +
 
 +
== 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 5: Line 7:
 
# (.exe): wxPython: http://www.lfd.uci.edu/~gohlke/pythonlibs/#wxpython
 
# (.exe): wxPython: http://www.lfd.uci.edu/~gohlke/pythonlibs/#wxpython
 
# (.exe): scons: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scons
 
# (.exe): scons: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scons
# (.zip): minfx: http://download.gna.org/minfx/
+
# (.zip): [{{minfx homepage}} minfx]: https://sourceforge.net/projects/minfx/files/
# (.zip): bmrblib: http://download.gna.org/bmrblib/
+
# (.zip): [{{bmrblib homepage}} bmrblib]: https://sourceforge.net/projects/bmrblib/files/
  
take amd64 versions if you have a computer with 64 bit.
+
'''take the win32 bit versions.'''
  
= Install python and necessary packages =
+
== Install python and necessary packages ==
  
 
I recommend to install a python distribution which is packed with several packages already.
 
I recommend to install a python distribution which is packed with several packages already.
  
== Winpython ==
+
=== Winpython ===
 
You could consider winpython, which includes Ipython, numpy, scipy. matplotlib etc.:<br>
 
You could consider winpython, which includes Ipython, numpy, scipy. matplotlib etc.:<br>
 
[https://code.google.com/p/winpython Homepage]
 
[https://code.google.com/p/winpython Homepage]
Line 20: Line 22:
 
Make a folder: '''C:\WinPython27'''.<br>
 
Make a folder: '''C:\WinPython27'''.<br>
 
Run the downloaded winpython exe file, and extract to: '''C:\WinPython27'''.<br>
 
Run the downloaded winpython exe file, and extract to: '''C:\WinPython27'''.<br>
Open '''WinPython Control Panel''' in ex. '''C:\WinPython27\WinPython-64bit-2.7.5.1'''<br>
+
Open '''WinPython Control Panel''' in ex. '''C:\WinPython27\WinPython-32bit-2.7.x'''<br>
 
Drag the 4 above mentioned packakes, into the window, and install the packages.<br>
 
Drag the 4 above mentioned packakes, into the window, and install the packages.<br>
For a command window, use the '''WinPython Command Prompt''' found in '''C:\WinPython27\WinPython-64bit-2.7.4.1''', which fixes path issues for finding python.
+
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.
  
= Install Visual Studio Express 2012 for Windows Desktop =
+
==== Trick to set variables in cmd ====
[http://msdn.microsoft.com/en-us/library/vstudio/hs24szh9.aspx See versions of VS 2012 here].<br>
+
Make a folder '''own''' in '''C:\WinPython27\WinPython-32bit-2.7.x\scripts''' and <br>
Take 32 bit compiling, since a horrible imprecision bug has been reported for 64 bit building. [https://gna.org/bugs/?20821 See bug #20821].
+
copy '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\env.bat''' to '''C:\WinPython27\WinPython-32bit-2.7.x\scripts\own\pyt32.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>
  
For 32 bit compiling, you will only need, '''Visual Studio Express for Windows Desktop'''.<br>
+
Modify '''pyt32.bat''' from
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>
+
<source lang="python">
Skip all extra packages install. After install, just exit any program, which opened after install.
+
set WINPYDIR=%~dp0..\python-2.7.5
 
+
</source>
== Bugfix scons for 32bit building ==
+
to include '''..\'''
Due to a bug, versions of scons '''<=2.3''' should alter a line in:<br>
+
<source lang="python">
'''C:\WinPython27\WinPython-64bit-2.7.5.1\python-2.7.5.amd64\Lib\site-packages\scons-2.3.0\SCons\Tool\MSCommon\vc.py'''
+
set WINPYDIR=%~dp0..\..\python-2.7.5
 +
</source>
  
Line '''364''':
+
Modify '''cmdpyt32.bat''' from
 
<source lang="python">
 
<source lang="python">
    if not req_target_platform and target_platform in ('amd64','x86_64'):
+
call %~dp0env.bat
        try_target_archs.append('x86')
 
 
</source>
 
</source>
Should be:
+
to
 
<source lang="python">
 
<source lang="python">
    #if not req_target_platform and target_platform in ('amd64','x86_64'):
+
call %~dp0pyt32.bat
    #    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>
 
</source>
  
If not fixing the bug, you will get:
+
==== 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>
 +
Right click Computer -> properties -> Advanced system settings -> Environment Variables -> User variables ->  Edit: PATH <br>
 +
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:
 
<source lang="powershell">
 
<source lang="powershell">
C:\WinPython27\relax_disp>scons
+
pyt32
scons: Reading SConscript files ...
+
python
scons: done reading SConscript files.
+
</source>
scons: Building targets ...
 
  
###########################
+
== Install Visual Studio Express 2012 for Windows Desktop ==
# Compiling the C modules #
+
[http://msdn.microsoft.com/en-us/library/vstudio/hs24szh9.aspx See versions of VS 2012 here].<br>
###########################
 
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
+
For 32 bit compiling, you will only need, '''Visual Studio Express for Windows Desktop'''.<br>
Python27\WinPython-64bit-2.7.5.1\scripts\..\python-2.7.5.amd64\include"
+
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>
'cl' is not recognized as an internal or external command,
+
Skip all extra packages install. After install, just exit any program, which opened after install.
operable program or batch file.
 
scons: *** [target_functions\c_chi2.obj] Error 1
 
scons: building terminated because of errors.
 
</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/trunk relax_trunk
svn://svn.gna.org/svn/relax/branches/relax_disp
 
  
= Build relax =  
+
== Build relax ==  
 
Open the '''WinPython Command Prompt''' <br>
 
Open the '''WinPython Command Prompt''' <br>
 
Navigate to the SVN checked out relax folder.<br>
 
Navigate to the SVN checked out relax folder.<br>
First we need to run the variable setup [http://msdn.microsoft.com/en-us/library/f2ccy3wt(v=vs.110).aspx vcvars32.bat] or [http://msdn.microsoft.com/en-us/library/x4d2c09s.aspx vcvarsall.bat x86] for Microsoft Visual Studio 11.0, before we can compile.
+
cd C:\WinPython27\relax_trunk_32
 +
scons
  
cd C:\WinPython27\relax_disp
+
Or navigate to C:\WinPython27\relax_trunk_32, hold "Shift" and right click, "Open command window here". Write:
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat"
+
  pyt32
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
 
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
 
  "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64
 
 
  scons
 
  scons
(Scons will automatically find CL.exe, and setup compilation for 64 bit.)
 
  
== Modify env.bat ==
+
=== Modify pyt32.bat ===
Modify '''C:\WinPython27\WinPython-64bit-2.7.5.1\scripts\env.bat''', and add to end of file
+
Modify '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\pyt32.bat''', and add to end of file
 
<source lang="powershell">
 
<source lang="powershell">
set PATH=%PATH%;C:\WinPython27\relax_disp
+
set PATH=%PATH%;C:\WinPython27\relax_trunk_32
 
</source>
 
</source>
  
Test installation, by clicking '''C:\WinPython27\WinPython-64bit-2.7.5.1\scripts\cmd.bat''', and write
+
Test installation, by clicking '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\cmdpyt32.bat''', and write
 
<source lang="powershell">
 
<source lang="powershell">
 
relax
 
relax
Line 104: Line 96:
 
</source>
 
</source>
  
=== Tip - shortcut to cmd.bat ===
+
==== Tip - shortcut to cmdpyt32.bat ====
Make shortcut to '''C:\WinPython27\WinPython-64bit-2.7.5.1\scripts\cmd.bat''', and modify the shortcut. Set  
+
Make shortcut to '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\cmdpyt32.bat''', and modify the shortcut. Set  
 
  '''Start in:''' %PWD%
 
  '''Start in:''' %PWD%
 
You can now copy this shortcut around, which open a command prompt at the current folder, and set the paths correctly.
 
You can now copy this shortcut around, which open a command prompt at the current folder, and set the paths correctly.
  
=== Tip - add env.bat to windows path ===
+
== Install other software ==
If you have permission to change the Environment Variables in windows, you can add the '''env.bat''' to your path.<br>
+
=== xmgrace - for the plotting results of NMR-relax ===
Right click Computer -> properties -> Advanced system settings -> Environment Variables -> User variables ->  Edit: PATH <br>
+
relax produces xmgrace "'.agr" files for plotting. There exist two ports for xmgrace to windows [http://qtgrace.sourceforge.net/ QtGrace] and [http://sourceforge.net/projects/gracegtk/ GraceGTK].
Add to end of the Variable value:
 
;C:\WinPython27\WinPython-64bit-2.7.5.1\scripts
 
In any folder, hold "Shift" and right click, "Open command window here". Write:
 
<source lang="powershell">
 
env
 
relax -g
 
</source>
 
  
= Install other software =
+
Download [http://sourceforge.net/projects/qtgrace/files/ qtgrace_windows_binary], and unpack to '''C:\WinPython27\qtgrace_windows_binary'''. <br>
== 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]. <br>
 
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'''
 
Then copy '''C:\WinPython27\qtgrace_windows_binary\bin\qtgrace.exe'''  to '''C:\WinPython27\qtgrace_windows_binary\bin\xmgrace.exe'''
  
Modify '''C:\WinPython27\WinPython-64bit-2.7.5.1\scripts\env.bat''', and add to end of file
+
Modify '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\pyt32.bat''', and add to end of file
 
<source lang="powershell">
 
<source lang="powershell">
 
set PATH=%PATH%;C:\WinPython27\qtgrace_windows_binary\bin
 
set PATH=%PATH%;C:\WinPython27\qtgrace_windows_binary\bin
 
</source>
 
</source>
  
Test installation, by clicking '''C:\WinPython27\WinPython-64bit-2.7.5.1\scripts\cmd.bat''', and write
+
Test installation, by clicking '''C:\WinPython27\WinPython-32bit-xxx\scripts\own\cmdpyt32.bat''', and write
 
<source lang="powershell">
 
<source lang="powershell">
 
xmgrace
 
xmgrace
Line 137: Line 119:
 
which should start xmgrace.
 
which should start xmgrace.
  
== Python editor ==
+
=== Python editor ===
 
A good lightweight editor for windows could [[Pyscripter]]
 
A good lightweight editor for windows could [[Pyscripter]]
  
= Trouble shooting =
+
== Test installation ==
 +
{{caution|After an installation you should really run an [[Installation_test]].}}
  
= See also =
+
== Build manual and API documentation ==
 +
See [[Manual]].
  
 +
== Trouble shooting ==
  
 +
== See also ==
  
 
[[Category:Installation]]
 
[[Category:Installation]]

Latest revision as of 21:42, 6 October 2020

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: https://sourceforge.net/projects/minfx/files/
  4. (.zip): bmrblib: https://sourceforge.net/projects/bmrblib/files/

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\pyt32.bat
and copy C:\WinPython27\WinPython-32bit-2.7.x\scripts\cmd.bat to C:\WinPython27\WinPython-32bit-2.7.x\scripts\own\cmdpyt32.bat

Modify pyt32.bat from

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

to include ..\

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

Modify cmdpyt32.bat from

call %~dp0env.bat

to

call %~dp0pyt32.bat

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.
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:

pyt32
python

Install Visual Studio Express 2012 for Windows Desktop

See versions of VS 2012 here.

For 32 bit compiling, you will only need, Visual Studio Express for Windows Desktop.
From http://www.microsoft.com/visualstudio/eng/downloads, download and install: Visual Studio 2012 Express for Windows Desktop.
Skip all extra packages install. After install, just exit any program, which opened after install.

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/trunk relax_trunk

Build relax

Open the WinPython Command Prompt
Navigate to the SVN checked out relax folder.

cd C:\WinPython27\relax_trunk_32
scons

Or navigate to C:\WinPython27\relax_trunk_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

set PATH=%PATH%;C:\WinPython27\relax_trunk_32

Test installation, by clicking C:\WinPython27\WinPython-32bit-xxx\scripts\own\cmdpyt32.bat, and write

relax
relax -g

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 QtGrace and GraceGTK.

Download qtgrace_windows_binary, and unpack to C:\WinPython27\qtgrace_windows_binary.
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

set PATH=%PATH%;C:\WinPython27\qtgrace_windows_binary\bin

Test installation, by clicking C:\WinPython27\WinPython-32bit-xxx\scripts\own\cmdpyt32.bat, and write

xmgrace

which should start xmgrace.

Python editor

A good lightweight editor for windows could Pyscripter

Test installation

Caution  After an installation you should really run an Installation_test.

Build manual and API documentation

See Manual.

Trouble shooting

See also