def direct_pip_install(fname, python_exe=None, architecture=None,
                       verbose=False, install_options=None):
    """Direct install via pip !"""
    copy_to = osp.dirname(fname)

    if python_exe is None:
        python_exe = sys.executable
    assert osp.isfile(python_exe)
    myroot = os.path.dirname(python_exe)

    cmd = [python_exe, '-m', 'pip', 'install']
    if install_options:
        cmd += install_options  # typically ['--no-deps']
        print('pip install_options', install_options)
    cmd += [fname]

    if verbose:
        subprocess.call(cmd, cwd=myroot)
    else:
        p = subprocess.Popen(cmd, cwd=myroot, stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        stdout, stderr = p.communicate()
        the_log = ("%s" % stdout + "\n %s" % stderr)

        if ' not find ' in the_log or ' not found ' in the_log:
            print("Failed to Install: \n %s \n" % fname)
            print("msg: %s" % the_log)
            raise RuntimeError
        p.stdout.close()
        p.stderr.close()
    src_fname = fname
    if copy_to is None:
        return src_fname
    else:
        if verbose:
            print("Installed %s" % src_fname)
        return src_fname
dataset/ETHPy150Open winpython/winpython/winpython/utils.py/direct_pip_install/original