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'
Remove Image Background (AI) in Inkscape doesn't work
-
- Phoca Member
- Posts: 21
- Joined: 27 Jun 2022, 21:48
- Jan
- Phoca Hero
- Posts: 48648
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Remove Image Background (AI) in Inkscape doesn't work
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
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
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 21
- Joined: 27 Jun 2022, 21:48
Re: Remove Image Background (AI) in Inkscape doesn't work
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').
Rembg works in the console, but still doesn't work in Inkscape (ModuleNotFoundError: No module named 'rembg').
- Jan
- Phoca Hero
- Posts: 48648
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Remove Image Background (AI) in Inkscape doesn't work
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:
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 21
- Joined: 27 Jun 2022, 21:48
Re: Remove Image Background (AI) in Inkscape doesn't work
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.
- Jan
- Phoca Hero
- Posts: 48648
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Remove Image Background (AI) in Inkscape doesn't work
Great to hear it. Thank you for the info.
Jan
Jan
If you find Phoca extensions useful, please support the project