Imports not working

Bug description:
Even though i have packages installed in a python environment, imports like flask and boto3 are not working

Expected vs Current Behavior:

Steps to reproduce:

Bug appears at this link: https://replit.com/@VarounHanooman4/docjan#main.py

Screenshot(s)/Screen Recording:

Browser/OS/Device: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36

Replit Profile: https://replit.com/@DariusRamnath

:wave: Welcome to the forum @DariusRamnath!

Can you try upm add flask boto3 in the Shell tab?

Try showing hidden files (3 dots in file manager), open replit.nix, and try adding pkgs.flask and pkgs.boto3 to the deps list.

deps is supposed to be empty in Python Repls.

Certain python packages require deps because they need some system dependencies and/or shared libraries. (System dependencies installed with “unknown command” in shell may cause problems though.)

The correct way to install system dependencies for certain python packages is automatically, either via normal installation in Packages tool, or with auto guessing.
pip, poetry, and upm in the shell do not auto-install system dependencies (maybe this should be requested).
System dependencies can also be manually installed via System Dependencies tool (which does not support shared libraries), or with replit.nix

Flask doesn’t require a Nix package there, like pkgs.flask. Normally a poetry add works for me.

1 Like

My proof that at least some packages require being added to deps:
My interpretation of the problem is he has them installed, but can’t import them…
Import problem Urwid - Support / Bug Reports - Replit Ask

See:

(note that the feature described is currently only for the Packages tool or auto guessing, not shell commands)
boto3 might require some system dependencies.

The error message, if any, needs to provided, or more specifics on what the problem is.

2 Likes

I tried it, nothing was displayed and the error still persists.