django-polymorphic icon indicating copy to clipboard operation
django-polymorphic copied to clipboard

Missing setuptools runtime dependency

Open markgras opened this issue 3 years ago • 3 comments

The django-polymorphic package's top-level __init__.py file imports pkg_resources, which is part of the setuptools package. Attempting to use django-polymorphic in a Python environment that does not have setuptools installed leads to an ImportError. To fix this, django-polymorphic's metadata should properly state that setuptools is a runtime dependency of the package.

markgras avatar Nov 29 '21 20:11 markgras

Hey, @markgras ... just a shot in the dark here, I don't know if I bumped into the same thing as you or not, but I did experience a similar symptom: django-polymorphic's import of pkg_resources threw an ImportError.

It was in CI (with a work project) and it was pretty odd to me because I wasn't changing anything related to django-polymorphic at the time, I was moving some other dependency from Poetry's list of "dev" deps to the "main" list of deps.

Anyhow, in my case what feels like ended up being the problem was that I had crossed up the versions of Poetry I was using locally and in CI: basically, there were two places where we configured the Poetry version and I only updated one, then goofy things happened when I made dependency changes 💥

That issue when away for me when I corrected my using two different versions of Poetry goof.

Don't know if you experienced a similar thing, but though I'd share.

jonprindiville avatar Sep 12 '22 15:09 jonprindiville

@jonprindiville You ran into this GitHub issue, as pkg_resources is part of setuptools (source code). In your problem configuring Poetry you ended up creating an environment that didn't have setuptools installed (or perhaps installed in the wrong place). Seeing this issue pop up in the wild is rare because setuptools is already present in most environments for old python setup.py install installation backward-compatibility. However, as more and more packages become PEP 517/518-compliant, we may see this backward-compatibility dropped, in which case this issue will become more apparent.

markgras avatar Sep 12 '22 17:09 markgras

you ended up creating an environment that didn't have setuptools installed

Nope. I just thought I'd share a possible trigger for this issue in case you were stuck.

However, as more and more packages become PEP 517/518-compliant, we may see this backward-compatibility dropped, in which case this issue will become more apparent.

Ok, cool, that would have been useful information to include in the description of the issue.

Carry on. 👋

jonprindiville avatar Sep 13 '22 15:09 jonprindiville