Skip to content

Installation

Stefan Piatek edited this page Aug 29, 2019 · 26 revisions

Installation

This guide is for a completely fresh set up of everything required to start working with the TLO project. Whilst we currently only have mac setup, windows and linux steps will be similar.

Shared steps

Sign up for a free license for PyCharm (images/installation/and other IntelliJ products)

  • Navigate to https://account.jetbrains.com/login and create an account or sign up, making sure to click the verify email link
  • Once logged in, navigate to https://www.jetbrains.com/student/ to get a staff/student license, scrolling down the page to the Apply Now button. Most likely using your university email and a picture of your university ID card. The process should take a couple of days. In the meantime you can use an evaluation version of pycharm

Mac installation

1. Install Anaconda

2. Install and set up PyCharm

  • Navigate to https://www.jetbrains.com/pycharm/download/
  • Click the Download button underneath the Professional version Pycharm download
  • Open the image and drag PyCharm into your Applications Folder Pycharm install
  • Open PyCharm.app from your Applications folder, accepting the user agreement and clicking Skip Remaining and Set Defaults Pycharm defaults
  • A License Activation window will open, if you already have a license then enter in your login details that you created your IntelliJ/PyCharm account with, otherwise click evaluate for free (You can activate Pycharm later by going to the Menu bar Help > Register) PyCharm activate

3. Set up the TLOmodel in PyCharm

  • From the PyCharm welcome page, click Check out from Versino control and select git pycharm vc
  • Select Log in to Github... and enter in your GitHub login information github
  • The TLOmodel repository should now be available from the dropdown URL input, select it and then click on the clone button TLO repo
  • Click Yes on the dialogue box asking if you want to open the TLOmodel directory
  • Click the Menu bar PyCharm > Preferences...
  • In the dialogue box navigate to Project: TLOmodel > Project Interpreter interpreter
  • Click on the settings cog on the right and select Add...
  • Select Conda environment from the left hand panel, and set the Python Version to 3.6, then click OK. Add conda env
  • Click OK to close any windows until you are left with the main PyCharm window.
  • Now click on the Terminal button at the bottom of the Pycharm window and type pip install -r requirements/dev.txt pip install
  • Hit the enter key and the Terminal pane should fill with a lot of text. After a minute or so it should stop making output and look something like this pip install done

4. Confirm that the setup is correct using the tests

  • Now go back to the Menu bar PyCharm > Preferences... and navigate to Tools > Python Integrated Tools test runner
  • Change the Default test runner to pytest and click OK to close the Preferences window
  • At the top of your PyCharm window, click on Add Configuration... Add configuration
  • Click the plus icon to the top left of the Configuration window and select Python tests > pytest New pytest configuration
  • A new configuration will appear Empty Pytest config
  • Set the Target input by clicking on the folder icon, and select TLOmodel > tests, click the Open button Test Directory
  • The configuration window should now look something like this, click OK Configured pytest
  • At the top of the screen, there will now be a configuration, you can click on the green arrow to run the tests Run pytest
  • A new run pane will open up and pytest will run for a fair while, after it completes it will say that all of the tests have passed pytest running
  • You can scroll down the window and the final lines should look something like this pytest complete

5. If you have not set up git before

  • You can skip this section if you've set up your details in git

  • Click on the Terminal button as before and enter in the following commands, replacing your Name and Email but keeping the quotes. Hit enter after each line

    git config --global user.name "Stefan Piatek"
    git config --global user.email "s.piatek@ucl.ac.uk"
Clone this wiki locally