pinokiod 1.2.9 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kernel/bin/cuda.js +2 -2
- package/kernel/index.js +1 -1
- package/kernel/shell.js +61 -34
- package/package.json +1 -1
- package/server/index.js +2 -0
- package/server/public/electron.css +4 -0
- package/server/views/browser.ejs +1 -1
package/kernel/bin/cuda.js
CHANGED
|
@@ -5,14 +5,14 @@ class Cuda {
|
|
|
5
5
|
message: "conda install -y cudnn libzlib-wapi -c conda-forge",
|
|
6
6
|
}, ondata)
|
|
7
7
|
await this.kernel.bin.exec({
|
|
8
|
-
message: "conda install -y cuda -c nvidia/label/cuda-
|
|
8
|
+
message: "conda install -y cuda -c nvidia/label/cuda-12.1.0",
|
|
9
9
|
}, ondata)
|
|
10
10
|
} else {
|
|
11
11
|
await this.kernel.bin.exec({
|
|
12
12
|
message: "conda install -y cudnn -c conda-forge",
|
|
13
13
|
}, ondata)
|
|
14
14
|
await this.kernel.bin.exec({
|
|
15
|
-
message: "conda install -y cuda -c nvidia/label/cuda-
|
|
15
|
+
message: "conda install -y cuda -c nvidia/label/cuda-12.1.0",
|
|
16
16
|
}, ondata)
|
|
17
17
|
}
|
|
18
18
|
}
|
package/kernel/index.js
CHANGED
package/kernel/shell.js
CHANGED
|
@@ -474,37 +474,47 @@ class Shell {
|
|
|
474
474
|
|
|
475
475
|
|
|
476
476
|
// 1. conda
|
|
477
|
-
|
|
477
|
+
|
|
478
|
+
let conda_activation = []
|
|
478
479
|
if (params.conda) {
|
|
479
|
-
conda = params.conda
|
|
480
|
-
} else {
|
|
481
|
-
conda = null
|
|
482
|
-
}
|
|
483
480
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
481
|
+
// 1. conda_path/conda_name/conda_python
|
|
482
|
+
let conda_path
|
|
483
|
+
let conda_name
|
|
484
|
+
let conda_python = "python=3.10"
|
|
485
|
+
if (typeof params.conda === "string") {
|
|
486
|
+
// params.conda => interpret as path
|
|
487
|
+
conda_path = params.conda
|
|
488
|
+
} else {
|
|
489
|
+
// params.conda.skip
|
|
490
|
+
if (params.conda.skip) {
|
|
491
|
+
// do nothing
|
|
495
492
|
} else {
|
|
496
|
-
if (conda
|
|
497
|
-
conda_path = conda
|
|
493
|
+
if (typeof conda === "string") {
|
|
494
|
+
conda_path = conda
|
|
498
495
|
} else {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
496
|
+
// conda_path
|
|
497
|
+
if (conda.path) {
|
|
498
|
+
conda_path = conda.path
|
|
499
|
+
} else if (conda.name) {
|
|
500
|
+
conda_name = conda.name
|
|
501
|
+
} else {
|
|
502
|
+
throw new Error("when specifying conda as an object, the conda.name or conda.path must exist")
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// conda_python
|
|
506
|
+
if (conda.python) {
|
|
507
|
+
conda_python = conda.python
|
|
508
|
+
}
|
|
505
509
|
}
|
|
506
510
|
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
console.log("CONDA STEP 1", { conda: params.conda, conda_path, conda_name, conda_python })
|
|
514
|
+
|
|
507
515
|
|
|
516
|
+
// 2. conda_activation
|
|
517
|
+
if (conda_path) {
|
|
508
518
|
let env_path = path.resolve(params.path, conda_path)
|
|
509
519
|
let env_exists = await this.exists(env_path)
|
|
510
520
|
if (env_exists) {
|
|
@@ -525,19 +535,37 @@ class Shell {
|
|
|
525
535
|
`conda activate ${env_path}`,
|
|
526
536
|
]
|
|
527
537
|
}
|
|
528
|
-
|
|
538
|
+
} else if (conda_name) {
|
|
539
|
+
let envs_path = this.kernel.bin.path("miniconda/envs")
|
|
540
|
+
let env_path = path.resolve(envs_path, conda_name)
|
|
541
|
+
let env_exists = await this.exists(env_path)
|
|
542
|
+
if (env_exists) {
|
|
543
|
+
conda_activation = [
|
|
544
|
+
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
545
|
+
`conda deactivate`,
|
|
546
|
+
`conda deactivate`,
|
|
547
|
+
`conda deactivate`,
|
|
548
|
+
`conda activate ${conda_name}`,
|
|
549
|
+
]
|
|
550
|
+
} else {
|
|
551
|
+
conda_activation = [
|
|
552
|
+
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
553
|
+
`conda create -y -n ${conda_name} ${conda_python}`,
|
|
554
|
+
`conda deactivate`,
|
|
555
|
+
`conda deactivate`,
|
|
556
|
+
`conda deactivate`,
|
|
557
|
+
`conda activate ${conda_name}`,
|
|
558
|
+
]
|
|
559
|
+
}
|
|
529
560
|
} else {
|
|
530
|
-
//
|
|
531
|
-
conda_activation = [
|
|
532
|
-
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
533
|
-
`conda deactivate`,
|
|
534
|
-
`conda deactivate`,
|
|
535
|
-
`conda deactivate`,
|
|
536
|
-
`conda activate base`,
|
|
537
|
-
]
|
|
561
|
+
// no conda name or conda path => means don't activate any env
|
|
562
|
+
conda_activation = []
|
|
538
563
|
}
|
|
539
564
|
}
|
|
540
565
|
|
|
566
|
+
console.log("CONDA STEP 2", { conda_activation })
|
|
567
|
+
|
|
568
|
+
|
|
541
569
|
// Update env setting
|
|
542
570
|
if (this.env) {
|
|
543
571
|
// this.env.CONDA_PIP_INTEROP_ENABLED = "1"
|
|
@@ -549,7 +577,6 @@ class Shell {
|
|
|
549
577
|
}
|
|
550
578
|
|
|
551
579
|
|
|
552
|
-
|
|
553
580
|
// 2. venv
|
|
554
581
|
let venv_activation
|
|
555
582
|
if (params.venv) {
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -2034,12 +2034,14 @@ class Server {
|
|
|
2034
2034
|
console.log({ config })
|
|
2035
2035
|
|
|
2036
2036
|
}
|
|
2037
|
+
let platform = os.platform()
|
|
2037
2038
|
|
|
2038
2039
|
|
|
2039
2040
|
|
|
2040
2041
|
|
|
2041
2042
|
console.log("MEMORY", this.kernel.memory)
|
|
2042
2043
|
res.render("browser", {
|
|
2044
|
+
platform,
|
|
2043
2045
|
running:this.kernel.api.running,
|
|
2044
2046
|
memory: this.kernel.memory,
|
|
2045
2047
|
sidebar: "/pinokio/sidebar/" + name,
|
package/server/views/browser.ejs
CHANGED