Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use conda-forge when installing into conda envs (#17629) #17632

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
([#17563](https://github.com/Microsoft/vscode-python/issues/17563))
1. Add timeout when discovery runs `conda info --json` command.
([#17576](https://github.com/Microsoft/vscode-python/issues/17576))
1. Use `conda-forge` channel when installing packages into conda environments.
([#17628](https://github.com/Microsoft/vscode-python/issues/17628))

### Code Health

Expand Down
22 changes: 17 additions & 5 deletions src/client/common/installer/condaInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { ICondaService, ICondaLocatorService, IComponentAdapter } from '../../in
import { IServiceContainer } from '../../ioc/types';
import { ModuleInstallerType } from '../../pythonEnvironments/info';
import { inDiscoveryExperiment } from '../experiments/helpers';
import { ExecutionInfo, IConfigurationService, IExperimentService } from '../types';
import { ExecutionInfo, IConfigurationService, IExperimentService, Product } from '../types';
import { isResource } from '../utils/misc';
import { ModuleInstaller } from './moduleInstaller';
import { ModuleInstaller, translateProductToModule } from './moduleInstaller';
import { InterpreterUri, ModuleInstallFlags } from './types';

/**
Expand Down Expand Up @@ -84,9 +84,21 @@ export class CondaInstaller extends ModuleInstaller {
const info = await condaLocatorService.getCondaEnvironment(pythonPath);
const args = [flags & ModuleInstallFlags.upgrade ? 'update' : 'install'];

// Temporarily ensure tensorboard is installed from the conda-forge
// channel since 2.4.1 is not yet available in the default index
if (moduleName === 'tensorboard') {
// Found that using conda-forge is best at packages like tensorboard & ipykernel which seem to get updated first on conda-forge
// https://github.com/microsoft/vscode-jupyter/issues/7787 & https://github.com/microsoft/vscode-python/issues/17628
// Do this just for the datascience packages.
if (
[
Product.tensorboard,
Product.ipykernel,
Product.pandas,
Product.nbconvert,
Product.jupyter,
Product.notebook,
]
.map(translateProductToModule)
.includes(moduleName)
) {
args.push('-c', 'conda-forge');
}
if (info && info.name) {
Expand Down
11 changes: 10 additions & 1 deletion src/test/common/installer/moduleInstaller.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,16 @@ suite('Module Installer', () => {
test(`Test args (${product.name})`, async () => {
setActiveInterpreter();
const expectedArgs = [isUpgrade ? 'update' : 'install'];
if (product.name === 'tensorboard') {
if (
[
'pandas',
'tensorboard',
'ipykernel',
'jupyter',
'notebook',
'nbconvert',
].includes(product.name)
) {
expectedArgs.push('-c', 'conda-forge');
}
if (condaEnvInfo && condaEnvInfo.name) {
Expand Down