diff --git a/news/2 Fixes/8084.md b/news/2 Fixes/8084.md new file mode 100644 index 000000000000..b148695f9c5d --- /dev/null +++ b/news/2 Fixes/8084.md @@ -0,0 +1 @@ +When checking the version of `pandas`, use the same interpreter used to start `Jupyter`. diff --git a/src/client/datascience/data-viewing/dataViewerProvider.ts b/src/client/datascience/data-viewing/dataViewerProvider.ts index ff220598781a..4e17bedd9bc2 100644 --- a/src/client/datascience/data-viewing/dataViewerProvider.ts +++ b/src/client/datascience/data-viewing/dataViewerProvider.ts @@ -9,9 +9,8 @@ import { IPythonExecutionFactory } from '../../common/process/types'; import { IAsyncDisposable, IAsyncDisposableRegistry } from '../../common/types'; import * as localize from '../../common/utils/localize'; import { noop } from '../../common/utils/misc'; -import { IInterpreterService } from '../../interpreter/contracts'; import { IServiceContainer } from '../../ioc/types'; -import { IDataViewer, IDataViewerProvider, IJupyterVariables, INotebook } from '../types'; +import { IDataViewer, IDataViewerProvider, IJupyterExecution, IJupyterVariables, INotebook } from '../types'; @injectable() export class DataViewerProvider implements IDataViewerProvider, IAsyncDisposable { @@ -21,7 +20,7 @@ export class DataViewerProvider implements IDataViewerProvider, IAsyncDisposable @inject(IAsyncDisposableRegistry) asyncRegistry: IAsyncDisposableRegistry, @inject(IJupyterVariables) private variables: IJupyterVariables, @inject(IPythonExecutionFactory) private pythonFactory: IPythonExecutionFactory, - @inject(IInterpreterService) private interpreterService: IInterpreterService + @inject(IJupyterExecution) private readonly jupyterExecution: IJupyterExecution ) { asyncRegistry.push(this); } @@ -45,7 +44,7 @@ export class DataViewerProvider implements IDataViewerProvider, IAsyncDisposable } public async getPandasVersion(): Promise<{ major: number; minor: number; build: number } | undefined> { - const interpreter = await this.interpreterService.getActiveInterpreter(); + const interpreter = await this.jupyterExecution.getUsableJupyterPython(); const launcher = await this.pythonFactory.createActivatedEnvironment({ resource: undefined, interpreter, allowEnvironmentFetchExceptions: true }); try { const result = await launcher.exec(['-c', 'import pandas;print(pandas.__version__)'], { throwOnStdErr: true });