Can't install Python module "rembg" in Replit

For some reason, no matter what, it seems as though trying to install the “rembg” / remove background module in Python always results in failure.

The error has to do with dependency conflicts.

After trying to manually revert the version of the “typing_extensions” module (Rembg isn’t compatible with typing_extensions version 4.0.0 yet), Python simply reinstalls the latest version of “typing_extensions.”

Is there something much more obvious that I’m missing? Attached is the final implementation I attempted before making this post. TIA!

Hi @WUemura thank you for your post.

I think you have set your Repl to be private as I cannot see the code when I click on the link.

1 Like

I deleted the Replit in question because it had one line: “import rembg”. Besides that, the project was a boilerplate Python repl.

I’ve tried downloading through both Replit’s packages manager and the CLI. I’ve also tried manually rewriting dependency files and cloning working GitHub builds using the “rembg” module into Repl.

I recreated the replit at where the problem persists.

Hey @WUemura,

could this article help?

Hi @hugoondev,

Although the article itself didn’t include the solution, it led me to finding out the error.

It turns out that ONNXRuntime, a rembg dependency, requires PyTorch & TensorFlow to run, the latter of which is too large to fit onto the disk of a free Repl.

Because of that, I’m pretty sure that use of “rembg” is reserved for boosted Repls.

Thank you for your help!


Thanks for posting this @WUemura as I was also having difficulty setting up rembg last night, investigating what could be the cause.

1 Like

rembg should be compatible with v4 even if the constraint says otherwise; typing_extensions v4 only breaks stuff on python <=3.6. Remove rembg and install it in shell:

pip install -U rembg~=2

You could open an pull request or issue on GitHub - danielgatis/rembg: Rembg is a tool to remove images background to update the typing_extensions version constraint

oops I necroposted again😬

1 Like