rsconnect-python
raw JSON → 1.29.0 verified Sat May 09 auth: no python
The Posit Connect command-line interface (CLI) for deploying Python content (Dash, Streamlit, Flask, Jupyter Notebooks) to RStudio Connect / Posit Connect servers. Current version: 1.29.0. Released on a quarterly cadence.
pip install rsconnect-python Common errors
error ModuleNotFoundError: No module named 'rsconnect' ↓
cause The package is not installed or is installed under a different name.
fix
Run
pip install rsconnect-python (note: package name is rsconnect-python, but import is rsconnect). error rsconnect.api.InvalidConfigurationError: The server_url must be a valid URL ↓
cause Server URL is missing the protocol (http:// or https://) or is malformed.
fix
Provide full URL with https://, e.g.,
https://connect.example.com. error rsconnect.api.InvalidConfigurationError: The api_key must be a valid API key ↓
cause API key is missing or incorrect.
fix
Generate an API key from the Posit Connect dashboard under your profile, and pass it via the constructor or environment variable
CONNECT_API_KEY. error click.ClickException: Error: Invalid value for '--python': 'python3.10' is not a valid Python interpreter ↓
cause The Python interpreter path passed to `--python` does not exist or is not executable.
fix
Use the full path to the Python executable (e.g.,
/usr/bin/python3.10) or rely on the environment's default Python. Warnings
breaking In version 1.28.0, the `--python` flag behavior changed: it now uses the Python interpreter from the environment, not the one passed to the flag. Use `--python` only to specify a custom Python binary, not to set the environment. ↓
fix Ensure your environment uses the correct Python interpreter. If necessary, set the `CONNECT_PYTHON` environment variable instead of relying on the flag.
deprecated The `rsconnect write-manifest` command is deprecated in favor of `rsconnect manifest`. ↓
fix Replace `rsconnect write-manifest` with `rsconnect manifest` in your workflows.
gotcha If your content uses environment variables, they must be defined on the Posit Connect server under the content's 'Vars' tab. The `rsconnect deploy` command does not read local .env files. ↓
fix Set required environment variables in the Posit Connect dashboard after deployment, or use the `rsconnect environment` command to set them programmatically.
gotcha The `rsconnect deploy` command by default tries to download dependencies (like pip install). If your environment has network restrictions, use `--no-dependencies` or pre-build the environment. ↓
fix Use `rsconnect deploy --no-dependencies` to skip dependency resolution, or use `rsconnect write-manifest` and manually upload the bundle.
Imports
- RSConnect wrong
from rsconnect import RSConnectcorrectfrom rsconnect.api import RSConnect - api_resolve_server
from rsconnect.api import api_resolve_server
Quickstart
from rsconnect.api import RSConnect
# Replace with your server URL and API key
server = RSConnect(
server='https://connect.example.com',
api_key=os.environ.get('CONNECT_API_KEY', ''),
)
# Get server info
info = server.server_info()
print(info)