Skip to content

Commit 73cc44b

Browse files
author
Kartik Raj
authored
Do not use --user flag when installing in a virtual environment (#19247)
* Do not use --user flag when installing in a virtual environment * News
1 parent 877861c commit 73cc44b

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

news/2 Fixes/14327.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Do not use `--user` flag when installing in a virtual environment.

src/client/common/installer/moduleInstaller.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CancellationToken, ProgressLocation, ProgressOptions } from 'vscode';
77
import { IInterpreterService } from '../../interpreter/contracts';
88
import { IServiceContainer } from '../../ioc/types';
99
import { traceError, traceLog } from '../../logging';
10-
import { EnvironmentType, ModuleInstallerType } from '../../pythonEnvironments/info';
10+
import { EnvironmentType, ModuleInstallerType, virtualEnvTypes } from '../../pythonEnvironments/info';
1111
import { sendTelemetryEvent } from '../../telemetry';
1212
import { EventName } from '../../telemetry/constants';
1313
import { IApplicationShell } from '../application/types';
@@ -100,6 +100,15 @@ export abstract class ModuleInstaller implements IModuleInstaller {
100100
token,
101101
executionInfo.useShell,
102102
);
103+
} else if (virtualEnvTypes.includes(interpreter.envType)) {
104+
await this.executeCommand(
105+
shouldExecuteInTerminal,
106+
resource,
107+
pythonPath,
108+
args,
109+
token,
110+
executionInfo.useShell,
111+
);
103112
} else {
104113
await this.executeCommand(
105114
shouldExecuteInTerminal,

0 commit comments

Comments
 (0)