ayoolaolafenwa / PixelLib

Visit PixelLib's official documentation https://pixellib.readthedocs.io/en/latest/
MIT License
1.05k stars 265 forks source link

pixellib' is not a package #148

Open skashish opened 2 years ago

skashish commented 2 years ago

Hi

I'm trying to change image background using following code as per official documentation


import pixellib
from pixellib.tune_bg import alter_bg

change_bg = alter_bg()
change_bg.load_pascalvoc_model("deeplabv3_xception_tf_dim_ordering_tf_kernels.h5")
change_bg.change_bg_img(f_image_path = "sample.jpeg",b_image_path = "background.jpeg", output_image_name="new_img.jpeg")

When Running the above script I'm getting

Python 3.6.8 (default, Nov 16 2020, 16:55:22) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pixellib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/var/www/html/public_html/change_background/pixellib.py", line 2, in <module>
    from pixellib.tune_bg import alter_bg
ModuleNotFoundError: No module named 'pixellib.tune_bg'; 'pixellib' is not a package

I have actually installed pixelib

sudo -H pip3 install pixellib --upgrade
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Requirement already satisfied: pixellib in /usr/local/lib/python3.6/site-packages (0.7.1)
Requirement already satisfied: dataclasses in /usr/local/lib/python3.6/site-packages (from pixellib) (0.8)
Requirement already satisfied: pyQt5 in /usr/local/lib64/python3.6/site-packages (from pixellib) (5.15.6)
Requirement already satisfied: tqdm in /usr/local/lib/python3.6/site-packages (from pixellib) (4.64.0)
Requirement already satisfied: future in /usr/local/lib/python3.6/site-packages (from pixellib) (0.18.2)
Requirement already satisfied: pydot in /usr/local/lib/python3.6/site-packages (from pixellib) (1.4.2)
Requirement already satisfied: cloudpickle in /usr/local/lib/python3.6/site-packages (from pixellib) (2.1.0)
Requirement already satisfied: scikit-image in /usr/local/lib64/python3.6/site-packages (from pixellib) (0.17.2)
Requirement already satisfied: imantics in /usr/local/lib/python3.6/site-packages (from pixellib) (0.1.12)
Requirement already satisfied: pillow in /usr/local/lib64/python3.6/site-packages (from pixellib) (8.4.0)
Requirement already satisfied: Cython in /usr/local/lib64/python3.6/site-packages (from pixellib) (0.29.30)
Requirement already satisfied: iopath in /usr/local/lib/python3.6/site-packages (from pixellib) (0.1.9)
Requirement already satisfied: tabulate in /usr/local/lib/python3.6/site-packages (from pixellib) (0.8.9)
Requirement already satisfied: fvcore in /usr/local/lib/python3.6/site-packages (from pixellib) (0.1.5.post20220512)
Requirement already satisfied: omegaconf in /usr/local/lib/python3.6/site-packages (from pixellib) (2.2.2)
Requirement already satisfied: matplotlib in /usr/local/lib64/python3.6/site-packages (from pixellib) (3.3.4)
Requirement already satisfied: yacs in /usr/local/lib/python3.6/site-packages (from pixellib) (0.1.8)
Requirement already satisfied: imgaug in /usr/local/lib/python3.6/site-packages (from pixellib) (0.4.0)
Requirement already satisfied: black in /usr/local/lib64/python3.6/site-packages (from pixellib) (22.3.0)
Requirement already satisfied: termcolor in /usr/local/lib/python3.6/site-packages (from pixellib) (1.1.0)
Requirement already satisfied: hydra-core in /usr/local/lib/python3.6/site-packages (from pixellib) (1.2.0)
Requirement already satisfied: opencv-python in /usr/local/lib64/python3.6/site-packages (from pixellib) (4.5.5.64)
Requirement already satisfied: labelme2coco in /usr/local/lib/python3.6/site-packages (from pixellib) (0.1.2)
Requirement already satisfied: tomli>=1.1.0 in /usr/local/lib/python3.6/site-packages (from black->pixellib) (1.2.3)
Requirement already satisfied: typing-extensions>=3.10.0.0 in /usr/local/lib/python3.6/site-packages (from black->pixellib) (4.1.1)
Requirement already satisfied: mypy-extensions>=0.4.3 in /usr/local/lib/python3.6/site-packages (from black->pixellib) (0.4.3)
Requirement already satisfied: typed-ast>=1.4.2 in /usr/local/lib64/python3.6/site-packages (from black->pixellib) (1.5.4)
Requirement already satisfied: pathspec>=0.9.0 in /usr/local/lib/python3.6/site-packages (from black->pixellib) (0.9.0)
Requirement already satisfied: click>=8.0.0 in /usr/local/lib/python3.6/site-packages (from black->pixellib) (8.0.4)
Requirement already satisfied: platformdirs>=2 in /usr/local/lib/python3.6/site-packages (from black->pixellib) (2.4.0)
Requirement already satisfied: numpy in /usr/local/lib64/python3.6/site-packages (from fvcore->pixellib) (1.19.5)
Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib64/python3.6/site-packages (from fvcore->pixellib) (6.0)
Requirement already satisfied: portalocker in /usr/local/lib/python3.6/site-packages (from iopath->pixellib) (2.4.0)
Requirement already satisfied: importlib-resources in /usr/local/lib/python3.6/site-packages (from hydra-core->pixellib) (5.4.0)
Requirement already satisfied: packaging in /usr/local/lib/python3.6/site-packages (from hydra-core->pixellib) (21.3)
Requirement already satisfied: antlr4-python3-runtime==4.9.* in /usr/local/lib/python3.6/site-packages (from hydra-core->pixellib) (4.9.3)
Requirement already satisfied: lxml in /usr/local/lib64/python3.6/site-packages (from imantics->pixellib) (4.9.0)
Requirement already satisfied: xmljson in /usr/local/lib/python3.6/site-packages (from imantics->pixellib) (0.2.1)
Requirement already satisfied: Shapely in /usr/local/lib64/python3.6/site-packages (from imgaug->pixellib) (1.8.2)
Requirement already satisfied: imageio in /usr/local/lib/python3.6/site-packages (from imgaug->pixellib) (2.15.0)
Requirement already satisfied: scipy in /usr/local/lib64/python3.6/site-packages (from imgaug->pixellib) (1.5.4)
Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from imgaug->pixellib) (1.16.0)
Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.6/site-packages (from scikit-image->pixellib) (2020.9.3)
Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.6/site-packages (from scikit-image->pixellib) (2.5.1)
Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib64/python3.6/site-packages (from scikit-image->pixellib) (1.1.1)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/site-packages (from matplotlib->pixellib) (2.8.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib64/python3.6/site-packages (from matplotlib->pixellib) (1.3.1)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/site-packages (from matplotlib->pixellib) (0.11.0)
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->pixellib) (3.0.9)
Requirement already satisfied: jsonschema>=2.6.0 in /usr/local/lib/python3.6/site-packages (from labelme2coco->pixellib) (3.2.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.2 in /usr/local/lib64/python3.6/site-packages (from pyQt5->pixellib) (5.15.2)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in /usr/local/lib64/python3.6/site-packages (from pyQt5->pixellib) (12.9.1)
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.6/site-packages (from click>=8.0.0->black->pixellib) (4.8.3)
Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.6/site-packages (from jsonschema>=2.6.0->labelme2coco->pixellib) (21.4.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /usr/local/lib64/python3.6/site-packages (from jsonschema>=2.6.0->labelme2coco->pixellib) (0.18.0)
Requirement already satisfied: setuptools in /usr/lib/python3.6/site-packages (from jsonschema>=2.6.0->labelme2coco->pixellib) (39.2.0)
Requirement already satisfied: decorator<5,>=4.3 in /usr/local/lib/python3.6/site-packages (from networkx>=2.0->scikit-image->pixellib) (4.4.2)
Requirement already satisfied: zipp>=3.1.0 in /usr/local/lib/python3.6/site-packages (from importlib-resources->hydra-core->pixellib) (3.6.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Thanks..!

neicras commented 1 year ago

getting the same error importing the package after installation!

ModuleNotFoundError: No module named 'pixellib.torchbackend'; 'pixellib' is not a package