Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
Ian Huff Ian Huff
Ian Huff authored and Ian Huff committed Sep 16, 2020
commit 7e54e20340e2cb2c9c1e3de227086a9ca94fc367
3 changes: 2 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,5 +595,6 @@
"DataScience.interactiveWindowModeBannerTitle": "Do you want to open a new Python Interactive window for this file? [More Information](command:workbench.action.openSettings?%5B%22python.dataScience.interactiveWindowMode%22%5D).",
"DataScience.interactiveWindowModeBannerSwitchYes": "Yes",
"DataScience.interactiveWindowModeBannerSwitchAlways": "Always",
"DataScience.interactiveWindowModeBannerSwitchNo": "No"
"DataScience.interactiveWindowModeBannerSwitchNo": "No",
"DataScience.ipykernelNotInstalled": "IPyKernel not installed into interpreter {0}"
}
4 changes: 4 additions & 0 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,10 @@ export namespace DataScience {
);
export const connected = localize('DataScience.connected', 'Connected');
export const disconnected = localize('DataScience.disconnected', 'Disconnected');
export const ipykernelNotInstalled = localize(
'DataScience.ipykernelNotInstalled',
'IPyKernel not installed into interpreter {0}'
);
}

export namespace StartPage {
Expand Down
6 changes: 5 additions & 1 deletion src/client/datascience/jupyter/kernels/kernelSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ export class KernelSelector implements IKernelSelectionUsage {
return { kernelSpec, interpreter, kind: 'startUsingPythonInterpreter' };
}

// If we need to install our dependencies now (for non-native scenarios)
// then install ipykernel into the interpreter or throw error
private async installDependenciesIntoInterpreter(
interpreter: PythonEnvironment,
ignoreDependencyCheck?: boolean,
Expand All @@ -563,7 +565,9 @@ export class KernelSelector implements IKernelSelectionUsage {
(await this.kernelDependencyService.installMissingDependencies(interpreter, cancelToken)) !==
KernelInterpreterDependencyResponse.ok
) {
throw new Error(`IPyKernel not installed into interpreter ${interpreter.displayName}'`);
throw new Error(
localize.DataScience.ipykernelNotInstalled().format(interpreter.displayName || interpreter.path)
);
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/client/datascience/kernel-launcher/kernelFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@
import type { nbformat } from '@jupyterlab/coreutils';
import { inject, injectable, named } from 'inversify';
import * as path from 'path';
import { CancellationToken, CancellationTokenSource } from 'vscode';
import { CancellationToken } from 'vscode';
import { IWorkspaceService } from '../../common/application/types';
import { wrapCancellationTokens } from '../../common/cancellation';
import { traceError, traceInfo } from '../../common/logger';
import { IPlatformService } from '../../common/platform/types';
import { IPythonExecutionFactory } from '../../common/process/types';
import { IExtensionContext, IInstaller, InstallerResponse, IPathUtils, Product, Resource } from '../../common/types';
import { IExtensionContext, IPathUtils, Resource } from '../../common/types';
import { IEnvironmentVariablesProvider } from '../../common/variables/types';
import { IInterpreterLocatorService, IInterpreterService, KNOWN_PATH_SERVICE } from '../../interpreter/contracts';
import { PythonEnvironment } from '../../pythonEnvironments/info';
import { captureTelemetry } from '../../telemetry';
import { getRealPath } from '../common';
import { Telemetry } from '../constants';
import { defaultKernelSpecName } from '../jupyter/kernels/helpers';
import { JupyterKernelSpec } from '../jupyter/kernels/jupyterKernelSpec';
import { IDataScienceFileSystem, IJupyterKernelSpec } from '../types';
import { getKernelInterpreter } from './helpers';
import { IKernelFinder } from './types';
// tslint:disable-next-line:no-require-imports no-var-requires
const flatten = require('lodash/flatten') as typeof import('lodash/flatten');
Expand Down Expand Up @@ -57,7 +54,6 @@ export class KernelFinder implements IKernelFinder {
@inject(IPlatformService) private platformService: IPlatformService,
@inject(IDataScienceFileSystem) private fs: IDataScienceFileSystem,
@inject(IPathUtils) private readonly pathUtils: IPathUtils,
@inject(IInstaller) private installer: IInstaller,
@inject(IExtensionContext) private readonly context: IExtensionContext,
@inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService,
@inject(IPythonExecutionFactory) private readonly exeFactory: IPythonExecutionFactory,
Expand Down
8 changes: 1 addition & 7 deletions src/test/datascience/kernelFinder.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Uri } from 'vscode';
import { IWorkspaceService } from '../../client/common/application/types';
import { IPlatformService } from '../../client/common/platform/types';
import { PythonExecutionFactory } from '../../client/common/process/pythonExecutionFactory';
import { IExtensionContext, IInstaller, IPathUtils, Resource } from '../../client/common/types';
import { IExtensionContext, IPathUtils, Resource } from '../../client/common/types';
import { Architecture } from '../../client/common/utils/platform';
import { IEnvironmentVariablesProvider } from '../../client/common/variables/types';
import { defaultKernelSpecName } from '../../client/datascience/jupyter/kernels/helpers';
Expand All @@ -30,7 +30,6 @@ suite('Kernel Finder', () => {
let pathUtils: typemoq.IMock<IPathUtils>;
let context: typemoq.IMock<IExtensionContext>;
let envVarsProvider: typemoq.IMock<IEnvironmentVariablesProvider>;
let installer: IInstaller;
let workspaceService: IWorkspaceService;
let kernelFinder: IKernelFinder;
let activeInterpreter: PythonEnvironment;
Expand Down Expand Up @@ -83,9 +82,6 @@ suite('Kernel Finder', () => {
context.setup((c) => c.globalStoragePath).returns(() => './');
fileSystem = typemoq.Mock.ofType<IDataScienceFileSystem>();

installer = mock<IInstaller>();
when(installer.isInstalled(anything(), anything())).thenResolve(true);

platformService = typemoq.Mock.ofType<IPlatformService>();
platformService.setup((ps) => ps.isWindows).returns(() => true);
platformService.setup((ps) => ps.isMac).returns(() => true);
Expand Down Expand Up @@ -325,7 +321,6 @@ suite('Kernel Finder', () => {
platformService.object,
fileSystem.object,
pathUtils.object,
instance(installer),
context.object,
instance(workspaceService),
instance(executionFactory),
Expand Down Expand Up @@ -408,7 +403,6 @@ suite('Kernel Finder', () => {
platformService.object,
fileSystem.object,
pathUtils.object,
instance(installer),
context.object,
instance(workspaceService),
instance(executionFactory),
Expand Down