brew install pyenv
brew install poetry
pyenv install 3.9

in intellij, in project settings

(1) Create module Project Setting - Modules add a new module - import module

(2) Create python interpreter SDK (platform/global/project?) Platform Settings - SDKs + -> python SDK System Interpreter Interpreter = … -> /Users/xxx/.pyenv/versions/3.9.16/bin/python

(3) Create module SDK (module) Then in the module - Dependencies Module SDK -> dropdown -> add sdk -> python SDK “Poetry Environment” associated project = YOUR_MODULE (creating the python sdk via Platform SDKs does not give you this option) base interpreter Poetry executable = /usr/local/bin/poetry

(4) Select module SDK (module) (because intellij forgets to select it, even though you created it from the selection) Then in the module - Dependencies Module SDK = “Poetry (YOUR_MODULE)”


Troubleshooting (A) “/bin/sh python command not found” the docs specify an experimental option but this breaks intellij

# this config breaks intellij ability to create a poetry sdk
#poetry config virtualenvs.prefer-active-python true

causes

/usr/local/bin/poetry env use /usr/local/bin/python3.9

/bin/sh python command not found

python -c "import sys; print(sys.executable)

setting it back to false solves it