Changes between Initial Version and Version 1 of DevNotes/DevGuide/CondaDevSetup4.x


Ignore:
Timestamp:
Mar 19, 2019 9:10:20 AM (5 years ago)
Author:
wojciech
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • DevNotes/DevGuide/CondaDevSetup4.x

    v1 v1  
     1= Easy Developer Setup Using Anaconda = 
     2== Step 1 - Install Anaconda == 
     3Download the latest '''64-Bit''' Python '''2.7''' Installer from https://repo.continuum.io/archive/ and run it. 
     4 
     5 * 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). 
     6 
     7 * 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. 
     8 
     9 * 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.[[BR]] 
     10 * 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. 
     11 
     12== Step 2 - Download !SasView and sasmodels from github == 
     13If you don't have git installed, go to the GIT section below ([#anchor1 Step 7]) for instructions, otherwise simply run 
     14 
     15{{{ 
     16git clone https://github.com/SasView/sasview.git sasview 
     17git clone https://github.com/SasView/sasmodels.git sasmodels 
     18}}} 
     19== Step 3 - Install dependencies == 
     20Go to folder: 
     21 
     22{{{ 
     23sasview/build_tools/conda/ymls 
     24}}} 
     25and create conda enviroment using yml specific for your platform (needs to be run from top-level not within a conda virtual environment) 
     26 
     27{{{ 
     28#Windows 
     29conda env create -f sasview-env-build_win.yml 
     30 
     31#Mac OSX 
     32conda env create -f sasview-env-build_osx.yml 
     33 
     34#Linux 
     35conda env create -f sasview-env-build_linux.yml 
     36}}} 
     37=== Other dependencies === 
     38Note 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: 
     39 
     40{{{ 
     41conda install -c conda-forge make 
     42}}} 
     43On 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. 
     44 
     45Likewise 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''. 
     46 
     47You 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. 
     48 
     49Also see Step 5 below. 
     50 
     51'''''TODO: Mac instructions?''''' 
     52 
     53== Step 4 - activate conda enviroment == 
     54{{{ 
     55#Windows 
     56activate sasview 
     57 
     58else if running from inside a Git Bash shell use:  
     59source activate sasview. 
     60 
     61#Mac OSX and Linux 
     62source activate sasview 
     63}}} 
     64== Step 5 - run !SasView == 
     65You should be ready to run sasview.  Go to sasview directory and run 
     66 
     67{{{ 
     68 
     69#Windows 
     70python run.py 
     71 
     72#Mac OSX and Linux 
     73pythonw run.py 
     74 
     75To build the documentation you will still first need to do: 
     76 
     77python setup.py docs  
     78 
     79}}} 
     80If, when the docs build, you get an error like this: 
     81 
     82{{{ 
     83Traceback (most recent call last): 
     84  File "C:\Anaconda2x64\envs\sasview\lib\site-packages\Sphinx-1.4.8-py2.7.egg\sphinx\ext\autodoc.py", line 519, in import_object 
     85    __import__(self.modname) 
     86  File "D:\SasViewDevelopment\sasview\build\lib.win-amd64-2.7\sas\sasgui\plottools\config.py", line 39, in <module> 
     87    pkg_resources.require("matplotlib>=" + plot_version) 
     88  File "C:\Anaconda2x64\envs\sasview\lib\site-packages\pkg_resources\__init__.py", line 981, in require 
     89    needed = self.resolve(parse_requirements(requirements)) 
     90  File "C:\Anaconda2x64\envs\sasview\lib\site-packages\pkg_resources\__init__.py", line 867, in resolve 
     91    raise DistributionNotFound(req, requirers) 
     92DistributionNotFound: The 'mock' distribution was not found and is required by matplotlib 
     93}}} 
     94Also install the dependencies ''mock'' and ''nose''. 
     95 
     96== [=#anchor1 Step 6 - try the new sasview 5 with qt gui] == 
     97Sasview 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. 
     98 
     99Using Git Bash, `cd` to your sasview directory and run: 
     100 
     101{{{ 
     102git checkout ESS_GUI 
     103}}} 
     104There are now a number of operating system dependent .yml files in sasview/build_tools, cd to there then e.g. for Windows 
     105 
     106{{{ 
     107conda env create -f conda_qt5_win.yml --name qt5 
     108}}} 
     109''[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.]'' 
     110 
     111In an Anaconda prompt (or equivalently in Git Bash, if your Anaconda installation is in your $PATH), run: 
     112 
     113{{{ 
     114conda activate qt5 
     115}}} 
     116or else do [is there any difference?]: 
     117 
     118{{{ 
     119source activate qt5 
     120}}} 
     121On 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. 
     122 
     123You can now run `python run.py` as usual to start the application. 
     124 
     125''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.'' 
     126 
     127''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.'' 
     128 
     129''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'' 
     130 
     131=== Other useful conda commands === 
     132`conda info --envs` This will show that you now have both sasview and qt5 environments. 
     133 
     134---- 
     135`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. 
     136 
     137---- 
     138If 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. 
     139 
     140`conda env update -f=/path to file/conda_py3_qt5_env.yml --name qt5` 
     141 
     142---- 
     143== [=#anchor1 Step 7 - Install Git (Optional)] == 
     144Install Git for your platform by following instructions: 
     145 
     146{{{ 
     147https://git-scm.com/book/en/v2/Getting-Started-Installing-Git 
     148}}} 
     149When 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. 
     150 
     151Set up your credentials: 
     152 
     153{{{ 
     154git config --global user.name "John Doe" 
     155git config --global user.email johndoe@example.com 
     156}}} 
     157If you work behind proxy remmber to configure 
     158 
     159{{{ 
     160e.g. git config --global http.proxy 192.168.1.1:XXXX  
     161}}}