posit-dev / posit-dev/rsconnect-python

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

Open
#456 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
37
Forks
28
Avg merge
1d 3h
Merged PRs (30d)
7

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the deployment with dashboard/app.py, requirements.txt, pyproject.toml, and the two rsconnect commands shown. Inspect manifest.json to determine how the local package is represented and compare that with the deployment behavior. Done means the deployed dashboard can import my_awesome_package from the current directory without relying on manually copying package files.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.