Pip is broken in my anaconda environment. Pip3 is missing and normal pip is broken.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\Scripts\pip-script.py", line 3, in <module>
import pip
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3018, in <module>
@_call_aside
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2578, in activate
declare_namespace(pkg)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'`
This is the error. Even if I uninstall pip and reinstall it, it still wont work. I thought maybe I could write all packages of the environment in a .yml file and create a new environment which automatically installs all the packages from the .yml. Cloning the environment didnt work. I cant use anything with pip so I cant upgrade pip or anything else. Reinstalling the setuptools didnt work. Any idea how I can fix this? Thank you very much for your help.
EDIT: With Johns help I could solve the problem. I cant accept my own answer in 2 days so I have to keep it open because maybe someone else encounters the same problem.
Try this:
conda install pip
Normal way of reinstalling pip will not fix issues in anaconda environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With