Error ModuleNotFoundError: No module named 'pymatting_aot.aot'
Hello, I have centos 8 server.
This is the error after running the command rembg -o input_image output_image
Failed to import ahead-of-time-compiled modules. This is expected on first import.
Compiling modules and trying again (this might take a minute).
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pymatting_aot/cc.py", line 21, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/rembg", line 5, in
This is the command I have used to install rembg
python3.8 -m pip install --upgrade pip
[root@ ]# python3.8 -m pip install rembg
Processing /root/.cache/pip/wheels/c4/52/be/f93ed10eb3209e691a9226d0ba337172ef19e38a0014892198/rembg-1.0.15-cp38-none-any.whl Requirement already satisfied: pillow==8.0.1 in /usr/local/lib64/python3.8/site-packages (from rembg) (8.0.1) Requirement already satisfied: numpy==1.19.4 in /usr/local/lib64/python3.8/site-packages (from rembg) (1.19.4) Requirement already satisfied: requests==2.24.0 in /usr/local/lib/python3.8/site-packages (from rembg) (2.24.0) Requirement already satisfied: scipy==1.5.4 in /usr/local/lib64/python3.8/site-packages (from rembg) (1.5.4) Requirement already satisfied: scikit-image==0.17.2 in /usr/local/lib64/python3.8/site-packages (from rembg) (0.17.2) Requirement already satisfied: waitress==1.4.4 in /usr/local/lib/python3.8/site-packages (from rembg) (1.4.4) Requirement already satisfied: pymatting==1.1.1 in /usr/local/lib/python3.8/site-packages (from rembg) (1.1.1) Requirement already satisfied: tqdm==4.51.0 in /usr/local/lib/python3.8/site-packages (from rembg) (4.51.0) Requirement already satisfied: flask==1.1.2 in /usr/local/lib/python3.8/site-packages (from rembg) (1.1.2) Requirement already satisfied: torchvision==0.8.1 in /usr/local/lib64/python3.8/site-packages (from rembg) (0.8.1) Requirement already satisfied: torch==1.7.0 in /usr/local/lib64/python3.8/site-packages (from rembg) (1.7.0) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.8/site-packages (from requests==2.24.0->rembg) (1.25.11) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/site-packages (from requests==2.24.0->rembg) (2020.11.8) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.8/site-packages (from requests==2.24.0->rembg) (3.0.4) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.8/site-packages (from requests==2.24.0->rembg) (2.10) Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.8/site-packages (from scikit-image==0.17.2->rembg) (2020.10.1) Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib64/python3.8/site-packages (from scikit-image==0.17.2->rembg) (3.3.3) Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.8/site-packages (from scikit-image==0.17.2->rembg) (2.5) Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.8/site-packages (from scikit-image==0.17.2->rembg) (2.9.0) Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib64/python3.8/site-packages (from scikit-image==0.17.2->rembg) (1.1.1) Requirement already satisfied: numba!=0.49.0 in /usr/local/lib64/python3.8/site-packages (from pymatting==1.1.1->rembg) (0.51.2) Requirement already satisfied: Jinja2>=2.10.1 in /usr/local/lib/python3.8/site-packages (from flask==1.1.2->rembg) (2.11.2) Requirement already satisfied: click>=5.1 in /usr/local/lib/python3.8/site-packages (from flask==1.1.2->rembg) (7.1.2) Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python3.8/site-packages (from flask==1.1.2->rembg) (1.1.0) Requirement already satisfied: Werkzeug>=0.15 in /usr/local/lib/python3.8/site-packages (from flask==1.1.2->rembg) (1.0.1) Requirement already satisfied: dataclasses in /usr/local/lib/python3.8/site-packages (from torch==1.7.0->rembg) (0.6) Requirement already satisfied: future in /usr/local/lib/python3.8/site-packages (from torch==1.7.0->rembg) (0.18.2) Requirement already satisfied: typing-extensions in /usr/local/lib/python3.8/site-packages (from torch==1.7.0->rembg) (3.7.4.3) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib64/python3.8/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (1.3.1) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /usr/local/lib/python3.8/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (2.4.7) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.8/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (2.8.1) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.8/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (0.10.0) Requirement already satisfied: decorator>=4.3.0 in /usr/local/lib/python3.8/site-packages (from networkx>=2.0->scikit-image==0.17.2->rembg) (4.4.2) Requirement already satisfied: llvmlite<0.35,>=0.34.0.dev0 in /usr/local/lib64/python3.8/site-packages (from numba!=0.49.0->pymatting==1.1.1->rembg) (0.34.0) Requirement already satisfied: setuptools in /usr/lib/python3.8/site-packages (from numba!=0.49.0->pymatting==1.1.1->rembg) (41.6.0) Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib64/python3.8/site-packages (from Jinja2>=2.10.1->flask==1.1.2->rembg) (1.1.1) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.8/site-packages (from python-dateutil>=2.1->matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (1.15.0) Installing collected packages: rembg Successfully installed rembg-1.0.15
Please suggest
same here..
I had error when try rembg -o input
Failed to import ahead-of-time-compiled modules. This is expected on first import.
Compiling modules and trying again (this might take a minute).
Traceback (most recent call last):
File "/home/tony/PycharmProjects/rem/venv/lib/python3.8/site-packages/pymatting_aot/cc.py", line 21, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tony/PycharmProjects/rem/venv/lib/python3.8/site-packages/numpy/distutils/unixccompiler.py", line 50, in UnixCCompiler__compile
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + deps +
File "/home/tony/PycharmProjects/rem/venv/lib/python3.8/site-packages/numpy/distutils/ccompiler.py", line 90, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tony/PycharmProjects/rem/venv/bin/rembg", line 5, in
please suggest
you need to install the python3-dev
apt-get install -y python3-dev
[solved] sudo dnf install gcc-c++, after it works fine. same there. Fedora 33, python-devel installed. venv with python 3.8.
$ rembg
Failed to import ahead-of-time-compiled modules. This is expected on first import.
Compiling modules and trying again (this might take a minute).
Traceback (most recent call last):
File "/home/sav/pytest/envrembg/lib64/python3.8/site-packages/pymatting_aot/cc.py", line 21, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sav/pytest/envrembg/bin/rembg", line 5, in numpy.distutils present. If using conda try:
#> conda install gcc_linux-64 gxx_linux-64
you need to install the python3-dev
apt-get install -y python3-dev
thanks, I solved it
you need to install the python3-dev
apt-get install -y python3-dev
It's not working on windows
In my case I still had to install an compiler:
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends manpages-dev
Please let me know How to fix this in windows?
I was able to fix it on ubuntu with this command:
apt-get install python3.8-dev
Please let me know How to fix this in windows?
Install “C++ build tools” on windows. Need 6GB free disk space
Download from visualstudio site below : https://visualstudio.microsoft.com/
Step1: download the "Visualstudio BuildTools" , a small file installer
Step2 : run this install and select “C++ build tools” , install it
apt-get install -y build-essential also fixes the issue.
Tested when building a Docker image on top of python:3.8-slim-buster.
hi friends, i have the same error in windows, how can i fix it? my python version is 3.8.1 and i have installed C++ Build tool 14.0
hi friends, i have the same error in windows, how can i fix it? my python version is 3.8.1 and i have installed C++ Build tool 14.0
install python 3.8.7 on windows
I recently had the same issue and none of the solutions here helped.
I was trying to clone a server and run a test script after installing all prereqs and this is where I encountered this issues.
Finally, I have found that the interpreter was somehow cutting short the first-install compile operation.
The solution was to open the python interpreter and import both rembg and rembg.bg and thus everything was compiled as intended and it worked.
I am using rh-python38 on CentOS 7
This solved my problem:
yum install rh-python38-python-devel
None of above solves the issue for me, tried them all. WSL ubuntu 20.04. python 3.8
did update, upgrade. python3-dev already installed same with build-essential
I've also tried all above solutions for window but none of the solutions works. Any help would be appreciated. Thanks.
Python\Python39\lib\site-packages\pymatting_aot\cc.py", line 36, in <module>
import pymatting_aot.aot
ModuleNotFoundError: No module named 'pymatting_aot.aot'
None of above solves the issue for me, tried them all. WSL ubuntu 20.04. python 3.8
did update, upgrade. python3-dev already installed same with build-essential
me too
None of above solves the issue for me, tried them all. WSL ubuntu 20.04. python 3.8
did update, upgrade. python3-dev already installed same with build-essential
me too
I managed to make it work for me https://github.com/danielgatis/rembg/issues/133#issuecomment-912441274
Same issue in ubuntu when installing rembg as a regular user. When switching to a sudoer and installing everything as root, everything installs fine (when fixing numpy==1.20.0)
Which makes me wonder whether this is a bindings issue.