pinokiod 3.2.121 → 3.2.124
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/conda.js +71 -0
- package/kernel/bin/index.js +13 -2
- package/package.json +1 -1
package/kernel/bin/conda.js
CHANGED
|
@@ -90,10 +90,80 @@ create_default_packages:
|
|
|
90
90
|
// - python=3.10`)
|
|
91
91
|
// }
|
|
92
92
|
// }
|
|
93
|
+
async check() {
|
|
94
|
+
let res = await this.kernel.bin.exec({ message: `conda list` }, (stream) => {
|
|
95
|
+
// console.log("conda list check", { stream })
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
console.log("CONDA", res.response)
|
|
99
|
+
lines = res.response.split(/[\r\n]+/)
|
|
100
|
+
let conda_check = {}
|
|
101
|
+
for(let line of lines) {
|
|
102
|
+
let chunks = line.split(/\s+/).filter(x => x)
|
|
103
|
+
if (chunks.length > 1) {
|
|
104
|
+
let name = chunks[0]
|
|
105
|
+
let version = chunks[1]
|
|
106
|
+
conda.add(name)
|
|
107
|
+
if (name === "conda") {
|
|
108
|
+
if (String(version) === "24.11.1") {
|
|
109
|
+
conda_check.conda = true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// check conda-libmamba-solver is up to date
|
|
113
|
+
// sometimes it just fails silently so need to check
|
|
114
|
+
if (name === "conda-libmamba-solver") {
|
|
115
|
+
//if (String(version) === "24.7.0") {
|
|
116
|
+
let channel = chunks[3]
|
|
117
|
+
let coerced = semver.coerce(version)
|
|
118
|
+
let mamba_requirement = ">=24.11.1"
|
|
119
|
+
console.log({ name, channel, version })
|
|
120
|
+
if (semver.satisfies(coerced, mamba_requirement) && channel === "conda-forge") {
|
|
121
|
+
conda_check.mamba = true
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Use sqlite to check if `conda update -y --all` went through successfully
|
|
126
|
+
// sometimes it just fails silently so need to check
|
|
127
|
+
if (name === "sqlite") {
|
|
128
|
+
let coerced = semver.coerce(version)
|
|
129
|
+
let sqlite_requirement = ">=3.47.2"
|
|
130
|
+
console.log({ coerced, version, sqlite_requirement })
|
|
131
|
+
if (semver.satisfies(coerced, sqlite_requirement)) {
|
|
132
|
+
console.log("semver satisfied")
|
|
133
|
+
conda_check.sqlite = true
|
|
134
|
+
} else {
|
|
135
|
+
console.log("semver NOT satisfied")
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
console.log("> Check", { conda_check })
|
|
141
|
+
return conda_check.conda && conda_check.mamba && conda_check.sqlite
|
|
142
|
+
}
|
|
93
143
|
async install(req, ondata) {
|
|
144
|
+
for(let i=0; i<5; i++) {
|
|
145
|
+
await this._install(req, ondata)
|
|
146
|
+
let installed = await this.check()
|
|
147
|
+
if (installed) {
|
|
148
|
+
console.log("Conda properly installed and updated")
|
|
149
|
+
return
|
|
150
|
+
} else {
|
|
151
|
+
console.log("Conda NOT roperly installed and updated. Trying again...")
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async _install(req, ondata) {
|
|
94
156
|
const installer_url = this.urls[this.kernel.platform][this.kernel.arch]
|
|
95
157
|
const installer = this.installer[this.kernel.platform]
|
|
96
158
|
const install_path = this.kernel.bin.path("miniconda")
|
|
159
|
+
let install_path_exists = await this.kernel.exists("miniconda")
|
|
160
|
+
if (install_path_exists) {
|
|
161
|
+
console.log("Install path already exists. Removing...", install_path)
|
|
162
|
+
await fs.promises.rm(install_path, { recursive: true }).catch((e) => {
|
|
163
|
+
})
|
|
164
|
+
} else {
|
|
165
|
+
console.log("Install path does not exist. Installing...")
|
|
166
|
+
}
|
|
97
167
|
|
|
98
168
|
ondata({ raw: `downloading installer: ${installer_url}...\r\n` })
|
|
99
169
|
await this.kernel.bin.download(installer_url, installer, ondata)
|
|
@@ -152,6 +222,7 @@ create_default_packages:
|
|
|
152
222
|
//"conda install -y conda-libmamba-solver=24.7.0 conda=24.7.1 -vvv --strict-channel-priority",
|
|
153
223
|
//"conda install -y conda-libmamba-solver=24.11.1 conda=24.7.1",
|
|
154
224
|
//"conda install -y conda-libmamba-solver=24.11.1 conda=24.11.2",
|
|
225
|
+
"conda update -y conda-libmamba-solver",
|
|
155
226
|
"conda update -y --all",
|
|
156
227
|
// "conda update -y conda",
|
|
157
228
|
// "conda update -y --all",
|
package/kernel/bin/index.js
CHANGED
|
@@ -288,6 +288,17 @@ class Bin {
|
|
|
288
288
|
// conda_check.mamba = true
|
|
289
289
|
// }
|
|
290
290
|
// }
|
|
291
|
+
if (name === "conda-libmamba-solver") {
|
|
292
|
+
//if (String(version) === "24.7.0") {
|
|
293
|
+
let channel = chunks[3]
|
|
294
|
+
let coerced = semver.coerce(version)
|
|
295
|
+
let mamba_requirement = ">=24.11.1"
|
|
296
|
+
console.log({ name, channel, version })
|
|
297
|
+
if (semver.satisfies(coerced, mamba_requirement) && channel === "conda-forge") {
|
|
298
|
+
conda_check.mamba = true
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
291
302
|
|
|
292
303
|
// Use sqlite to check if `conda update -y --all` went through successfully
|
|
293
304
|
// sometimes it just fails silently so need to check
|
|
@@ -312,8 +323,8 @@ class Bin {
|
|
|
312
323
|
}
|
|
313
324
|
|
|
314
325
|
console.log({ conda_check })
|
|
315
|
-
|
|
316
|
-
if (conda_check.conda && conda_check.sqlite) {
|
|
326
|
+
if (conda_check.conda && conda_check.mamba && conda_check.sqlite) {
|
|
327
|
+
//if (conda_check.conda && conda_check.sqlite) {
|
|
317
328
|
//if (conda_check.conda) {
|
|
318
329
|
this.correct_conda = true
|
|
319
330
|
}
|