Skip to content

Graceful handling of "ImportError: No module named pkg_resources" #138

Open
@ghost

Description

Originally reported by: sleepycal (Bitbucket: sleepycal, GitHub: Unknown)


The following problem happens sometimes when freezing/installing requirements between different distributions, with and without virtualenv.

ubuntu-precise$ virtualenv --no-site-packages /opt/venv
ubuntu-precise$ /opt/venv/bin/pip freeze > requirements.txt
ubuntu-precise$ cat requirements.txt
Django==1.5
distribute==0.7.3

debian-wheezy$ virtualenv --no-site-packages /opt/venv
debian-wheezy$ /opt/venv/bin/pip install -r requirements.txt

Traceback (most recent call last):
CommandExecutionError: Traceback (most recent call last):
  File "/opt/venv/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

This seems to be breaking because it's forcing a version of distribute which different than the one already installed seems to break things. However it's not clear why this happens in the first place, and feels quite user unfriendly (surely this should be handled more gracefully?)

The easiest fix is to remove the distribute line from requirements.txt, but it would be nice if this was handled better?

Any thoughts?


Activity

ghost added on Mar 29, 2016
added a commit that references this issue on May 9, 2022

Merge pull request #138 from wimglenn/optional-metadata

a7cfb56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        No participants

        Issue actions

          Graceful handling of "ImportError: No module named pkg_resources" · Issue #138 · pypa/setuptools