denosaurs / denosaurs/deno_python
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'packages_distributions')
- Vorherrschende Sprache
- TypeScript
- Sterne
- 762
- Forks
- 26
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Trying to run this for the first time.
Code
```js
import { pip } from "https://deno.land/x/python/ext/pip.ts";
const np = await pip.import("numpy");
const plt = await pip.import("matplotlib", "matplotlib.pyplot");
const xpoints = np.array([1, 8]);
const ypoints = np.array([3, 10]);
plt.plot(xpoints, ypoints);
plt.show();
```
Terminal
```
PS C:\Users\MyUser\Downloads> $env:DENO_PYTHON_PATH='C:\Users\MyUser\AppData\Local\Programs\Python\Python310\python310.dll'; deno run -A --unstable --allow-net=deno.com .\deno1.js
Installing numpy
WARNING: Target directory C:\Users\MyUser\AppData\Local\deno\plug\pip\numpy already exists. Specify --upgrade to force replacement.
WARNING: Target directory C:\Users\MyUser\AppData\Local\deno\plug\pip\numpy-1.25.2.dist-info already exists. Specify --upgrade to force replacement.
WARNING: Target directory C:\Users\MyUser\AppData\Local\deno\plug\pip\bin already exists. Specify --upgrade to force replacement.
[notice] A new release of pip available: 22.3.1 -> 23.2.1
[notice] To update, run: deno.exe -m pip install --upgrade pip
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'packages_distributions')
const packages = importlib.metadata.packages_distributions();
^
at Pip.import (https://deno.land/x/python@0.3.1/ext/pip.ts:130:41)
at eventLoopTick (ext:core/01_core.js:183:11)
at async file:///C:/Users/MyUser/Downloads/deno1.js:3:12
PS C:\Users\MyUser\Downloads> deno --version
deno 1.36.1 (release, x86_64-pc-windows-msvc)
v8 11.6.189.12
typescript 5.1.6
PS C:\Users\MyUser\Downloads>
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Reproduziere das Windows-Beispiel mit Deno 1.36.1 und Python 3.10 und untersuche dann ext/pip.ts am Einstiegspunkt Pip.import ungefähr in Zeile 130. Verfolge, warum importlib.metadata beim Lesen von packages_distributions undefined ist; die Aufgabe ist abgeschlossen, wenn der gemeldete Aufruf pip.import diesen TypeError nicht mehr auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- deno, python, typescript
- Bereich
- backend, devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100