Skip to content

DevNotes_DevEnviroment

Lucas Wilkins edited this page May 13, 2022 · 14 revisions

This page covers minimum instructions to setup SasView developers envroment. If you run into and issues please visit this link, which covers quite a few solutions.

Step 1 - Install anaconda

Download the latest 64-Bit Python 3.x Installer from ​https://repo.continuum.io/archive/ (e.g. Anaconda3-2020.11-MacOSX-x86_64.pkg or Anaconda3-2020.11-Windows-x86_64.exe) and run it.

Step 1.2 - Install Microsoft Visual C++ 14 Build Tools (Windows only)

Some Python packages installed later require the Microsoft Visual C++ 14 build tools. If not already installed, e.g. by the complete Visual Studio, use ​this link to download the Visual C++ 2015 Build Tools directly. That will install Visual C++ 14 without installing Visual Studio. Installation requires Administrator permissions and will require a system restart in order to build the models.

Step 2 - Download SasView and sasmodels from github

If you don't have git installed, go to the GIT section below (Step 6) 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/

And create a conda environment using the yml specific to your platform (needs to be run from top-level not within a conda virtual environment)

#Windows
conda env create -f conda_qt5_win.yml

#Mac OSX
conda env create -f  conda_qt5_min_osx.yml

#Linux
conda env create -f conda_qt5_min_ubuntu.yml

Troubleshooting tip: The environment creation step occasionally fails during the download and installation of external packages. If you experience this issue, try updating your conda environment to the latest version. To do this, switch to the base conda environment (conda deactivate) and then update the base conda environment using conda update conda. Remove the failed environment installation using conda remove --name qt5_(win|osx|ubuntu) then retry step 3.

Note that in order to build the documentation, you will require a version of GNU Make (make command) (see Step 7).

Note 2: In time you will need to update the dependencies as they are added or changed in the yml files (see Step 8)

Step 4 - activate conda environment

#Windows
activate qt5_win

else if running from inside a Git Bash shell use: 
source activate qt5_ubuntu

#Mac OSX
conda activate qt5_osx

#Linux
conda activate qt5_ubuntu

Step 5 - run SasView

You should be ready to run sasview. Go to sasview directory and run

python run.py

To build the documentation you will still first need to do:

python setup.py docs 

Step 6 - 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 [email protected]

If you work behind proxy remmeber to configure

e.g. git config --global http.proxy 192.168.1.1:XXXX 

Step 7 - GNU Make Installation (Optional)

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

Step 8 - Keeping your dependencies up to date (Updating the depencies)

As with the dependency installation, go to folder:

sasview/build_tools/

Then update your conda environment using the yml file specific to your platform (again, this should be run from top-level not within a conda virtual environment. i.e.: execute deactivate)

#Windows
conda env update --name qt5_win -f conda_qt5_win.yml --prune

#Mac OSX
conda env update --name qt5_min_osx -f  conda_qt5_osx.yml --prune

#Linux
conda env update --name qt5_min_ubuntu -f conda_qt5_ubuntu.yml --prune

NOTES:

  • Make sure to use the name you gave your environment if different from the above.
  • If you are not in your build_tools directory you can achieve the same thing by fully specifying the path in the name directive as in
condat env update --name qt5_xx -f c:\xxx\sasview\build_tools\conda_qt5_xxx.yml --prune
  • The --prune directive removes dependencies from the environment that are no longer in the yml file.
Clone this wiki locally