pipenv-setup icon indicating copy to clipboard operation
pipenv-setup copied to clipboard

ImportError: cannot import name 'LegacySpecifier' from 'packaging.specifiers'

Open bvidovic1 opened this issue 2 years ago • 2 comments

This error appears with pipenv version:

pipenv, version 2022.12.19

. Reason is that after packaging pypi package version 21.3 they removed Legacy Specifier. https://packaging.pypa.io/en/stable/changelog.html#id2

Workaround is to lock packaging dependency in Pipenv file to 21.3:

vistir = "==0.6.1" 
packaging = "==21.3"

vistir is there because of this issue: https://github.com/Madoshakalaka/pipenv-setup/issues/138 .

bvidovic1 avatar Jan 13 '23 10:01 bvidovic1

It is not full workaround since it seems that suboptions on sync are not available. Things like: --dev, --pipfile, etc. Can we just support to LegacyVersion?

bvidovic1 avatar Jan 13 '23 10:01 bvidovic1

I had the same problem, lost several hours with debugging, finally with the following versions it works for

pipenv-setup sync --pipfile without the error

But, and that' quite strange and I don't understand it but you have to put these into the [packages] section, otherwise it won't work. That means pipenv will ignore the version specification for packaging==20.0 and will install packaging==23.0 at least for my setup

Pipfile

[packages]   
packaging = "==20.0"  
pipenv-setup = "==3.1.4"    

[dev-packages]
vistir = "<0.7"  

t11c avatar Mar 03 '23 16:03 t11c