Install packages using the Shell
Open the Shell tool in the Project Editor and run the appropriate command for your language’s package manager:Install packages using Agent
You can ask Agent to install packages for you directly in chat. For example:- “Install the axios package”
- “Add Flask and SQLAlchemy to my project”
- “Set up TailwindCSS”
Automatic import detection
Replit automatically analyzes your code for missing dependencies each time you select Run. If your code imports a package that is not yet installed, Replit detects it and installs the latest version automatically. For example, if you addimport flask to main.py, the next time you select Run, the Console displays a message indicating that Flask is being installed.
You can configure automatic import detection in the .replit file using the
packager.features.guessImports setting.Override automatic detection
If the wrong package was detected, or you need a specific version, run the correct install command in the Shell. For example:Python package managers
When you create a Python Replit App, your package manager is poetry by default. This meanspip install does not manage your dependencies. Instead, use poetry add <package> or upm add <package> in the Shell.
Switch from poetry to pip
If you prefer usingpip, follow these steps:
1
Open the Shell and run:Remove the lock file so that the packaging infrastructure switches to pip:
2
Move your dependencies
Transfer your dependencies from the
[tool.poetry.dependencies] section in pyproject.toml to requirements.txt. For example, flask = "^3.0.2" becomes flask>=3.0.2,<4.3
Clean up pyproject.toml
Delete the
[tool.poetry...] sections from pyproject.toml.pip for all future operations, and automatic import detection continues to work as expected.
System dependencies with Nix
Replit supports all programming languages through integration with Nix. If you need system-level dependencies beyond standard language packages, you can add them to your replit.nix file.Nix packages
Add system-level dependencies by editingreplit.nix directly. You can search for available packages at search.nixos.org.