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
```
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With