Pip pkg install Error

Description

pip fails with import error pertaining to file cache.

Expected behavior

expected pip to install required pkg.

pip version

20.0.4

Python version

3.8

error:

ImportError: cannot import name ‘FileCache’ from ‘pip._vendor.cachecontrol.caches’ (unknown location)

Provide the full command you are running and the full traceback error you are getting.

cmd: pip install pandas

Traceback (most recent call last):
File “/Users/ruchitrajhansa/opt/anaconda3/bin/pip”, line 11, in
sys.exit(main())
File “/Users/ruchitrajhansa/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main.py”, line 73, in main
command = create_command(cmd_name, isolated=("–isolated" in cmd_args))
File “/Users/ruchitrajhansa/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/commands/init.py”, line 104, in create_command
module = importlib.import_module(module_path)
File “/Users/ruchitrajhansa/opt/anaconda3/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 783, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/Users/ruchitrajhansa/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/commands/install.py”, line 17, in
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
File “/Users/ruchitrajhansa/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/req_command.py”, line 19, in
from pip._internal.network.download import Downloader
File “/Users/ruchitrajhansa/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/network/download.py”, line 13, in
from pip._internal.network.cache import is_from_cache
File “/Users/ruchitrajhansa/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/network/cache.py”, line 8, in
from pip._vendor.cachecontrol.caches import FileCache
ImportError: cannot import name ‘FileCache’ from ‘pip._vendor.cachecontrol.caches’ (unknown location)

Something is broken about your Anaconda install,

You are running from this pip:

 /Users/ruchitrajhansa/opt/anaconda3/bin/pip

But the error is happening in different pip:

/Users/ruchitrajhansa/opt/anaconda3/lib/python3.8/site-packages/pip/

Try running python -m pip install ... instead of pip install .... Also you will be much better served by using conda install ... instead. Pip is not in any way guaranteed to work inside a conda environment, you’re supposed to primarily use conda to install packages.