diff --git a/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts b/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts index a05fcb8b4de4..55c5ed9f83a3 100644 --- a/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts +++ b/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts @@ -422,7 +422,10 @@ function getCustomVirtualEnvDirs(): string[] { const venvFolders = getPythonSettingAndUntildify(VENVFOLDERS_SETTING_KEY) ?? []; const homeDir = getUserHomeDir(); if (homeDir) { - venvFolders.map((item) => path.join(homeDir, item)).forEach((d) => venvDirs.push(d)); + venvFolders + .map((item) => (item.startsWith(homeDir) ? item : path.join(homeDir, item))) + .forEach((d) => venvDirs.push(d)); + venvFolders.forEach((item) => venvDirs.push(untildify(item))); } return Array.from(new Set(venvDirs)); } diff --git a/src/client/pythonEnvironments/base/locators/lowLevel/customVirtualEnvLocator.ts b/src/client/pythonEnvironments/base/locators/lowLevel/customVirtualEnvLocator.ts index 4c6a05af4acc..6aa83bbc376b 100644 --- a/src/client/pythonEnvironments/base/locators/lowLevel/customVirtualEnvLocator.ts +++ b/src/client/pythonEnvironments/base/locators/lowLevel/customVirtualEnvLocator.ts @@ -41,7 +41,10 @@ async function getCustomVirtualEnvDirs(): Promise { const venvFolders = getPythonSetting(VENVFOLDERS_SETTING_KEY) ?? []; const homeDir = getUserHomeDir(); if (homeDir && (await pathExists(homeDir))) { - venvFolders.map((item) => path.join(homeDir, item)).forEach((d) => venvDirs.push(d)); + venvFolders + .map((item) => (item.startsWith(homeDir) ? item : path.join(homeDir, item))) + .forEach((d) => venvDirs.push(d)); + venvFolders.forEach((item) => venvDirs.push(untildify(item))); } return asyncFilter(uniq(venvDirs), pathExists); }