Question:How do i install mongodb in my repl
**Screenshots, links, or other helpful context:
**
i dont think its pip3 just try pip or just do it as install mongodb
Firstly, the package name is not called mongodb
— it’s called pymongo
.
You don’t install MongoDB using pip
like in a traditional environment. All your packages, even those from pip
, are managed via the replit.nix file in your repl. If you choose to, you may also use the package manager tab in your Repl for language-specific libraries.
Once you have replit.nix
open, add pkgs.python310Packages.pymongo
inside the square brackets next to deps =
. You should also add pkgs.python310Packages.pip
to that file as well. For example:
{ pkgs }: {
deps = [
pkgs.packageNameHere
pkgs.someLibrary.anotherPackage
# replace this with more packages if you need them
];
}
This is an example format for replit.nix
. Add your packages as you need them. If you’re looking for more packages to install and you don’t know their names, go to the NixOS package search tool and find what you need.
Next time you run your repl or try to execute a command in the shell, it will update your repl with the packages you listed. You’ll get errors if the package names are incorrect or it’s simply not found.
On the bottom left of the screen in your repl, you’ll see a Tools section. Find the Packages button in that list, and click it. Then, go to the right side of your screen, and type pymongo
in the search bar. Find the package that matches that name, then click the Install button.
This should install the package, and you’ll be all set. It’s a lot easier than using replit.nix
; however, using that file is necessary for installing essential things like another language or package manager.
Cheers,
Jade (@zyx)
AFAIK, you generally don’t install packages via the nix
file, I usually do it with poetry
via the Shell tab.