Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Poetry pyproject.toml not updating after running 'poetry add' inside project

I have a django project, with a single virtual env by poetry. At the root of the project is a pyproject.toml and poetry.lock file. Within that folder, if I run poetry shell my virtual env activates and I can run my code.

When I run poetry add slack-sdk, slack-sdk is installed and I can use it in my activated virtual environment. The environment seems to update as the code does indeed run - I'm using VSCode and have my virtual env selected at the bottom.

However, the pyproject.toml file doesn't update, so when I try and run on the server, the dependencies don't show up. How can I have my poetry environment behave the way I expect, which is the pyproject.toml updates each time I add something?

poetry env info`
Virtualenv
Python:         3.9.4
Implementation: CPython
Path:           /home/user/.cache/pypoetry/virtualenvs/django-xNHOe2Gk-py3.9
Valid:          True

System
Platform: linux
OS:       posix
Python:   /home/user/.pyenv/versions/3.9.4
```
like image 968
phil0s0pher Avatar asked Oct 18 '25 19:10

phil0s0pher


1 Answers

I solved this by deleting all the poetry envs in my .cache/virtualenvs folder, and then running poetry install from within my project again, then poetry add slack-sdk, then poetry update.

Whatever had gone wrong, deleting and re-installing all virtual envs fixed the issue.

like image 145
phil0s0pher Avatar answered Oct 20 '25 14:10

phil0s0pher