For me the issue was due to incompatible versions of poetry and packaging. It got fixed after running pip install --upgrade packaging
pip install --upgrade packaging