Using poetry with existing Airflow #8880
Replies: 2 comments 2 replies
-
No. Poetry follows the well trodden path of using virtual environments for deployment. Typically for a docker image, people set virtualenvs.in-project to True, then add /home/airflow/.venv/bin to $PATH to activate the the .venv in a docker context. |
Beta Was this translation helpful? Give feedback.
-
As mentioned by @clintonroy and several times elsewhere, not using a virtual environment is not recommended. Even within docker containers. For your use case, which I suspect is to make use of already installed platform libraries, you can make use of the poetry config virtualenvs.options.system-site-packages true However, note that whenever you use poetry to manage dependencies, poetry will always prefer the versions that are in your lock file. So if you lock file says Alternatively, if you are adamant on using no venv, you can do something like this. The above issue still applies.
If you do not care for the locked versions, then you can do something like this even with a Poetry project.
|
Beta Was this translation helpful? Give feedback.
-
Greetings everyone!
I have a Dockerfile with Airflow
And it works like a charm, but I want to use poetry instead of it. And that's the file I've got.
But while build I've got information about
Creating virtualenv dwh-sxWGcd-a-py3.11 in /home/airflow/.cache/pypoetry/virtualenvs
If I do
poetry config virtualenvs.create false
poetry install trying to install everything into the/usr/local/lib/python3.11/site-packages/
instead of/home/airflow/.local/lib/python3.11/site-packages
and I've got permission error (seems that it uses system directory)And my question is: Is it possible to do installation to local folder with poetry without any virtual env?
Beta Was this translation helpful? Give feedback.
All reactions