Skip to content

Windows Installation

ZhangxiJesseFeng edited this page Jul 18, 2023 · 13 revisions

There are two ways of installing the milk package on Windows. One way is to use the Windows Subsystem for Linux (WSL) feature, and the other using Windows command prompt (WCP). We do not recommend the WSL installation unless you like to mess around getting the entire ecosystem to work. Windows is less tested than the MAC and Linux environments. If you found a bug report an issue in issues tab of the MILK github.

WCP (Recommended)

Note 6/3/2023: There is a dependence issue we are solving for the Mystic/Spotlight tutorials. For now, only the MILK and CINEMA environments can be installed for Windows.

  1. Install programs

  2. After anaconda is installed hit windows key and open "Anaconda Prompt". Navigate to the MILK clone folder using the command line. Then type the following commands:

conda env create -f environments/environment_windows.yml
conda activate rietveld
milk-config C:\Users\username\Workshop\Maud -c C:\Users\username\Workshop\cinema_debye_scherrer
  1. Replace C:\Users\username\Workshop\Maud and C:\Users\username\Workshop\cinema_debye_scherrer with the full paths to where you unzipped and copied Maud and where you cloned Cinema.

  2. After the paths are added with the milk-config command, you need to deactivate and then activate milk for the environment to be initialized:

conda deactivate
conda activate rietveld
  1. Next, open Visual studio code (VSC) and install Python extensions.
setting up visual studio code
  1. Open the MILK folder in Visual Studio code, and then open any Python file in the explorer, such as "setup.py".

image

  1. Now you can set the default python interpreter. Press ctrl + shift + p to trigger the command pallet. Select Anaconda as the interpreter.

image

  1. From the menu on the top, create a new terminal. It normally starts with Powershell, change to command prompt as the default terminal. Activate milk in this terminal with conda activate milk

image

  1. To validate the installation, we will now do tutorial 1 and 3. Navigate to a folder of choice (e.g. C:\Users\username\Workshop\Tutorials) and type the following commands in the Visual Studio code terminal with the milk environment active to copy the folders containing files for these two examples into the current working directory:
(rietveld) C:\Users\username\Workshop\Tutorials>milk-examples -e 1
(rietveld) C:\Users\username\Workshop\Tutorials>milk-examples -e 3
  1. Before running the first example, open the folder containing Maud then double click "Maud.bat" to launch Maud. Configure the compute environment in the Maud GUI and set the parallel options. Make sure to select "Save on disk":

image

image

  1. Turn on the console to view run-time messages from Maud:

image

  1. Following the wiki page for the first example, first run the batch processing via the MAUD GUI method to verify that everything works then run with MILK scripts.

WSL

NOTE: The WSL method currently has issues with Cinema visualization.

  1. To enable WSL, type "Turn Windows Features on or off" in the start menu. Scroll down and check the box for "Windows Subsystem for Linux.
  2. Search for WSL on Windows Store and install Ubuntu-22.04.2.
    • Ubuntu will install then prompt you to create an account. When creating the username, use all lowercases and no special characters like space.
    • Update the Ubuntu system by running sudo apt update then sudo apt upgrade.
  3. Install Anaconda for Linux:
    • Navigate to Anaconda downloads and find the Anaconda for Linux version for your computer, most likely the 6"4-Bit (x86) Installer". Copy the link address of the file to download.
    • You are most likely in "/home/username/" folder, create a Downloads folder with mkdir Downloads
    • Use command wget [link] and replace [link] with the link of the Anaconda installer. This will download the installation script to the folder. Pasting in the WSL command line is mouse right click.
    • Use command 'bash Anaconda....sh` to install with the downloaded Anaconda script. Type "Ana" then press "tab" to let the terminal auto-complete the name.
    • When prompted to restart the shell to let the installed Anaconda take effect, simply use command source ~/.bashrc to refresh the shell. Now you will see (base) appearing in front of the username and path handle.
  4. Install Mambaforge for Linux:
    • Navigate to MambaForge site and copy the link address for Mambaforge for Linux, then use wget then bash, and finally source like we did with Anaconda.
  5. Download MILK, Maud, and Cinema to Workshop folder.
    • The purpose of Mambaforge is to fully install MILK. Before that, let's download these packages. Git is by default installed with Ubuntu.
    • You are still in "Download" folder, navigate to directory above with cd .. then create a Workshop folder mkdir Workshop. Then go in the folder with cd Workshop.
    • Use command git clone https://github.com/lanl/MILK.git to download MILK into Workshop.
    • Use command git clone https://github.com/cinemascience/cinema_debye_scherrer.git to download Cinema into Workshop.
    • To download Maud, navigate to Maud Linux and download "Maud.tar.gz" to anywhere on your computer. Unzip the file and it will make a Maud folder and a _MACOSX folder. You can ignore the MACOSX folder and delete it.
    • You won't be able to download the zip file or unzip directly into the Linux directory, but you can find the Ubuntu local files in your file explorer at the bottom of the left side under "Network", then copy the unzipped Maud folder into it:

image

image

  1. Check that you can see MILK, Maud, and Cinema with ls.
  2. Navigate into the MILK folder cd MILK then use Mamba to install MILK and all the dependencies: mamba env create -f environments/environment_linux.yml
  3. Now you can use conda to activate the "rietveld" environment: conda activate rietveld
  4. First, verify that the pip is installed correctly by typing "milk-" then press "tab" for auto-complete. Your terminal should print out all the installed python scripts in MILK:

image

  1. Finalize initializing MILK
    • Find the path to Maud in the WSL Linux environment by navigating to the Maud folder: cd ../Maud. Then use pwd to print the directory path, copy the path and put in a temporary notepad instance,
    • Do the same for Cinema path.
    • Running milk-config \path\to\MAUD -c \path\to\Cinema and replace \path\to\MAUD with the Maud path you copied, and \path\to\Cinema with the Cinema path you copied.
    • Refresh the conda environment by first deactivate conda deactivate then activate conda activate rietveld. Now you can type $MAUD_PATH and $CINEMA_PATH and it should print the paths we entered before.
  2. Finally, download and install Visual Studio code and add the Python and WSL extensions.
  3. In Visual Studio with WSL extension added and WSL terminal configured, you can click bottom left corner to connect to WSL:

image

  1. Now you can create a terminal in Visual Studio code and activate the rietveld environment there. This will be helpful for your own development needs as you can now open the scripts and execute them in the same place.

image

  1. To use Cinema, we need to enable WSL to open a browser to display the data. To do so, run the commands below or read for more detail here: https://github.com/wslutilities/wslu
sudo apt update
sudo apt install ubuntu-wsl
sudo add-apt-repository ppa:wslutilities/wslu
sudo apt update
sudo apt install wslu
  1. Complete WSLU installation by adding the line export BROWSER=wslview to your $HOME/.bashrc:
    • Type `nano $HOME/.bashrc'
    • Use down arrow key to go to the bottom of the file.
    • Copy the line export BROWSER=wslview
    • Control + O to save, enter to confirm. Control + X to close.
Clone this wiki locally