fix: use user flag when installing packages via pip

This commit is contained in:
Amin Yahyaabadi 2023-09-01 02:36:39 -07:00
parent e0bca0a01d
commit 1f59ba33f1
1 changed files with 3 additions and 1 deletions

View File

@ -20,13 +20,15 @@ export async function setupPipPackWithPython(
name: string,
version?: string,
upgrade = false,
user = true,
): Promise<InstallationInfo> {
info(`Installing ${name} ${version ?? ""} via pip`)
const nameAndVersion = version !== undefined && version !== "" ? `${name}==${version}` : name
const upgradeFlag = upgrade === true ? ["--upgrade"] : []
const userFlag = user === true ? ["--user"] : []
execaSync(givenPython, ["-m", "pip", "install", ...upgradeFlag, nameAndVersion], {
execaSync(givenPython, ["-m", "pip", "install", ...upgradeFlag, ...userFlag, nameAndVersion], {
stdio: "inherit",
})