Doesn't automatically install if written in requirements.txt

Replit fails to install python postgres package from package manager or if written in requirements.txt. How can i fix this to enable link to neon PG db?

https://replit.com/@karimahmad92/Soccer-Team-Database-and-Generator)

Hi @karimahmad92 !
You can use the PostgreSQL Database that is built into the repl environment.
Read more here.
Hope this helps!

1 Like

move to Nix modules to prevent this bug

1 Like

I think OP wanted to use a separate db, and his/her problem was that python postgres isn’t installing. try running pip install yourPackageName in the shell and replace yourPackageName with the package you want to install.

Also I have a few things to say:

  1. DO NOT expose your database password in your code
  2. You don’t need the sqlite file seeing that you’re using PG with Neon.
1 Like

Will the postgres module even install? Does Replit even allow it sonce they have their own? It would defeat the whole purpose of the paid Postgres then…

I’m trying to use the neon built-in db actually!

I tried pip install but that also failed to intsall the package.

Yes removing sqlite but thank you for flagging! and no idea how not to expose the db password…

1 Like

To not expose the db password, use replit’s Secrets tool.
Open a Secrets tab in the editor from Tools or from a new tab. Secrets are environment variables that no one else can see and aren’t included in forks (which includes the cover page).

You can access it like this:

import os
os.environ["MY_SUPER_SECRET_DB_PASSWORD"]

Also, what is the pip error?

2 Likes

yeah, your venv is broken, so