iuliaturc / detextify

Remove text from AI-generated images
MIT License
268 stars 21 forks source link

No module named 'detextify.paddle_text_detector'; 'detextify' is not a package #21

Closed arnoldtonderaimarunda closed 1 year ago

arnoldtonderaimarunda commented 1 year ago

Hi @iuliaturc

Trying to execute...

from detextify.paddle_text_detector import PaddleTextDetector
from detextify.inpainter import LocalSDInpainter
from detextify.detextifier import Detextifier

detextifier = Detextifier(PaddleTextDetector(), LocalSDInpainter())
detextifier.detextify("/my/input/image/path.png", "/my/output/image/path.png")

Get the following error on a AWS Ubuntu Linux CPU machine:

   from detextify.paddle_text_detector import PaddleTextDetector
ModuleNotFoundError: No module named 'detextify.paddle_text_detector'; 'detextify' is not a package

I did the following:- Installed pip install detextify successfully Installed pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple successfully

arnoldtonderaimarunda commented 1 year ago

$ pip list

Package                                       Version
--------------------------------------------- ---------------
absl-py                                       1.3.0
accelerate                                    0.15.0
astor                                         0.8.1
attrdict                                      2.0.1
attrs                                         21.2.0
Automat                                       20.2.0
azure-cognitiveservices-vision-computervision 0.9.0
azure-common                                  1.1.28
azure-core                                    1.26.1
Babel                                         2.8.0
bce-python-sdk                                0.8.74
bcrypt                                        3.2.0
beautifulsoup4                                4.11.1
blinker                                       1.4
cachetools                                    5.2.0
certifi                                       2020.6.20
chardet                                       4.0.0
charset-normalizer                            2.1.1
click                                         8.0.3
cloud-init                                    22.4.2
colorama                                      0.4.4
command-not-found                             0.3
configobj                                     5.0.6
constantly                                    15.1.0
contourpy                                     1.0.6
cryptography                                  3.4.8
cssselect                                     1.2.0
cssutils                                      2.6.0
cycler                                        0.11.0
Cython                                        0.29.32
dbus-python                                   1.2.18
decorator                                     5.1.1
detextify                                     0.1.7
diffusers                                     0.10.2
dill                                          0.3.6
distro                                        1.7.0
distro-info                                   1.1build1
ec2-hibinit-agent                             1.0.0
et-xmlfile                                    1.1.0
filelock                                      3.9.0
fire                                          0.5.0
Flask                                         2.2.2
Flask-Babel                                   2.0.0
fonttools                                     4.38.0
future                                        0.18.2
httplib2                                      0.20.2
huggingface-hub                               0.11.1
hyperlink                                     21.0.0
idna                                          3.3
imageio                                       2.23.0
imgaug                                        0.4.0
importlib-metadata                            4.6.4
incremental                                   21.3.0
isodate                                       0.6.1
itsdangerous                                  2.1.2
jeepney                                       0.7.1
Jinja2                                        3.0.3
jsonpatch                                     1.32
jsonpointer                                   2.0
jsonschema                                    3.2.0
keyring                                       23.5.0
kiwisolver                                    1.4.4
launchpadlib                                  1.10.16
lazr.restfulclient                            0.14.4
lazr.uri                                      1.0.6
lmdb                                          1.4.0
lxml                                          4.9.2
MarkupSafe                                    2.1.1
matplotlib                                    3.6.2
more-itertools                                8.10.0
msrest                                        0.7.1
multiprocess                                  0.70.14
netifaces                                     0.11.0
networkx                                      2.8.8
numpy                                         1.24.0
nvidia-cublas-cu11                            11.10.3.66
nvidia-cuda-nvrtc-cu11                        11.7.99
nvidia-cuda-runtime-cu11                      11.7.99
nvidia-cudnn-cu11                             8.5.0.96
oauthlib                                      3.2.0
openai                                        0.25.0
opencv-contrib-python                         4.7.0.68
opencv-python                                 4.7.0.68
openpyxl                                      3.0.10
opt-einsum                                    3.3.0
packaging                                     22.0
paddle-bfloat                                 0.1.7
paddleocr                                     2.6.1.2
paddlepaddle                                  2.4.1
pandas                                        1.5.2
pandas-stubs                                  1.5.2.221213
pdf2docx                                      0.5.6
pexpect                                       4.8.0
Pillow                                        9.4.0
pip                                           22.0.2
premailer                                     3.10.0
protobuf                                      3.20.0
psutil                                        5.9.4
ptyprocess                                    0.7.0
pyasn1                                        0.4.8
pyasn1-modules                                0.2.1
pyclipper                                     1.3.0.post4
pycryptodome                                  3.16.0
pydantic                                      1.10.4
PyGObject                                     3.42.1
PyHamcrest                                    2.0.2
PyJWT                                         2.3.0
PyMuPDF                                       1.20.2
pyOpenSSL                                     21.0.0
pyparsing                                     2.4.7
pyrsistent                                    0.18.1
pyserial                                      3.5
python-apt                                    2.3.0+ubuntu2.1
python-dateutil                               2.8.2
python-debian                                 0.1.43ubuntu1
python-docx                                   0.8.11
python-magic                                  0.4.24
pytz                                          2022.1
PyWavelets                                    1.4.1
PyYAML                                        5.4.1
rapidfuzz                                     2.13.7
regex                                         2022.10.31
replicate                                     0.4.0
requests                                      2.28.1
requests-oauthlib                             1.3.1
scikit-image                                  0.19.3
scipy                                         1.10.0
SecretStorage                                 3.3.1
service-identity                              18.1.0
setuptools                                    59.6.0
shapely                                       2.0.0
six                                           1.16.0
sos                                           4.4
soupsieve                                     2.3.2.post1
ssh-import-id                                 5.11
systemd-python                                234
termcolor                                     2.2.0
tifffile                                      2022.10.10
tokenizers                                    0.13.2
torch                                         1.13.1
tqdm                                          4.64.1
transformers                                  4.25.1
Twisted                                       22.1.0
types-pytz                                    2022.7.0.0
typing_extensions                             4.4.0
ubuntu-advantage-tools                        27.12
ufw                                           0.36.1
unattended-upgrades                           0.1
urllib3                                       1.26.5
visualdl                                      2.4.2
wadllib                                       1.3.6
Werkzeug                                      2.2.2
wheel                                         0.37.1
zipp                                          1.0.0
zope.interface                                5.4.0
arnoldtonderaimarunda commented 1 year ago

