# Installation
Poetry should always be installed in a dedicated virtual environment to isolate it from the rest of your system. In no case, it should be installed in the environment of the project that is to be managed by Poetry.
## In current [PyEnv](PyEnv%20setup.md) with `pipx`
[`pipx`](https://github.com/pypa/pipx) is used to install Python CLI applications globally while still isolating them in virtual environments. `pipx` will manage upgrades and uninstalls when used to install Poetry.
```
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install poetry
```
Upgrade later with:
```
python3 -m pip install --user --upgrade pipx
pipx upgrade poetry
```
## MacOS
`brew install poetry`
## Otherwise
https://python-poetry.org/docs/#installation
and
https://python-poetry.org/docs/#enable-tab-completion-for-bash-fish-or-zsh
# Configuration
It is recommended to track project-specific virtualenvs as .venv files in the project;
To do so, set:
```shell
poetry config virtualenvs.in-project true
```
If you use [direnv to configure environments by directory](direnv%20to%20configure%20environments%20by%20directory.md), then also [configure direnv for Poetry](Configure%20direnv%20for%20Poetry.md).
# Initialization
## New projects
With Poetry's [directory structure](https://python-poetry.org/docs/cli/#new):
```bash
poetry new project-name
```
## Convert existing projects to poetry
```bash
cd to/existing/project-directory
```
and then:
```shell
poetry init
```
# Usage
See [Poetry usage](Poetry%20usage.md)
# Uninstall
```
curl -sSL https://install.python-poetry.org | python3 - --uninstall
```