Skip to content

Latest commit

 

History

History

01_python-setup-preferences

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Python Setup

There are several ways you can install Python and set up your computing environment.

(I am using computers running MacOS, but this workflow is similar for Linux machines and may work for other operating systems as well.)


1. Download and install Miniforge

Download miniforge from the GitHub repository here.

download

Depending on your operating system, this should download either an .sh (macOS, Linux) or .exe file (Windows).

For the .sh file, open your command line terminal and execute the following command

sh ~/Desktop/Miniforge3-MacOSX-arm64.sh

where Desktop/ is the folder where the Miniforge installer was downloaded to. On your computer, you may have to replace it with Downloads/.

miniforge-install

Next, step through the download instructions, confirming with "Enter".


2. Create a new virtual environment

After the installation was successfully completed, I recommend creating a new virtual environment called LLMs, which you can do by executing

conda create -n LLMs python=3.12

Many scientific computing libraries do not immediately support the newest version of Python. Therefore, when installing PyTorch, it's advisable to use a version of Python that is one or two releases older. For instance, if the latest version of Python is 3.13, using Python 3.11 or 3.12 is recommended.

Next, activate your new virtual environment (you have to do it every time you open a new terminal window or tab):

conda activate LLMs

activate-env


3. Install new Python libraries

To install new Python libraries, you can now use the conda package installer. For example, you can install JupyterLab as follows:

conda install jupyterlab

You can also still use pip to install libraries. By default, pip should be linked to your new LLms conda environment:

check-pip


4. Install PyTorch

PyTorch can be installed just like any other Python library or package using pip. For example:

pip install torch

However, since PyTorch is a comprehensive library featuring CPU- and GPU-compatible codes, the installation may require additional settings and explanation.

It's also highly recommended to consult the installation guide menu on the official PyTorch website at https://pytorch.org.

5. Installing Python packages and libraries used in this course

Please refer to the Installing Python packages and libraries used in this course document for instructions on how to install the required libraries.



Any questions? Please feel free to reach out in the Discussion Forum.