Skip to content

Commit 78ae30e

Browse files
author
minjk-bl
committed
Add installation of preinstall packages for jupyterlite
1 parent 78d2f4a commit 78ae30e

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

visualpython/js/com/com_Config.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ define([
296296
* - automatically restart on jupyter kernel restart (loadVisualpython.js)
297297
*/
298298
readKernelFunction() {
299+
let that = this;
299300
// CHROME: change method to load py files ($.get -> require)
300301
return new Promise(function(resolve, reject) {
301302
var libraryList = [
@@ -314,7 +315,26 @@ define([
314315
libraryList.forEach(libCode => {
315316
promiseList.push(vpKernel.execute(libCode, true));
316317
});
317-
318+
319+
if (that.extensionType === 'lite') {
320+
let preInstallCode = '';
321+
let preInstallPackList = [
322+
'seaborn',
323+
'plotly',
324+
'scikit-learn',
325+
'scipy',
326+
'statsmodels'
327+
];
328+
preInstallPackList.forEach((packName, idx) => {
329+
preInstallCode += '%pip install ' + packName
330+
if (idx < preInstallPackList.length - 1) {
331+
preInstallCode += '\n';
332+
}
333+
});
334+
// pre-install packages
335+
promiseList.push(vpKernel.execute(preInstallCode, true));
336+
}
337+
318338
// run all promises
319339
let failed = false;
320340
Promise.all(promiseList).then(function(resultObj) {
@@ -918,7 +938,7 @@ define([
918938
'- Save VP Note before refreshing the page.'
919939
];
920940
com_interface.insertCell('markdown', info.join('\n'));
921-
com_interface.insertCell('code', "import piplite\npiplite.install('jupyterlab-visualpython==" + latestVersion + "')");
941+
com_interface.insertCell('code', "%pip install jupyterlab-visualpython==" + latestVersion);
922942
}
923943

924944
// update version_timestamp

0 commit comments

Comments
 (0)