Setup Python and Poetry

Install pyenv to manage Python installation.

Please note, do not try to use System Python as the default system.

Install pyenv :

brew install pyenv

Install Python:

pyenv install 3.9.10

Add the following to your ~/.bash_profile or ~/.zshrc:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/shims:$PATH"

In order to access a remote repository make sure to update this file $HOME/.pip/pip.conf

vi $HOME/.pip/pip.conf

add your config:

[global]
index-url = "<REMOTE REPOSITORY>"

Configuring pipx:

Install pipx using brew:

brew install pipx
pipx ensurepath 

Installing Poetry:

Run the following to determine number of python versions.

pyenv versions

Single Python Installation:

pipx install poetry
poetry --version

Multiple Python Installations:

pyenv global <PYTHON VERSION>
pipx install poetry --python $(which python)
poetry env use $(which python)
poetry --version

Upgrade Poetry:

pipx upgrade poetry