EDIT: The computer in question was a client machine with restrictions on what software could be installed. I\'m unsure if that may have been a cause of the issue or if the c
My issue was related to my IDE (PyCharm). older versions of PyCharm does not support pip v10. Upgrading PyCharm solved it for me.
they made a refactoring. you can support both 9 and 10 pip by using:
try:
from pip import main as pipmain
except:
from pip._internal.main import main as pipmain
and then use pipmain as you used pip.main. for example
pipmain(['install', "--upgrade", "pip"])
pipmain(['install', "-q", "package"])
From pip 20.0.0, it's:
from pip._internal.cli.main import main as pipmain
For more recent versions of pip (pip>=10.0.0), the functionality described in the other answers will no longer work. I recommend running the pip
with subprocess as follows:
import subprocess
import sys
my_path = <a path to the WHL file>
command_list = [sys.executable, "-m", "pip", "install", my_path]
with subprocess.Popen(command_list, stdout=subprocess.PIPE) as proc:
print(proc.stdout.read())
This solution uses the current python executable to run the pip command as a commandline command. It was inspired by the solution mentioned here.
easy_install --upgrade pip
worked for me.