aimet icon indicating copy to clipboard operation
aimet copied to clipboard

ImportError libpymo in AIMET 1.32 Pytorch 2.1.2+cu118

Open escorciav opened this issue 1 year ago • 7 comments

I'm getting the following import Error after using (binaries) wheels for AIMET & Pytorch installed via pip (binary) wheels

$ CUDA_VISIBLE_DEVICES=0 python aimet_calibrate.py --quant_config 8 16 32
Traceback (most recent call last):
  File "/work/work/aimet_calibrate.py", line 14, in <module>
    from aimet_torch.model_preparer import prepare_model
  File "/home/SERILOCAL/v.castillo/install/bin/miniconda3/envs/work_v2.0/lib/python3.10/site-packages/aimet_torch/model_preparer.py", line 139, in <module>
    from aimet_torch.utils import in_eval_mode
  File "/work/install/bin/miniconda3/envs/work_v2.0/lib/python3.10/site-packages/aimet_torch/utils.py", line 54, in <module>
    from aimet_common.defs import QuantScheme, QuantizationDataType, MAP_QUANT_SCHEME_TO_PYMO
  File "/work/install/bin/miniconda3/envs/work_v2.0/lib/python3.10/site-packages/aimet_common/defs.py", line 45, in <module>
    import aimet_common.libpymo as libpymo
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /work/install/bin/miniconda3/envs/work_v2.0/lib/python3.10/site-packages/aimet_common/libpymo.cpython-310-x86_64-linux-gnu.so)

Questions

  1. Can it be fixed with a hack/patch? For ex. removing the GLIBC check from the binaries
  2. I've a Ubuntu 20.04 box, should I test it out in other env?

Environment

>>> torch.__version__
'2.1.2+cu118'

requirements.txt

escorciav avatar Jul 11 '24 10:07 escorciav

Hi @escorciav, Could you check my last reply on this ticket ? that will probably help on fixing your issue

e-said avatar Jul 11 '24 12:07 e-said

Thanks @e-said !

For reference, my dev env is built as follows:

conda create -n work_v2.0-public-wheels python=3.10
conda activate work_v2.0-public-wheels
conda install pytorch==2.1.2 torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
pip install onnx==1.12.0 onnxruntime==1.15.1 jsonschema==4.19.0 spconv==2.3.6 bokeh onnxsim
# pip install -r prj_deps.txt
# wget aimet-wheels
pip install ./aimet_torch_gpu_pt21-1.32.0.cu118-cp310-cp310-manylinux_2_34_x86_64.whl

I also used both Pro & public [wheels for 1.32.0][https://github.com/quic/aimet/releases/tag/1.32.0]

escorciav avatar Jul 11 '24 12:07 escorciav

Adding those lines after aimet-wheels installation should fix your issue:

# Install common debian packages:
cat /usr/local/lib/python3.10/dist-packages/aimet_torch/bin/reqs_deb_common.txt | xargs apt-get --assume-yes install
cat /usr/local/lib/python3.10/dist-packages/aimet_torch/bin/reqs_deb_torch_gpu.txt | xargs apt-get --assume-yes install
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib

e-said avatar Jul 11 '24 12:07 e-said

It does not :(

cat /usr/local/lib/python3.10/dist-p
ackages/aimet_torch/bin/reqs_deb_common.txt | sudo xargs apt-get --assume-yes install
cat: /usr/local/lib/python3.10/dist-packages/aimet_torch/bin/reqs_deb_common.txt: No such file or directory
[dzdo] password for v.castillo:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apport-symptoms python3-systemd
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 325 not upgraded.

$ cat /usr/local/lib/python3.10/dist-p
ackages/aimet_torch/bin/reqs_deb_torch_gpu.txt | sudo xargs apt-get --assume-yes install
cat: /usr/local/lib/python3.10/dist-packages/aimet_torch/bin/reqs_deb_torch_gpu.txt: No such file or directory
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apport-symptoms python3-systemd
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 325 not upgraded.

or should I point to the files in the conda env?

escorciav avatar Jul 11 '24 13:07 escorciav

@e-said which version of Ubuntu are you using? Are you using Docker?

escorciav avatar Jul 11 '24 13:07 escorciav

or should I point to the files in the conda env?

Ah yes you are right, you should point to conda in your case.

Are you using Docker?

I'm using ubuntu 22.04, it's the version recommended for aimet 1.32. On my end I'm using this based image in docker: nvidia/cuda:11.8.0-devel-ubuntu22.04

e-said avatar Jul 11 '24 13:07 e-said

I will update the paths, but I think that it's a Ubuntu 22.04 linking error. Thanks!

escorciav avatar Jul 11 '24 14:07 escorciav

Hi @escorciav this is fixed in aimet 2.0 onwards. could you please give a try to latest release https://pypi.org/project/aimet-torch/ and re-open this issue if you still see same error

quic-bhushans avatar Apr 30 '25 20:04 quic-bhushans

I can't feel looking fwd to hear good news

escorciav avatar Apr 30 '25 23:04 escorciav

Yeah I can feel your pain @escorciav 😊

Some useful backgournds for you In aimet-torch 2.x onwards, we completely broke away with so files. We don't load libpymo.so; now we're python-only, pytorch-only. It works on any python, any pytorch, any OS, any CPU arch, etc etc.

To install -- all you need to do is pip install aimet-torch.

Please let me know if you encounter the same issue in aimet 2.x

quic-kyunggeu avatar Apr 30 '25 23:04 quic-kyunggeu