Poetry broken for any command

Bug description:

Poetry broken.

When running any Poetry command (or upm, as upm is dependent on Poerty), it throws:

cannot import name 'Mapping' from 'collections' (/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/collections/__init__.py)

I tried to update Poetry but can’t figure out a way to do that.

Expected vs Current Behavior:

Steps to reproduce:

I am not sure how to reproduce this. Creating a new repl doesn’t have the same problem, but both of my repls using the same Git repo has the same problem.

Bug appears at this link: https://replit.com/@junyuw/Notes-AI-Dev

Screenshot(s)/Screen Recording:

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

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

I create a new Repl, Poetry worked fine at the beginning. But after I tried to run, it breaks again. Any clues?

From what I can observe, after hitting run, following directories and files will be created:

__pycache__/
.local/
.pythonlibs/
replit.nix

Try installing your library via packager. I’m pretty sure upm was removed when repls started using nix.

The Packages tool, or even auto guessing imports, should still work.

But do all shell commands fail?

Try entering kill 1 in the shell to reload.

Also, could you share a link to a public repl or fork?

The error message indicates that some code is trying to import Mapping from collections standard library, but I’m pretty sure it is actually in collections.abc. Please see if you could find what code is trying to do this.

1 Like

Yeah shell commands for poetry failed. The error message is from running poetry in shell.

I finally remove .local, replit.nix and disabled auto guess, and it seems to fix the problem.

Hey @junyuw, I think you ran into an issue I’ve been trying to track down. I did a detailed writeup of what’s going on and a workaround over here:

I get that you’ve been able to work around the issue by disabling guessing, but if you’ve got a reliable way to reproduce the issue it’d be great to figure out what’s going on.

I suspect we’re guessing a package that installs an offending transitive dependency, which is a different issue to the one I linked that I’d also like to fix.

Thank you in advance!

2 Likes

Hi sorry for late response! Is there a way I could share a private repl with you for investigation?

I just tried to reproduce but it seems fine now.

1 Like

If you run into any more issues around this, please feel free to DM me a reproducing case.

Great to hear!