posit-dev / posit-dev/rsconnect-python

Unable to specify the installation of the current directory, which causes a ModuleNotFoundError

Offen
#456 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
37
Forks
28
Ø Merge
1 T. 3 Std.
Gemergte PRs (30 T.)
7

Beschreibung

I am trying to deploy a Streamlit dashboard to Connect, but get an error.

Setup

I have the following directory structure:

dashboard
`-- app.py         # imports from my_awesome_package
src
|-- my_awesome_package
|    |-- data.py
|    `-- views.py
requirements.txt   # Specify requirements for my_awesome_package
pyproject.toml     # Specify installation of my_awesome_package
Deployment

Deployment happens in two steps:

  1. rsconnect write-manifest streamlit --entrypoint=dashboard/app.py .
  2. rsconnect deploy manifest manifest.json --title "My Dashboard"
The Error

Once deployed, I open the application and get the following error:

ModuleNotFoundError: No module named 'my_awesome_package'
The issue

I believe the issue is as follows: The connect server does not install packages from the local directory (through setup.py or pyproject.toml.), but only what is in requirements. In the manifest.json, the files from my_awesome_package are specified, but they cannot be found because the package has not been installed.

Question

How can I specify through rsconnect that the current directory should also be installed? Could this be an update to the manifest, or is there another way of doing it?

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Deployment mit dashboard/app.py, requirements.txt, pyproject.toml und den beiden angegebenen rsconnect-Befehlen zu reproduzieren. Untersuche manifest.json, um festzustellen, wie das lokale Paket dargestellt wird, und vergleiche das mit dem Verhalten des Deployments. Erledigt ist die Aufgabe, wenn das bereitgestellte Dashboard my_awesome_package aus dem aktuellen Verzeichnis importieren kann, ohne dass die Paketdateien manuell kopiert werden müssen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
cli, devops
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.