= Build Instructions for Windows = - !SasView is currently building on 32 bit. However with the move to Wx3.0 it should be possible to build in 64 bit. Make sure at least to download all 32 or all 64 bit packages. - The instructions below make use of the python distribution from python.org. We are in the process of assessing a move to anaconda as the preferred developer distribution. If you want to try that out, see [http://trac.sasview.org/wiki/AnacondaSetup]. == Install Python == - Install python 2.7 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 3.0 == - Get wxPython 3.0 from [http://www.wxpython.org/download.php#stable] == Install other external packages == - There are several external packages that need to be installed. A complete up to date list can be found [wiki:WinBuildDependencies here] - 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.7). -- Example 1 (Using correct version of Python) {{{ c:\>python --version Python 2.7 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:/Python27/python.exe setup.py install }}} == Get the source code == - To obtain the source code you need to have git running. if you haven't already got it, it can be obtained from [https://github.com/msysgit/msysgit/releases/ github]. - Using git clone type the following onto the command line will allow you to checkout the code and put it into the directory 'c:/sasview' {{{ c:\>git clone https://github.com/SasView/sasview.git C:\sasview }}} - Alternatively one can install git with a GUI. A good one can be obtained from [https://code.google.com/p/tortoisegit/ tortoise]. == Build !SasView == - Now that the files are downloaded it's time to build. Go to where you downloaded !SasView and look for a file called 'run.py' which we shall use to build !SasView. Use the code below on the command line in order to build !SasView. Note that run.py will run setup.py build as needed but will only compile all the C if there have been changes to the C code. Setup.py docs should be run after !SasView has been built. This will run Sphinx to run the documentation {{{ c:\sasview>python run.py C:\sasview>python setup.py docs }}} - 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 we 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 or 64 bit compatible depending on your setup). 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:\sasview>python setup.py build -mingw32 }}} == Install !SasView == - Installing is straight forward. Use a similar approach to building !SasView by using the code below. {{{ c:\sasview\trunk>python setup.py install --user }}} - Note: If you get an error message saying it is Unable to find vcvarsall.bat then see the solution on [http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat Stackoverflow] == Run !SasView == - Use the following command to run !SasView. (Make sure you are in the directory where sasview.py is located). {{{ c:\sasview\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 C:\sasview. {{{ 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. - Read the instruction on how I did it below or follow this simple [https://confluence.aps.anl.gov/download/attachments/2523138/PyDev.pdf?version=1&modificationDate=1305235496000 guide] by Pete Jemian. - This section will explain how to set up !SasView 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 SasView 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. - Add the directory where the external packages are stored to the !PyDev settings. ''Window ‣ Preferences ‣ !PyDev ‣ Interpreter-Python ‣ Libraries ‣ New Folder''. - If you still have errors with wxPython then remove your interpreter and add it again. After a restart of Eclipse the errors should have disappeared. - Finally right click on the project, properties and then change the !PyDev PYTHONPATH so that it contains the build directory. This is needed for debugging purposes. - Open sansview.py and hit the run button. [[Image(http://i.imgur.com/DTu5A.png, 800px)]] - Done!