getting-started

Using Python in external resources

Starting new Python project codebase at the centre

Download and install Python

The instructions prepared by Digital Ocean have worked on 2024-10-03.

  1. Download Python installer

  2. If you have a (second) admin userID, click on Disable path length limit: image

  3. Add Python to the list of Environmental variable; here are some screenshots: image

Clone from an existing GitHub repository

To illustrate, clone from a repo containing Python code (previously prepared by your peers)

  1. Work on C: drive (network drives U and O appear to be slower)
cd C:\Users\user.name\DSI\
  1. To illustrate, we will use the RADD consult as an example:
git clone -b pt2 https://github.com/BCCDC-DSI/RADD.git
  1. We'll try out the Python code under part2_version2
cd C:\Users\user.name\DSI\RADD\workflows\part2_version2\
  1. Create new virtual environment named radd-p2
python -m venv radd-p2
  1. Activate it:
radd-p2\Scripts\activate
  1. Build the virtual environment by download packages specified in the requirementsWindows.txt
pip install -r requirementsWindows.txt
  1. Try executing one Python script created for this project:
python create_dataset.py

Python in VS Code

image

Creating new notebook
  1. Go to Command Palette image

  2. Search by typing "Create": image

  3. Select the kernel image

ipykernel

python -m ipykernel install --user --name=radd-p2 --display-name "Py312"

Return to home