diff --git a/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts b/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts index 5dfe46fd7e90..a084cc1e4a16 100644 --- a/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts +++ b/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts @@ -463,6 +463,9 @@ export function getNativePythonFinder(context?: IExtensionContext): NativePython if (!_finder) { const cacheDirectory = context ? getCacheDirectory(context) : undefined; _finder = new NativePythonFinderImpl(cacheDirectory); + if (context) { + context.subscriptions.push(_finder); + } } return _finder; } diff --git a/src/client/pythonEnvironments/index.ts b/src/client/pythonEnvironments/index.ts index 2c6555d62024..f9613ee4847b 100644 --- a/src/client/pythonEnvironments/index.ts +++ b/src/client/pythonEnvironments/index.ts @@ -60,7 +60,6 @@ export async function initialize(ext: ExtensionState): Promise { if (shouldUseNativeLocator()) { const finder = getNativePythonFinder(ext.context); - ext.disposables.push(finder); const api = createNativeEnvironmentsApi(finder); ext.disposables.push(api); registerNewDiscoveryForIOC(