Version 34 (modified by richardh, 6 years ago) (diff) |
---|
Easy Developer Setup Using Anaconda
Step 1 - Install Anaconda
Download the latest 64-Bit Python 2.7 Installer from https://repo.continuum.io/archive/ and run it.
- The recommended destination folder is as good as any. If you deviate from this then it's probably worthwhile to make sure the path is short and contains no spaces, and is not the same as any previous installation (one reader installed 64 bit on top of previous 32 bit, not a good idea).
- At the Advanced Options screen, you need to consider whether or not you want to make Anaconda your default version of Python. Developers who do not work on multiple Python projects can just accept the defaults here.
- By default of Windows anaconda is installed for single user and not "everyone", which means you cannot run the conda command from an arbitrary command window. If you proceeded with default installation, you need to open Anaconda Prompt from Menu Start. Otherwise you can install anaconda for everyone, which requires root privileges. If "conda" is not a recognised command then add the install directory to your Windows user Path variable.
- If you have a failing reference to a "conda.binstar.org/PeterParker/win-64/repodata.json" file, then edit this out of the anaconda start up file at users/username/.condarc as you may still have left it there from an older sasview installation system.
Step 2 - Download SasView and sasmodels from github
If you don't have git installed, go to the GIT section below (Step 7) for instructions, otherwise simply run
git clone https://github.com/SasView/sasview.git sasview git clone https://github.com/SasView/sasmodels.git sasmodels
Step 3 - Install dependencies
Go to folder:
sasview/build_tools/conda/ymls
and create conda enviroment using yml specific for your platform (needs to be run from top-level not within a conda virtual environment)
#Windows conda env create -f sasview-env-build_win.yml #Mac OSX conda env create -f sasview-env-build_osx.yml #Linux conda env create -f sasview-env-build_linux.yml
Other dependencies
Note that in order to build the documentation, you will require a version of GNU Make (the make command). On Linux, you can obtain this with your package manager. On Windows 7, activate your new conda environment and run the following:
conda install -c conda-forge make
On Windows 10, you may find that the make command does not work with the above method, type make to see if it is a recognised command. You can find a Windows-compatible build of GNU Make here: http://gnuwin32.sourceforge.net/packages/make.htm Ensure that you add the install directory to your PATH.
Likewise on WIndows 10, python setup.py docs for some reason still needs a gcc compiler even though the main compile uses MSVC, type gcc to see if it is a recognised command, install mingw and make sure your path has e.g. c:/mingw/bin.
You may have to delete some old .so compiled files from [c:/users/yourusername/.sasmodels/compiled_models c:\users\yourusername\.sasmodels\compiled_models] if there is some 32 to 64 but muddle or change.
Also see Step 5 below.
TODO Mac instructions?
Step 4 - activate conda enviroment
#Windows activate sasview else if running from inside a Git Bash shell use: source activate sasview. #Mac OSX and Linux source activate sasview
Step 5 - run SasView
You should be ready to run sasview. Go to sasview directory and run
#Windows python run.py #Mac OSX and Linux pythonw run.py To build the documentation you will still first need to do: python setup.py docs
If, when the docs build, you get an error like this:
Traceback (most recent call last): File "C:\Anaconda2x64\envs\sasview\lib\site-packages\Sphinx-1.4.8-py2.7.egg\sphinx\ext\autodoc.py", line 519, in import_object __import__(self.modname) File "D:\SasViewDevelopment\sasview\build\lib.win-amd64-2.7\sas\sasgui\plottools\config.py", line 39, in <module> pkg_resources.require("matplotlib>=" + plot_version) File "C:\Anaconda2x64\envs\sasview\lib\site-packages\pkg_resources\__init__.py", line 981, in require needed = self.resolve(parse_requirements(requirements)) File "C:\Anaconda2x64\envs\sasview\lib\site-packages\pkg_resources\__init__.py", line 867, in resolve raise DistributionNotFound(req, requirers) DistributionNotFound: The 'mock' distribution was not found and is required by matplotlib
Also install the dependencies mock and nose.
Step 6 - try the new sasview 5 with qt gui
Sasview is being reworked, in the ESS_GUI git branch, to use PyQT 5.0 for the GUI. Please note that this branch uses exclusively Python 3. There is no need to install Anaconda again, because the environment YAML file (see below) will ensure that Python 3 is installed.
Using Git Bash, cd to your sasview directory and run:
git checkout ESS_GUI
There are now a number of operating system dependent .yml files in sasview/build_tools, cd to there then e.g. for Windows
conda env create -f conda_qt5_win.yml --name qt5
[Note - if later whilst running sasview you have problems with models not compiling or loading, close sasview, delete the contents of the directory users/your-user-name/.sasmodels/compiled_models, then re-start, which will force re-compilation using the current compiler.]
In an Anaconda prompt (or equivalently in Git Bash, if your Anaconda installation is in your $PATH), run:
conda activate qt5
or else do [is there any difference?]:
source activate qt5
On Windows, as of July 2018, you will need to install Build Tools for Visual Studio 2015. This is found under the 2017 label, confusingly: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017 Download the installer and run it. Find "Visual Studio Build Tools 2017" and click Install. In the window that appears, navigate to "Individual components" and ensure that "VC++ 2015.3 v14.00 (v140) toolset for desktop" and a relevant Windows SDK (e.g. Windows 10 SDK, if you are using Windows 10) are selected. Finally, click Install.
You can now run python run.py as usual to start the application.
If you then get a fatal error LNK1158: cannot run rc.exe, then following some advice found on web, try copying files rc.exe and rcdll.exe from e.g. C:\Program Files (x86)\Windows Kit\10\bin\10.0.17763.0 to Program files (x86)\Microsoft visual Studio 14.0\VC\bin\x86_amd64 (which is the path to the MSVC compiler reported in gitbash window). Simply adding a path to the other directory did not work in this case.
If run.py gives an error from line 1140 in readCategoryInfo, you likely have the old version of the categories file. Delete the file serial_cat.json from your user directory ( c:/users/username/.sasview in Windows) and then run the latest *release* version of sasview. This will automatically generate the correct categories.json file.
If qt5 sasview does not run the first time through, try going back to the normal sasview master (git checkout master), then repeat the steps above once more (trust me it may then work!). Else, perhaps even better, force a complete rebuild by deleting the sasview\build directory
Other useful conda commands
conda info --envs This will show that you now have both sasview and qt5 environments.
conda env remove --name qt5 This will remove the qt5 environment, though the files involved seem to stay on your hard drive so a new conda env create is much faster than the first time.
If something fails part way through creating an environment, such as not removing the pip install for sasview & sasmodels, then "update" will be faster (though is not generally recommended, stick to "create") e.g.
conda env update -f=/path to file/conda_py3_qt5_env.yml --name qt5
Step 7 - Install Git (Optional)
Install Git for your platform by following instructions:
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
When installing on Windows, it may be worthwhile to make sure "Use Git from the Windows Command Prompt" is selected, rather than "Use Git from Bash only". This way you can use git from the same command line as you will use Anaconda.
Set up your credentials:
git config --global user.name "John Doe" git config --global user.email johndoe@example.com
If you work behind proxy remmber to configure
e.g. git config --global http.proxy 192.168.1.1:XXXX