— Homebrew Installation#

Press here for Windows

Video Guide — description found below

Step 1: Install Homebrew#

  1. Go to this website and follow the instructions.

  2. The Homebrew website will ask you to open a terminal. Find the Terminal using your Spotlight search (Command+Space) and press Enter. You might get asked several times for your password to grant permissions.

    Note: your password will not be shown while typing it.

    Do not close the terminal once the installation script has finished.

    ../../_images/MacOS-SpotlightSearch-Terminal.png ../../_images/macos-package-managed-homebrew.png
  3. NOTE: Not all MacOS requires this step!

    If Homebrew requests you to execute commands under Next steps:, then complete this step.

    Add Homebrew to the PATH by copying, pasting and running the code that Homebrew displays in the Terminal (look at the picture below for guidance). Press Enter once you have pasted the code. The code should look similar to the following image but might differ slightly for different MacOS versions.

    ../../_images/macos-package-managed-homebrew-terminal-instructions.png

Step 2: Install Miniconda and Python#

Installs all packages required for the 1st year Polytechnical Foundation courses at DTU.

  1. Close the previously used Terminal, and open up a new Terminal using Spotlight search (Command+Space and search for Terminal).

  2. Paste the following code in the Terminal and press Enter.

    brew install --cask miniconda
    
  3. Paste the following code in the Terminal and press Enter.

    conda init "$(basename "${SHELL}")"
    eval "$(conda "shell.$(basename "${SHELL}")" hook)"
    
  4. Run the following command in the Terminal by copying, pasting and pressing Enter:

    conda config --add channels conda-forge ; conda config --remove channels defaults ; conda config --set channel_priority strict
    

    Tip

    You can copy and paste code in the gray code blocks by hovering your mouse over the block and pressing the icon appearing in the top right.

  5. Run the following command in the Terminal by copying, pasting and pressing Enter:

    conda install python=3.11 dtumathtools pandas scipy statsmodels uncertainties -y
    

Step 3: Install Visual Studio Code#

Install Visual Studio Code by pasting the following in your terminal and pressing Enter.

brew install --cask visual-studio-code

Step 4: Install extensions for Visual Studio Code#

  1. Open Visual Studio Code and select the Extensions extensions tab on the left.

    ../../_images/VSC-extensions.png
  2. Search for Python, and download the extension. Make sure that it is from Microsoft.

    ../../_images/macos-package-managed-python.png
  3. Hereafter search for Jupyter, and download that extension as well. This also needs to be from Microsoft.

    ../../_images/macos-package-managed-jupyter.png

Verification#

Verify that your installation is successful by following these steps:

  1. Search for Terminal using your Spotlight search (Command+Space) and press Enter. Verify that (base) is shown to the left of your username. Something like the image below:

  2. Type idle3 in the Terminal, then press Enter. This should open a new window in which you can run Python code.

  3. Verify the IDLE window says Python 3.11.X in the top left (or in the range of 3.8 – 3.11).

  4. Copy the following Python code into the IDLE window, then press Enter:

    import dtumathtools, pandas, scipy, statsmodels, uncertainties
    

    Verify that a new line (>>>) appears without any text (indicating everything got imported correctly). See the below image for an example:

If some steps result in a different than described above, please continue reading the Troubleshooting section.

Troubleshooting#

Only follow these troubleshooting steps if something in the previous section did not check out.

  • Ensure that Miniconda is installed, follow these instructions.

  • Ensure the packages are installed (if they are already installed, this will not do anything).

    Paste the following line of code to the Terminal and press Enter:

    conda install python=3.11 dtumathtools pandas scipy statsmodels uncertainties -y
    
  • Go back to the previous Verification section and check them again.

If you are still having trouble or have any questions, please do not hesitate to visit us during office hours or contact us via email or Discord. More information can be found on our homepage.