When I want to run pip in my virtual environment, I get the following error:
Could not import runpy module
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 14, in <module>
import importlib.machinery # importlib first so we can test #15386 via -m
File "/home/.../venv/lib/python3.6/importlib/__init__.py", line 57, in <module>
import types
File "/home/.../venv/lib/python3.6/types.py", line 171, in <module>
import functools as _functools
File "/home/.../venv/lib/python3.6/functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "/home/.../venv/lib/python3.6/weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
This is the case for both pip
and python -m pip
commands.
Can you help me resolve it?