Graceful handling of "ImportError: No module named pkg_resources"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Ubuntu Precise and Debian Wheezy virtualenv workflow using the shown pip freeze and pip install -r requirements.txt commands with the sample requirements.txt. Trace how the distribute requirement leads to the pkg_resources ImportError, then define and verify graceful behavior for this cross-distribution installation case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100