Have verified installation of Paddle i.e python3 -c "import paddle;print(paddle.utils.run_check())" and get feedback...

Running verify PaddlePaddle program ... 
PaddlePaddle works well on 1 CPU.
/home/ubuntu/.local/lib/python3.10/site-packages/paddle/fluid/executor.py:1583: UserWarning: Standalone executor is not used for data parallel
  warnings.warn(
W0104 03:19:42.062288 13387 fuse_all_reduce_op_pass.cc:79] Find all_reduce operators: 2. To make the speed faster, some all_reduce ops are fused during training, after fusion, the number of all_reduce ops is 2.
PaddlePaddle works well on 2 CPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
None
arnoldtonderaimarunda commented 1 year ago

@iuliaturc

Did not understand that Python gets confused when you have a filename the same name as a module. Once I renamed file it worked

jameswan commented 1 year ago

I encountered the same issue and renamed. But now I am receiving this error: Traceback (most recent call last): File "C:\Users\James\Desktop\detextify\detext.py", line 19, in detextifier = Detextifier(PaddleTextDetector(), LocalSDInpainter()) File "C:\Users\James\anaconda3\envs\detextify\lib\site-packages\detextify\inpainter.py", line 155, in init raise Exception("You need a GPU + CUDA to run this model locally.") Exception: You need a GPU + CUDA to run this model locally.

Even though: (tf) C:\Users\James\Desktop\detextify>python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))" [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU')]

arnoldtonderaimarunda commented 1 year ago

HI @jameswan That error means you installed the GPU version of Paddle i.e. paddlepaddle-gpu onto a platform/instance that does not have GPU. You need to uninstall and utilise the CPU version of Paddle i.e. pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple If you need the GPU power then you need to install a GPU-enabled instance to run your script

jameswan commented 1 year ago

Hi @arnoldtonderaimarunda

Thank you for your reply. I have overcome this problem. It was because I didn't install PyTorch for GPU. Once I did this, the error went away.

But see my other CUDA error in the other issue.