Today, Python 2.7’s pip started echoing the following:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Simultaneously (and perhaps related, though perhaps coincidentally) Python 2.7’s pip started giving the following error:
File in "...\lib\site-packages\pip\_internal\cli\base_command.py", line 176, in main status = self.run(options, args) File in "...\lib\site-packages\pip\_internal\commands\install.py", line 346, in run session=session, autobuilding=True File in "...\lib\site-packages\pip\_internal\wheel.py", line 848, in build assert building_is_possible AssertionError
Looking at the wheel.py source, there is a TODO above the the
assert building_is_possible line:
# TODO: This check fails if --no-cache-dir is set. And yet we # might be able to build into the ephemeral cache, surely? building_is_possible = self._wheel_dir or ( autobuilding and self.wheel_cache.cache_dir ) assert building_is_possible
Sure enough, we are using the
--no-cache-dir option when we call pip.
Removing the call to
--no-cache-dir fixes the
AssertionError, however we still need pip to not use cached packages.
As a workaround, we can empty the entire pip cache.
DEL /f /s /q %LOCALAPPDATA%\pip\Cache RMDIR /s /q %LOCALAPPDATA%\pip\Cache
rm -rf ~/.cache/pip
It is unclear whether the
DEPRECATION message and the
--no-cache-dir are related, but in this case neither pip nor Python 2.7 were upgraded – these both seemingly started on their own accord.