[Distutils] pkg_resources get_distribution - zipfile support?

Daniel Holth dholth at gmail.com
Tue Oct 1 19:51:44 CEST 2013

On Tue, Oct 1, 2013 at 12:59 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> I'm having trouble using pkg_resources.get_distribution, and I'm not
> sure if it's because what I'm trying to do is unsupported (likely) or
> if I'm doing something wrong (also possible :-()
> I have a wheel file - essentially a zip file containing a
> distribution, plus a dist-info directory. If I put that zipfile on
> sys.path, I can import from it with no issues. However, if I try to do
> pkg_resources.get_distribution to find the distribution contained in
> that wheel/zipfile I get nothing back.
> Is this a bug, or an unsupported feature, or should I do something
> particular to make it work?
> Thanks,
> Paul
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig

pkg_resources only finds distributions inside .egg and inside sys.path
entries that are filesystem directories. You might be able to manually
add a new Distribution instance to working_set or start looking for a
place to add the feature here:


_distributionImpl = {
    '.egg': Distribution,
    '.egg-info': Distribution,
    '.dist-info': DistInfoDistribution,



More information about the Distutils-SIG mailing list