Reputation: 1429
By default, poetry creates the virtual environment outside the project root. On mac, for example, it creates it inside ~/Library/Caches/pypoetry
.
However, I found the following recommendation:
# Configure poetry to create virtual environments inside the project's root directory
poetry config virtualenvs.in-project true
Also, poetry documentation itself points out these two options:
By default, poetry creates a virtual environment in {cache-dir}/virtualenvs ({cache-dir}\virtualenvs on Windows). You can change the cache-dir value by editing the poetry config. Additionally, you can use the virtualenvs.in-project configuration variable to create virtual environment within your project directory.
What are the benefits of creating the project virtual environment within your project directory or outside it?
Upvotes: 13
Views: 11884
Reputation: 11070
If the virtual environment is inside your project, then everything's together. If you delete the project later on, then the virtual environment will be too. If the virtual environment is outside, then you need to remember to delete two directories. However, this is just a recommendation and there's no obligation to follow it.
Upvotes: 7