Comments (17)
Sorry, but I have made several manipulations.
And finally done as a root user
pip uninstall rembg
pip install rembg
installation is successfull but when calling rembg, it doesn't work anymore, i have this error
curl https://www.mydomain.fr/vase.jpg | rembg > output.png
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Traceback (most recent call last):
File "/usr/local/bin/rembg", line 5, in <module>
from rembg.cmd.cli import main
File "/usr/local/lib/python3.6/site-packages/rembg/cmd/cli.py", line 7, in <module>
from ..bg import remove
File "/usr/local/lib/python3.6/site-packages/rembg/bg.py", line 67, in <module>
@functools.lru_cache
File "/usr/lib64/python3.6/functools.py", line 477, in lru_cache
raise TypeError('Expected maxsize to be an integer or None')
TypeError: Expected maxsize to be an integer or None
14 556k 14 81659 0 0 12709 0 0:00:44 0:00:06 0:00:38 12709
curl: (23) Failed writing body (261 != 16384)
This was working at first installation, I don't know what to do now...
thanks !
from rembg.
sorry, I have no idea how to CodeIgniter works and I don't know anything about PHP.
from rembg.
I will soon release a Docker Container which you could deploy and call it via its API.
from rembg.
Thank you for your answer.
I have found the real problem : is that rembg can only be executed as a root user so that when calling
from my website, it can't work.
Do you know how I can give rights rembg to be executed not only as root user ? (in Linux/Centos7)
Thank you a lot
from rembg.
you don't need a root user to install rembg.
just do:
pip install --user rembg
and run it as a normal user
from rembg.
Thank you. I did that but still the same error.
Problem in the cache ? ( lru_cache) because I have installed twice ?
Thanks
from rembg.
Installation seems ok
pip install rembg
Processing /root/.cache/pip/wheels/cd/dd/ef/0eea656948c0f72013eac870556c4ebf795052103acb39c44e/rembg-1.0.14-py3-none-any.whl
Requirement already satisfied: scikit-image==0.17.2 in /usr/local/lib64/python3.6/site-packages (from rembg) (0.17.2)
Requirement already satisfied: tqdm==4.48.2 in /usr/local/lib/python3.6/site-packages (from rembg) (4.48.2)
Requirement already satisfied: numpy==1.19.1 in /usr/local/lib64/python3.6/site-packages (from rembg) (1.19.1)
Requirement already satisfied: waitress==1.4.4 in /usr/local/lib/python3.6/site-packages (from rembg) (1.4.4)
Requirement already satisfied: pillow==7.2.0 in /usr/local/lib64/python3.6/site-packages (from rembg) (7.2.0)
Requirement already satisfied: torch==1.6.0 in /usr/local/lib64/python3.6/site-packages (from rembg) (1.6.0)
Requirement already satisfied: flask==1.1.2 in /usr/local/lib64/python3.6/site-packages (from rembg) (1.1.2)
Requirement already satisfied: pymatting==1.0.6 in /usr/local/lib/python3.6/site-packages (from rembg) (1.0.6)
Requirement already satisfied: scipy==1.5.2 in /usr/local/lib64/python3.6/site-packages (from rembg) (1.5.2)
Requirement already satisfied: torchvision==0.7.0 in /usr/local/lib64/python3.6/site-packages (from rembg) (0.7.0)
Requirement already satisfied: requests==2.24.0 in /usr/local/lib/python3.6/site-packages (from rembg) (2.24.0)
Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib64/python3.6/site-packages (from scikit-image==0.17.2->rembg) (3.3.2)
Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.6/site-packages (from scikit-image==0.17.2->rembg) (2.9.0)
Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.6/site-packages (from scikit-image==0.17.2->rembg) (2.5)
Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib64/python3.6/site-packages (from scikit-image==0.17.2->rembg) (1.1.1)
Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.6/site-packages (from scikit-image==0.17.2->rembg) (2020.9.3)
Requirement already satisfied: future in /usr/local/lib/python3.6/site-packages (from torch==1.6.0->rembg) (0.18.2)
Requirement already satisfied: Werkzeug>=0.15 in /usr/local/lib/python3.6/site-packages (from flask==1.1.2->rembg) (1.0.1)
Requirement already satisfied: click>=5.1 in /usr/local/lib/python3.6/site-packages (from flask==1.1.2->rembg) (7.1.2)
Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python3.6/site-packages (from flask==1.1.2->rembg) (1.1.0)
Requirement already satisfied: Jinja2>=2.10.1 in /usr/local/lib/python3.6/site-packages (from flask==1.1.2->rembg) (2.11.2)
Requirement already satisfied: numba>=0.47.0 in /usr/local/lib64/python3.6/site-packages (from pymatting==1.0.6->rembg) (0.51.2)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests==2.24.0->rembg) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests==2.24.0->rembg) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests==2.24.0->rembg) (2020.6.20)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests==2.24.0->rembg) (1.25.10)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib64/python3.6/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (1.3.1)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /usr/local/lib/python3.6/site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.17.2->rembg) (2.4.7)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/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.6/site-packages (from networkx>=2.0->scikit-image==0.17.2->rembg) (4.4.2)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib64/python3.6/site-packages (from Jinja2>=2.10.1->flask==1.1.2->rembg) (1.1.1)
Requirement already satisfied: llvmlite<0.35,>=0.34.0.dev0 in /usr/local/lib64/python3.6/site-packages (from numba>=0.47.0->pymatting==1.0.6->rembg) (0.34.0)
Requirement already satisfied: setuptools in /usr/lib/python3.6/site-packages (from numba>=0.47.0->pymatting==1.0.6->rembg) (39.2.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/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.14
from rembg.
It seems also you change something 2 days ago.
line @functools.lru_cache
Maybe a problem with this new version ?
Thank you again
from rembg.
try to remove the ~/.u2net folder and run again.
from rembg.
It's done and here is the result after running again :
[root@ns344379 rembg]# curl -s http://www.mydomain.fr/uploads/temp_flux/vase.jpg | rembg > output.png
Traceback (most recent call last):
File "/usr/local/bin/rembg", line 5, in <module>
from rembg.cmd.cli import main
File "/usr/local/lib/python3.6/site-packages/rembg/cmd/cli.py", line 7, in <module>
from ..bg import remove
File "/usr/local/lib/python3.6/site-packages/rembg/bg.py", line 11, in <module>
from .u2net import detect
ModuleNotFoundError: No module named 'rembg.u2net'
from rembg.
try to remove the ~/.u2net folder and run again.
this folder is in your HOME folder.
Update your python to >= 3.8
Follow this steps:
pip uninstall rembg
pip uninstall --user rembg
rm -fr ~/.u2net
pip install --user rembg
from rembg.
ok I have done these steps and reinstall rembg with pip3.8 like that
[root@ns344379 bin]# pip3.8 install rembg
Collecting rembg
Downloading rembg-1.0.15.tar.gz (13 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting torch==1.7.0
Downloading torch-1.7.0-cp38-cp38-manylinux1_x86_64.whl (776.8 MB)
|████████████████████████████████| 776.8 MB 57 bytes/s
Collecting requests==2.24.0
Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting flask==1.1.2
Using cached Flask-1.1.2-py2.py3-none-any.whl (94 kB)
Collecting pillow==8.0.1
Downloading Pillow-8.0.1-cp38-cp38-manylinux1_x86_64.whl (2.2 MB)
|████████████████████████████████| 2.2 MB 56.3 MB/s
Collecting numpy==1.19.4
Downloading numpy-1.19.4-cp38-cp38-manylinux2010_x86_64.whl (14.5 MB)
|████████████████████████████████| 14.5 MB 29.5 MB/s
Collecting torchvision==0.8.1
Downloading torchvision-0.8.1-cp38-cp38-manylinux1_x86_64.whl (12.8 MB)
|████████████████████████████████| 12.8 MB 46.2 MB/s
Collecting scikit-image==0.17.2
Downloading scikit_image-0.17.2-cp38-cp38-manylinux1_x86_64.whl (12.4 MB)
|████████████████████████████████| 12.4 MB 58.3 MB/s
Collecting waitress==1.4.4
Using cached waitress-1.4.4-py2.py3-none-any.whl (58 kB)
Collecting scipy==1.5.4
Downloading scipy-1.5.4-cp38-cp38-manylinux1_x86_64.whl (25.8 MB)
|████████████████████████████████| 25.8 MB 56.7 MB/s
Collecting tqdm==4.51.0
Downloading tqdm-4.51.0-py2.py3-none-any.whl (70 kB)
|████████████████████████████████| 70 kB 2.6 MB/s
Collecting pymatting==1.1.1
Downloading PyMatting-1.1.1-py3-none-any.whl (48 kB)
|████████████████████████████████| 48 kB 1.1 MB/s
Collecting typing-extensions
Downloading typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting future
Using cached future-0.18.2.tar.gz (829 kB)
Collecting dataclasses
Downloading dataclasses-0.6-py3-none-any.whl (14 kB)
Collecting idna<3,>=2.5
Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2020.11.8-py2.py3-none-any.whl (155 kB)
|████████████████████████████████| 155 kB 67.6 MB/s
Collecting chardet<4,>=3.0.2
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
|████████████████████████████████| 127 kB 68.9 MB/s
Collecting Werkzeug>=0.15
Using cached Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
Collecting itsdangerous>=0.24
Using cached itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Collecting Jinja2>=2.10.1
Using cached Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
Collecting click>=5.1
Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting networkx>=2.0
Using cached networkx-2.5-py3-none-any.whl (1.6 MB)
Collecting PyWavelets>=1.1.1
Downloading PyWavelets-1.1.1-cp38-cp38-manylinux1_x86_64.whl (4.4 MB)
|████████████████████████████████| 4.4 MB 65.1 MB/s
Collecting imageio>=2.3.0
Using cached imageio-2.9.0-py3-none-any.whl (3.3 MB)
Collecting matplotlib!=3.0.0,>=2.0.0
Downloading matplotlib-3.3.2-cp38-cp38-manylinux1_x86_64.whl (11.6 MB)
|████████████████████████████████| 11.6 MB 56.3 MB/s
Collecting tifffile>=2019.7.26
Downloading tifffile-2020.10.1-py3-none-any.whl (152 kB)
|████████████████████████████████| 152 kB 76.5 MB/s
Collecting numba!=0.49.0
Downloading numba-0.51.2-cp38-cp38-manylinux2014_x86_64.whl (3.1 MB)
|████████████████████████████████| 3.1 MB 71.9 MB/s
Collecting MarkupSafe>=0.23
Downloading MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl (32 kB)
Collecting decorator>=4.3.0
Using cached decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3
Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting kiwisolver>=1.0.1
Downloading kiwisolver-1.3.1-cp38-cp38-manylinux1_x86_64.whl (1.2 MB)
|████████████████████████████████| 1.2 MB 70.5 MB/s
Collecting python-dateutil>=2.1
Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting cycler>=0.10
Using cached cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Collecting llvmlite<0.35,>=0.34.0.dev0
Downloading llvmlite-0.34.0-cp38-cp38-manylinux2010_x86_64.whl (24.6 MB)
|████████████████████████████████| 24.6 MB 27.1 MB/s
Requirement already satisfied: setuptools in /usr/local/lib/python3.8/site-packa ges (from numba!=0.49.0->pymatting==1.1.1->rembg) (49.2.1)
Collecting six>=1.5
Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Using legacy 'setup.py install' for future, since package 'wheel' is not install ed.
Building wheels for collected packages: rembg
Building wheel for rembg (PEP 517) ... done
Created wheel for rembg: filename=rembg-1.0.15-py3-none-any.whl size=12392 sha 256=dabe6cba0140e37d6dbb6aa3610d4f9ea8ecdd4d75f52dbd01efff35a8c5d84d
Stored in directory: /root/.cache/pip/wheels/73/a6/25/0f191b765e98af5e60c6de9d b0998692048faf0b8fbaed0e55
Successfully built rembg
Installing collected packages: typing-extensions, future, numpy, dataclasses, to rch, idna, certifi, chardet, urllib3, requests, Werkzeug, itsdangerous, MarkupSa fe, Jinja2, click, flask, pillow, torchvision, decorator, networkx, PyWavelets, scipy, imageio, pyparsing, kiwisolver, six, python-dateutil, cycler, matplotlib, tifffile, scikit-image, waitress, tqdm, llvmlite, numba, pymatting, rembg
Running setup.py install for future ... done
Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 PyWavelets-1.1.1 Werkzeug- 1.0.1 certifi-2020.11.8 chardet-3.0.4 click-7.1.2 cycler-0.10.0 dataclasses-0.6 decorator-4.4.2 flask-1.1.2 future-0.18.2 idna-2.10 imageio-2.9.0 itsdangerous-1 .1.0 kiwisolver-1.3.1 llvmlite-0.34.0 matplotlib-3.3.2 networkx-2.5 numba-0.51.2 numpy-1.19.4 pillow-8.0.1 pymatting-1.1.1 pyparsing-2.4.7 python-dateutil-2.8.1 rembg-1.0.15 requests-2.24.0 scikit-image-0.17.2 scipy-1.5.4 six-1.15.0 tifffil e-2020.10.1 torch-1.7.0 torchvision-0.8.1 tqdm-4.51.0 typing-extensions-3.7.4.3 urllib3-1.25.11 waitress-1.4.4
WARNING: You are using pip version 20.2.1; however, version 20.2.4 is available.
You should consider upgrading via the '/usr/local/bin/python3.8 -m pip install - -upgrade pip' command.
and now run again rembg
[root@ns344379 bin]# curl -s http://www.mydomain.fr/uploads/temp_flux/vase.jpg | rembg > output.png
Traceback (most recent call last):
File "/usr/local/bin/rembg", line 5, in <module>
from rembg.cmd.cli import main
File "/usr/local/lib/python3.8/site-packages/rembg/cmd/cli.py", line 7, in <module>
from ..bg import remove
File "/usr/local/lib/python3.8/site-packages/rembg/bg.py", line 11, in <module>
from .u2net import detect
File "/usr/local/lib/python3.8/site-packages/rembg/u2net/detect.py", line 11, in <module>
import torchvision
File "/usr/local/lib/python3.8/site-packages/torchvision/__init__.py", line 7, in <module>
from torchvision import datasets
File "/usr/local/lib/python3.8/site-packages/torchvision/datasets/__init__.py", line 6, in <module>
from .mnist import MNIST, EMNIST, FashionMNIST, KMNIST, QMNIST
File "/usr/local/lib/python3.8/site-packages/torchvision/datasets/mnist.py", line 11, in <module>
import lzma
File "/usr/local/lib/python3.8/lzma.py", line 27, in <module>
from _lzma import *
ModuleNotFoundError: No module named '_lzma'
Thank you
from rembg.
pandas-dev/pandas#27532 (comment)
from rembg.
ok now, here is the result
[root@ns344379 Python-3.8.6]# curl -s http://www.mydomain.fr/uploads/temp_flux/vase.jpg | rembg > output.png
/usr/local/lib/python3.8/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
return torch._C._cuda_getDeviceCount() > 0
Traceback (most recent call last):
File "/usr/local/bin/rembg", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/rembg/cmd/cli.py", line 113, in main
remove(
File "/usr/local/lib/python3.8/site-packages/rembg/bg.py", line 84, in remove
img = Image.open(io.BytesIO(data)).convert("RGB")
File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2943, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fd6771e3360>
from rembg.
there is no image here:
http://www.mydomain.fr/uploads/temp_flux/vase.jpg
from rembg.
I replace it for some privacy reasons but it exists !
Here it is
http://www.bibelotandco.fr/uploads/temp_flux/vase.jpg
[root@ns344379 Python-3.8.6]# curl -s http://www.bibelotandco.fr/uploads/temp_flux/vase.jpg | rembg > output.png
/usr/local/lib/python3.8/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
return torch._C._cuda_getDeviceCount() > 0
Traceback (most recent call last):
File "/usr/local/bin/rembg", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/rembg/cmd/cli.py", line 113, in main
remove(
File "/usr/local/lib/python3.8/site-packages/rembg/bg.py", line 84, in remove
img = Image.open(io.BytesIO(data)).convert("RGB")
File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2943, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fa9a75dff90>
from rembg.
So when executing with curl, still have the same error.
[root@ns344379 detourage-rembg]# curl -s http://www.bibelotandco.fr/uploads/temp_flux/vase.jpg | rembg > output.png
Traceback (most recent call last):
File "/usr/local/bin/rembg", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/rembg/cmd/cli.py", line 113, in main
remove(
File "/usr/local/lib/python3.8/site-packages/rembg/bg.py", line 84, in remove
img = Image.open(io.BytesIO(data)).convert("RGB")
File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2943, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f5a0e316e00>
When executing with app.py or exec("rembg -o '$out' '$in'");
I have the output file but I get this error message :
[W NNPACK.cpp:80] Could not initialize NNPACK! Reason: Unsupported hardware.
If you have any idea
Thank you
from rembg.
Related Issues (20)
- [FEATURE] Add --gpu 0 --gpu 1 HOT 4
- [BUG] env["CUDA_VISIBLE_DEVICES"] = "0" doesn't work HOT 2
- How do I uninstall Onnx Runtime and Rembg?
- [BUG] onnx runtime errors HOT 2
- [BUG] custom model on windows HOT 1
- [BUG] When using the API, it sometimes gets stuck and the request never completes. The terminal shows an error message when this happens. HOT 2
- [BUG] Missing dependencies from pypi HOT 2
- [BUG] This module is not using GPU at all. HOT 11
- [BUG] Sam model sessions do not respect providers argument HOT 1
- [BUG] Could not use model in custom dir on Win10 with cli command HOT 2
- [FEATURE] Use downloaded model on Cloud Function HOT 3
- Minimal dependencies? HOT 2
- EP error onnxruntime error HOT 4
- [BUG] rembg import remove, ImportError HOT 1
- [BUG] ... HOT 1
- run rembg error HOT 3
- [FEATURE] ...Model load choice and treshold for foreground and background like in auto11 webui HOT 1
- The resulting image is not clear enough, There are silhouettes behind the characters HOT 1
- The resulting image is not clear enough, There are silhouettes behind the characters HOT 1
- SAM model returns inversed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rembg.