Saturday, August 10, 2024

Python setup tools

 Python is a very popular programming language. It is somewhat easier to read than other programming languages. Best 2nd choice for many tasks that includes data analysis and plotting. R is amazing for my use case and I feel it is the better choice especially when it comes to statistical test and plotting. Ggplot2 is nearly unrivaled for the ergonomics. 

However, the whenever I am determined to use Python, I am overwhelmed by the setup process.  This is focused on the setup in the MacOS world.  ( I won't go over Conda at all since for some reason it has sowed more confusion). 

This is a draft version of the post which will get updated as I learn more. 

1. Python Version: 

2. Pip (Official way to install)

3. venv (Comes with the Python 3 version)

4. UV (Not platform agnostic as Poetry) : This is more for resolving package dependency as compared to pip. So far it has worked good for me which means 

    1. Creating virtual environment:

            uv venv uenv1

  2. Activating virtual environment

      source uenv1/bin/activate

  3. Installing your programs 

       uv pip install pandas

Vscode should detect the folder within which we have installed this virtual environment. 

5. Pipx

Got pipx installed using brew install pipx and then was able to install uv. 

 Pipx is supposed to be subset of the pip which means it can only install command line tools but not all the packages such as Pandas or Polars which need to be imported as library.  This is aptly described at: https://pipx.pypa.io/stable/comparisons/

6. Poetry

7. PDM

8. PyPy 



No comments:

Post a Comment

Adding GPG keys to Github account

 Github has vigilant mode which verifies the commit was made by the user who can be verified by the gpg or ssh keys. By default, if you make...