= Build Instructions for Windows = - SansView works with wxPython where there is currently no 64-bit version. If you have a 64-bit computer then please download 32-bit versions of python, wxpython and all the other external packages. == Install Python == - Install 32-bit python 2.5 or above from [http://www.python.org/download/releases/][[BR]] - If you have two or more versions of python then you will have to make sure you use the correct version of python when installing packages and running python. You can check this on the command terminal by entering {{{ python --version }}} - If the correct version isn't displayed then it's probably not set as an environmental variable. These can be changed in ''My Computer ‣ Properties ‣ Advanced ‣ Environment Variables'' The directory where python is located should be entered under 'PATH' and 'PYTHONPATH'. - If this doesn't work then a '''temporary''' fix is setting the path on the command line. An example of this is below. {{{ PATH c:/Python25; %PATH% }}} == Install wxPython 2.8 == - Get 32-bit wxPython 2.8 (not 2.9) from [http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/wxPython2.8-osx-unicode-2.8.12.1-universal-py2.6.dmg/download] == Install other external packages == - Some packages don't come in a friendly .exe file. To install these you will have to use the command terminal. There are two examples below of how to install. (The example installs periodictable using Python 2.6). -- Example 1 (Using correct version of Python) {{{ c:\>python --version Python 2.6 c:\>cd C:\Users\rqh12525\Desktop\Periodic table\periodictable-1.3.0 C:\Users\rqh12525\Desktop\Periodic table\periodictable-1.3.0>python setup.py install }}} -- Example 2 (Forcing to install using the correct version of Python) {{{ c:\>cd C:\Users\rqh12525\Desktop\Periodic table\periodictable-1.3.0 C:\Users\rqh12525\Desktop\Periodic table\periodictable-1.3.0>c:/Python26/python.exe setup.py install }}} - There are several external packages that need to be installed. -- matplotlib-0.99.x [https://sourceforge.net/projects/matplotlib/files/] -- numpy-1.4.x [https://sourceforge.net/projects/numpy/files/] -- scipy-0.7.x [https://sourceforge.net/projects/scipy/files/] -- lxml-2.2 [http://pypi.python.org/pypi/lxml/] -- pyparsing [https://sourceforge.net/projects/pyparsing/files/] -- periodictable-1.3 [http://pypi.python.org/pypi/periodictable#downloads] -- setuptools [http://pypi.python.org/pypi/setuptools#downloads] -- comtypes [https://sourceforge.net/projects/comtypes/files/] -- pywin32 [https://sourceforge.net/projects/pywin32/files/] -- PIL(optional) [http://www.pythonware.com/products/pil/] -- Check the [http://danse.us/trac/sans/browser/releases/sansview-2.0.0/releases_notes.txt release notes] to see if any more are needed. -- A lot of the packages are optional because they will be downloaded automatically while installing SansView. However, if the latest version isn't compatible with the version of Python you have downloaded then it will throw an error and leave you confused why it didn't install. To be on the safe side download and install all packages before attempting SansView. == Get the source code == - One of the ways of getting the source code is using subversion. You can get subversion [http://subversion.tigris.org/ here] if you haven't already got it. If you want to do it a harder way then you can download the source code [https://sourceforge.net/projects/sansviewproject/files/ here]. - Using subversion copy this onto the command line. It will allow you to checkout the code and put it into the directory 'c:/sansviewproject' {{{ c:\>svn co https://sansviewproject.svn.sourceforge.net/svnroot/sansviewproject sansviewproject }}} - An easier way to use subversion is by downloading [https://sourceforge.net/projects/tortoisesvn/files/ Tortoise SVN]. This is a GUI for subversion. - Note: You may need to add proxy settings for Subversion to work. Instructions on how to do this are [https://docs.opends.org/wiki/page/ConfiguringSubversionToUseAProxyServer?version=2 here]. It can be achieved using Tortoise SVN a lot simpler by going to ''TortoiseSVN ‣ Settings ‣ Network''. == Build SansView == - Now that the files are downloaded it's time to build. Go to where you downloaded sansview and look for the folder named 'trunk'. Inside this folder you should have a file called 'setup.py' which we shall use to build SansView. Use the code below on the command line in order to build SansView. {{{ c:\sansviewproject\trunk>python setup.py build }}} - Note: You may get an error saying "Error: Python was built with Visual Studio 2003; extensions must be built with a compiler that can generate compatible binaries". To solve this issue it will recommend using Cygwin and to compile with MinGW32. The best thing about this is that you don't have to actually use Cygwin. First go to the download page of MinGW and download the latest version. [https://sourceforge.net/projects/mingw/files/] (Making sure it's 32-bit compatible). Next make sure the PATH variable is set to the folder containing the MinGW32 GCC. (Usually found in 'C:\MinGW\bin'). Next enter the following into the command terminal. {{{ c:\sansviewproject\trunk>python setup.py build -mingw32 }}} == Install SansView == - Installing is straight forward. Use a similar approach to building SansView by using the code below. {{{ c:\sansviewproject\trunk>python setup.py install --user }}} == Run SansView == - Use the following command to run SansView. (Make sure you are in the directory where sansview.py is located). {{{ c:\sansviewproject\trunk\sansview>python sansview.py }}} - Note: If you get a similar error to the one below then make sure the PATH's contain where to find the modules. This is usually the trunk folder in sansviewproject. {{{ Traceback (most recent call last): File "sansview.py", line 27, in from sans.guiframe import gui_manager ImportError: No module named sans.guiframe }}} == Set up IDE (Optional) == - This section is optional, if you want to use an IDE like [http://www.eclipse.org Eclipse] and not a text editor like [http://www.vim.org Vim] then carry on reading. - This section will explain how to set up SansView in Eclipse because it's the most commonly used open-source IDE. Get a copy and install it on your computer. [http://www.eclipse.org/downloads/] - Now you will need to download the !PyDev plugin for Eclipse in order to get the python to work. [https://sourceforge.net/projects/pydev/files/] - Once these are installed load up Eclipse. It will ask for a workspace directory to store the project files in, you can choose anywhere. - Make sure that you are in PyDev mode. You can see this in the top right corner of Eclipse. - Setup a new project. ''File ‣ New ‣ PyDev Project''. Name it something sensible like SansView Project. Leave all options as default but make sure the option "Create 'src' folder and add it to the PYTHONPATH" is selected. - Then, you have to go to ''File ‣ Import'', and choose the File System option: [[Image(http://1.bp.blogspot.com/_SDci0Pf3tzU/SVokhZBDNfI/AAAAAAAAEbg/_2sVRjA-PCM/s400/Import+Eclipse.jpg)]] - Select the directory where your files are located and the input Folder, and click finish. - Finally add the directory where the external packages are stored to the PyDev settings. ''Window ‣ Preferences ‣ PyDev ‣Interpreter-Python ‣ Libraries ‣ New Folder''. - Open sansview.py and hit the run button. [[Image(http://i.imgur.com/DTu5A.png, 800px)]] - Done!