Unable to import python libraries despite them being installed

Bug description:
Recently, my flask web server repl suddenly decided to upgrade to the new nix environment for repls right before I loaded it. I was told that this upgrade would not impact the performance of my repl, but it prevented me from running the repl all together. When I install a library via pip, I get this error message:

ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/nix/store/nki9ywqzbvz68vr75kn2r7g1q84f5agy-python3-3.9.6/lib/python3.9/site-packages/dotenv' Consider using the --user option or check the permissions.

If I follow the error message’s solution and do a user installation, the installation appears to complete but when I try to import the library in Python code, I get a module not found error:

ModuleNotFoundError: No module named 'dotenv'

Expected vs Current Behavior:
I expect libraries to be installed via pip by either my Python script or by my own commands I type out in the shell. I expect said libraries to be successfully imported and used by my Python code.

Right now, my repl cannot run because it relies on some libraries (such as Flask) in order to run. Neither of my expectations that I mentioned above are fulfilled. FYI, my repl was running just fine before the nix upgrade.

Steps to reproduce:
Running the repl will give you a module not found error. Attempting to do a non-user installation of a library will result in the error mentioned above.

Bug appears at this link: https://replit.com/@Drakonzai/Access-1

Screenshot(s)/Screen Recording:

^^What happens when you hit the Run button.

Browser/OS/Device: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36 OPR/

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

Welcome to the forums @Drakonzai!

You appear to be using a blank repl template to run your python code. I recommend switching to the official python template, as that will fix these kinds of issues.

Hope this helps!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.