0

I am trying to fix pip but I'm in a state where it's installed but also not installed?

When I type "pip" in terminal, I get that pip is not installed. When I type "pip3" in the terminal, I get the following:

Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/usr/bin/pip3", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

How do I get rid of pip?

I also tried to run "python3 get-pip.py" again (download again), but I got the following error:

ERROR: Exception:
Traceback (most recent call last):
  File "/var/folders/bh/gw4lmfss1w7gkzxnv7vdftbw0000gn/T/tmpgvtrdkgq/pip.zip/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/var/folders/bh/gw4lmfss1w7gkzxnv7vdftbw0000gn/T/tmpgvtrdkgq/pip.zip/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/folders/bh/gw4lmfss1w7gkzxnv7vdftbw0000gn/T/tmpgvtrdkgq/pip.zip/pip/_internal/commands/install.py", line 553, in run
    self._handle_target_dir(
  File "/var/folders/bh/gw4lmfss1w7gkzxnv7vdftbw0000gn/T/tmpgvtrdkgq/pip.zip/pip/_internal/commands/install.py", line 608, in _handle_target_dir
    shutil.rmtree(target_item_dir)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 732, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 660, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 683, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 681, in _rmtree_safe_fd
    os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'configuration.py'
Ayush
  • 1

1 Answers1

0

Try this

python -m pip uninstall [options] <package>
python -m pip uninstall [options] -r <requirements file>

For Example

python -m pip uninstall simplejson

Reference

Abhishek Kumar
  • 383
  • 4
  • 18
  • OP has an error `ModuleNotFoundError: No module named 'pip'`, so I do not think that `python -m pip` will work. – Yuri Ginsburg Jan 18 '23 at 05:11
  • That worked! I uninstalled a library using this! However, when I try "python3 -m pip uninstall pip", it gives the following error: - Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 825, in move os.rename(src, real_dst) PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip-22.3.1.dist-info/' -> '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/~ip-22.3.1.dist-info' – Ayush Jan 18 '23 at 06:05