Skip to content

Use same interpreter as used by jupyter when checking pandas #8228

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

Merged
merged 1 commit into from
Oct 28, 2019
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
1 change: 1 addition & 0 deletions news/2 Fixes/8084.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When checking the version of `pandas`, use the same interpreter used to start `Jupyter`.
7 changes: 3 additions & 4 deletions src/client/datascience/data-viewing/dataViewerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
}
Expand All @@ -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 });
Expand Down