Closed Desmond-Campbell closed 1 year ago
Why is there an or? Should first install python and then install python3.10-dev
On Fri, Sep 8, 2023 at 11:41 PM Desmond Campbell @.***> wrote:
My sequence of commands on 4 different Ubuntu 22 boxes below. I'm about to try on a lower version of Ubuntu.
sudo apt install ffmpeg python3.10 or sudo apt install ffmpeg python3.10-dev
sudo apt install pip
pip install backgroundremover
backgroundremover -i "/path/to/image.jpeg" -o "output.png" or backgroundremover -i "/path/to/image.jpeg" -m "u2net" -o "output.png" or backgroundremover -i "/path/to/image.jpeg" -m "u2net_human_seg" -o "output.png" or backgroundremover -i "/path/to/image.jpeg" -m "u2netp" -o "output.png"
I got this error on all the boxes.
Traceback (most recent call last): File "/usr/local/bin/backgroundremover", line 8, in
sys.exit(main()) File "/usr/local/lib/python3.10/dist-packages/backgroundremover/cmd/cli.py", line 239, in main remove( File "/usr/local/lib/python3.10/dist-packages/backgroundremover/bg.py", line 183, in remove model = get_model(model_name) File "/usr/local/lib/python3.10/dist-packages/backgroundremover/bg.py", line 171, in get_model return detect.load_model(model_name="u2net") File "/usr/local/lib/python3.10/dist-packages/backgroundremover/u2net/detect.py", line 82, in load_model torch.load( File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1051, in _legacy_load typed_storage._untyped_storage._set_from_file( RuntimeError: storage has wrong byte size: expected %ld got %ld-2384061055873887482048** — Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/97, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXFVN7DALWBUG36WQZ3XZPQP7ANCNFSM6AAAAAA4RFEAQA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
My bad...the or is just specifying that I tried different variations of the commands. I'm trying now on a Ubuntu 20 box.
Ah okay, might need more memory to run it?
I will try that. The box has 8GB.
I just tried on a Ubuntu 20. I'll try on a box that has 32 GB to rule it out.
finished downloading part 1 of u2net
finished downloading part 2 of u2net
downloading part 3 of u2net
finished downloading part 3 of u2net
downloading part 4 of u2net
finished downloading part 4 of u2net
Traceback (most recent call last):
File "/usr/local/bin/backgroundremover", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/backgroundremover/cmd/cli.py", line 239, in main
remove(
File "/usr/local/lib/python3.8/dist-packages/backgroundremover/bg.py", line 183, in remove
model = get_model(model_name)
File "/usr/local/lib/python3.8/dist-packages/backgroundremover/bg.py", line 171, in get_model
return detect.load_model(model_name="u2net")
File "/usr/local/lib/python3.8/dist-packages/backgroundremover/u2net/detect.py", line 82, in load_model
torch.load(
File "/usr/local/lib/python3.8/dist-packages/torch/serialization.py", line 815, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/usr/local/lib/python3.8/dist-packages/torch/serialization.py", line 1051, in _legacy_load
typed_storage._untyped_storage._set_from_file(
RuntimeError: storage has wrong byte size: expected %ld got %ld-16888554710880130762048```
OK, I tried with the same Ubuntu 20 box with 32 GB and got the same error. Weird, right?
can you remove the background from the image using backgroundremoverai.com/image ?
On Sat, Sep 9, 2023 at 12:12 AM Desmond Campbell @.***> wrote:
OK, I tried with the same Ubuntu 20 box with 32 GB and got the same error. Weird, right?
— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/97#issuecomment-1712408358, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXGJNR3DQXPXMB6WIVLXZPUDHANCNFSM6AAAAAA4RFEAQA . You are receiving this because you commented.Message ID: @.***>
This is it: https://api.backgroundremoverai.com/static/downloads/4b6a425b51a84e61ae628b32078eb91e/backgroundremover.png
It looks weird, but that's OK. I'm more worried that the cli tool isn't working. I've tried the tool on your site with other images and they work.
I tried the CLI with a few different versions of torch. The oldest version that is compatible in anyway is 1.12.0. That version and every other up to 2.0.0+ throw the same runtime error.
Has anyone had success installing this recently on Ubuntu?
Just to clarify, you installed on what ever box python3.x-dev (what ever version, so say python3.8-dev if you have python3.8, or in the other python3.10-dev)
I just tried it with python3.10 after installing python3.10-dev it worked,
So, the download seems to go to the end and all 4 parts download. It's just when I call the command to do the conversation I get that error.
What version of Ubuntu are you using? What version of torch?
Can you send a history of the commands?
So you did not clarify. First in stalled say python3.10, then you ran sudo apt install python3.10-dev
or did you just run sudo apt install python3-dev
?
So it looks lie you're using all the latest versions.Hmmm. Strange.
Send a history of the commands you used to install and then run the program, from start to finish.
This was the sequence:
sudo apt install ffmpeg python3.10 sudo apt install pip pip install backgroundremover
backgroundremover -i "/path/to/image.jpeg" -o "output.png"
Once again you must install python3.10-dev
and you seem to gloss over the thing that is in the read me and repeated in this thread. Please run sudo apt install python3.10-dev
or what ever version of python you are using.
OK, so that's why I had the "or". I had tried it with the -dev first and then without it and I got the same results. It's just so strange to me.
So, as I said imideatly after you question "Why is there an or? Should first install python and then install python3.10-dev" So I am unsure how else to make it clear that after installing python you have to install python3.10-dev and then install backgroundremover
Or what ever version of python you installed, so say for example if you install python3.8 then you must install python3.8-dev, or in your case it showed python3.10 so then python3.10-dev
Ahh. It wasn't clear it had to be both. Cool. I'll try later and report here. Thanks much.
I'm gonna close the issue, reopen if its still an issue
Just for the record, I'm confirming that I tried this with the advice and it worked on a fresh box.
For some reason it still didn't work on the old box.
If anyone else encounters this error, just do it in the order Johnathan specifies.
apt-get install python3.x
apt-get install python3.x-dev
apt-get install pip
pip install backgroundremover
My sequence of commands on 4 different Ubuntu 22 boxes below. I'm about to try on a lower version of Ubuntu.
sudo apt install ffmpeg python3.10
orsudo apt install ffmpeg python3.10-dev
sudo apt install pip
pip install backgroundremover
backgroundremover -i "/path/to/image.jpeg" -o "output.png"
orbackgroundremover -i "/path/to/image.jpeg" -m "u2net" -o "output.png"
orbackgroundremover -i "/path/to/image.jpeg" -m "u2net_human_seg" -o "output.png"
orbackgroundremover -i "/path/to/image.jpeg" -m "u2netp" -o "output.png"
I got this error on all the boxes.