For my last project, I used poetry to manage dependencies and package my code. Poetry comes with all the tools you might need to manage your projects in a deterministic way.

Anyway, after running poetry init in an existing project, I tried to let poetry create a virtuale environment, by adding the first dependecy, but when I did poetry add twisted it suddenly hang out, printing:

No module named 'virtualenv.seed.via_app_data'

Why is that? Because poetry was using the wrong virtualenv instance, so to solve this:

  1. Remove all virtualenv istances
    sudo apt remove --purge python3-virtualenv virtualenv
    
  2. Remove unused dependencies
    sudo apt autoremove
    
  3. Install virtualenv
    pip3 install virtualenv
    
  4. Add dependencies with poetry
    poetry add <dependecy_name>
    

Now it should work.