Search code examples
pipsudoapt-get

Pip can't be run and apt-get command not found


I've just recently gotten back into learning more about software going into django. It required me to install some packages, but I found out my pip wouldn't work. So I thought I had to reinstall it or something since this worked previous so I attempted a Sudo apt-get --update but then I got the error that apt-get command wasn't found. I scoured the internet for answers of this issue and I haven't found one that had this issue.

This is my error pip is giving me.

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3081, in _call_aside
    f(*args, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 846, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==19.0.3' distribution was not found and is required by the application

I've attempted to see if I can reinstall sudo or pip but same issue.

Simple code like: apt-get install sudo apt-get pip

I was hoping I would get a short response complaining that I didn't complete my lines or something is missing, but pip is giving me this strange error.


Solution

  • Thanks for the comments. The issue was a bit more complicated but I managed to get an idea of my issue after checking the comments under the question. Apparently my pip was missing 19.0.3 files and I had to manually install them to get the required files.

    easy_install pip==19.0.3
    

    I had to use the easy_install method to get around the pip command.