TUFLOW FV Python Environment Archive

From TUFLOW FV Wiki
Jump to navigation Jump to search

THIS PAGE IS UNDED CONSTRUCTION

Install Python

There are a range of options for installing Python on your computer. You can either download through a package (such as Anaconda) or directly download from the Python Website. For this example we will install the basic Python installation and then install further modules using pip.

To install Python please visit the Python Download Page and download the most recent executable Python 3.9 download file for windows. Run the installation by following these steps:

  1. Choose Custom Installation
    PYTHON INSTALL 001.JPG
  2. Click Next
    PYTHON INSTALL 002.JPG
  3. Save to Custom Location
    PYTHON INSTALL 003.JPG


Install PyCharm

Once you have downloaded and installed Python, the next step is to download a Python Integrated Development Environment (IDE) to edit, run and debug your code. Whist there are a range of different IDEs out there this example will use the IDE PyCharm. We have chosen PyCharm because it has some nice tools for handling virtual environments which will help keep us organised later if we need to work with different Python libraries and versions.

Proceed to download PyCharm using the most recent executable download file for windows and run the installation. PyCharm Community and Educational are open-source projects.

Setup Python Environment

Following successful installation of Python and Pycharm we will setup a virtual environment within Pycharm and install the TUFLOW FV Python Toolbox including its package dependencies. Please work through each of the steps as follows:

  1. Open PyCharm and create a new project.
    PYCHARM SETUP 001.JPG
  2. Set the project location and a create virtual environment. Click OK.
    PYCHARM SETUP 002.JPG
  3. Goto: File >> Settings and open up the project interpreter options.
    PYCHARM SETUP 003.JPG
  4. Click the plus button to select new modules for installation.
    PYCHARM SETUP 004.JPG
  5. Select the tfv package and click install package (Noting there may be a more recent version than 0.0.8).
    PYCHARM SETUP 006.JPG
  6. The installation should complete successfully and install the required dependencies for tfv.
    PYCHARM SETUP 007.JPG

Please also add the PyQT5 package so you access interactive plotting.

You have now successfully setup your Python Environment.

If you're not using PyCharm the tfv package is available via the Python Package Index PyPi. You can optionally select to install it via the command prompt or terminal using pip as follows:

python -m pip install tfv PyQT5