Page 1 of 1
Remove Image Background (AI) in Inkscape doesn't work
Posted: 17 Dec 2024, 22:48
by mirekjl
Hello, I installed Inkscape, Phoca Remove Image Backgraound and rembg. Rembg works in the command line, but Remove Image Background (AI) in Inkscape doesn't work. Here is the output:
...\AppData\Roaming\inkscape\extensions\remove_bg.py:26: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.spawn import find_executable
Traceback (most recent call last):
File ...\AppData\Roaming\inkscape\extensions\remove_bg.py", line 34, in <module>
from rembg import new_session, remove
ModuleNotFoundError: No module named 'rembg'
Re: Remove Image Background (AI) in Inkscape doesn't work
Posted: 19 Dec 2024, 01:36
by Jan
Hi, I think, the warning is not the problem, but inkscape cannot find the module rembg.
Python is similar to Javascript, it can be installed globaly or in some specific virtual environemt. So the question is where did you install the rembg module? Globally or somewhere on virtual place where inkscape cannot access?
Jan
Re: Remove Image Background (AI) in Inkscape doesn't work
Posted: 19 Dec 2024, 10:31
by mirekjl
Hello. First, I installed Python 3.12 without administrative rights in C:\Users\MyUser\AppData\Local\Programs\Python\Python312. Then I used pip install rembg to C:\Users\MyUser\AppData\Local\Programs\Python\Python312\Scripts. Environment variables are set for the user MyUser. The Phoca script is uzipped to the folder C:\Users\MyUser\AppData\Roaming\inkscape\extensions\phoca-inkscape-remove-bg-v1.0.1.
Rembg works in the console, but still doesn't work in Inkscape (ModuleNotFoundError: No module named 'rembg').
Re: Remove Image Background (AI) in Inkscape doesn't work
Posted: 20 Dec 2024, 01:43
by Jan
Hi, there is no problem with the script as it is normally loaded in Inkscape. The problem is, Inkscape cannot find the Python module Rembg, so this mostly means, the Inkscape has no access to python environment which includes the Rembg library :Idea:
Re: Remove Image Background (AI) in Inkscape doesn't work
Posted: 20 Dec 2024, 15:26
by mirekjl
Hello. I installed Anaconda and created an environment with rembg. Then I pointed preferences.xml in Inkscape to python path. It works now. Looks good. Good work, Jan.
Re: Remove Image Background (AI) in Inkscape doesn't work
Posted: 26 Dec 2024, 02:17
by Jan
Great to hear it. Thank you for the info.
Jan