Import problem Urwid

Bug description: Import bug.

Expected vs Current Behavior: Import urwid do not work after install in shell. I used to work. ModuleNotFoundError: No module named ‘urwid’.

Steps to reproduce: run code.

Bug appears at this link: https://replit.com/@ViktorMorozov5/Lesson-6-Password

Screenshot(s)/Screen Recording:
image

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

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

Hi @ViktorMorozov5 . Thanks for reporting.
Can you add pkgs.urwid to your dependency list on replit.nix ,and see if that helps?

Hi @ViktorMorozov5 , welcome to the forums!
Can you try entering poetry add urwid in the Shell?
Hope this helps!

1 Like

Hello!
Thank you for Your advice, but it doesn’t work for me.

Hello, @SuzyAtReplit!

How can i do this? I’m new to Replit.

A: When running your project urwid (https://replit.com/@ViktorMorozov5/urwid?v=1#main.py), I don’t get any import error. It works fine (for me at least).

B: To add pkgs.urwid to your dependency list, click the 3 dots on the file list and click “show hidden files”. Then scroll down to the file replit.nix, and there’ll be an array called deps. Add pkgs.urwid into that list.

For example, this is what my projects replit.nix file looks like:

{ pkgs }: {
	deps = [
   pkgs.portmidi
   pkgs.pkg-config
   pkgs.libpng
   pkgs.libjpeg
   pkgs.freetype
   pkgs.fontconfig
   pkgs.SDL2_ttf
   pkgs.SDL2_mixer
   pkgs.SDL2_image
   pkgs.SDL2
	];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      pkgs.portmidi
      pkgs.libpng
      pkgs.freetype
      pkgs.SDL2_ttf
      pkgs.SDL2_mixer
      pkgs.SDL2_image
      pkgs.SDL2
    ];
  };
}

It would become:

{ pkgs }: {
	deps = [
   pkgs.portmidi
   pkgs.pkg-config
   pkgs.libpng
   pkgs.libjpeg
   pkgs.freetype
   pkgs.fontconfig
   pkgs.SDL2_ttf
   pkgs.SDL2_mixer
   pkgs.SDL2_image
   pkgs.SDL2
   pkgs.urwid
	];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      pkgs.portmidi
      pkgs.libpng
      pkgs.freetype
      pkgs.SDL2_ttf
      pkgs.SDL2_mixer
      pkgs.SDL2_image
      pkgs.SDL2
    ];
  };
}
3 Likes

Notice how I added the pkgs.urwid at the bottom of the deps…

Thank you very much, man! It works!

1 Like

Np, though you should say thanks to @SuzyAtReplit, as they provided the real answer here (I just explained how to implement it)

1 Like

Thank you for your advice!

1 Like

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