aimet
aimet copied to clipboard
ModuleNotFoundError: No module named 'libpymo'
When I tried to use aimet 1.14.0 for tensorflow, I got this error. Do you know how to solve it?
It was okay to import libpymo yesterday, but I have the same error today. I am using aimet 1.14.0 for tensorflow on colab.
I found it's because the envs are not set properly.
@luchangli03 may I ask how to solve this problem? I have the same problem.
you need modify the aimet_common/bin/envsetup.sh to set cuda env and set LD_LIBRARY_PATH and PYTHONPATH properly source /root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/bin/envsetup.sh
export LD_LIBRARY_PATH=/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/:/root/anaconda3/envs/aimet/lib/:$LD_LIBRARY_PATH
export PYTHONPATH=/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:$PYTHONPATH
@luchangli03 Thanh u! Your solution works.
I tried with ubuntu 18.04, but it still occurs this error: ModuleNotFoundError: No module named 'libpymo' In the environment variables, it includes the paths as below:
LD_LIBRARY_PATH=/usr/l00ocal/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/home/skim/pythonenv/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:/home/skim/pythonenv/lib/python3
.6/site-packages/aimet_common:/home/skim/pythonenv/lib/:
PYTHONPATH=/home/skim/pythonenv/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu
I don't know why it can't load the libpymo module even though the paths are already included in the env. What else could be wrong ?
fixed the issue by adding PYTHONPATH in the environment variables in pycharm configuration
Hi @luchangli03 @suakim @kingbackyang - Thank you for reporting this and also suggesting resolutions. We are looking at ways to automatically take care of this dependency resolution. Please track issue https://github.com/quic/aimet/issues/497 for updates.
Hello, I have tried all the solutions suggeted in this issue, but I keep getting that same error.
I have set my variables as follows:
export LD_LIBRARY_PATH=/data/anaconda/envs/resnet50_pytorch2/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:/data/anaconda/envs/resnet50_pytorch2/lib/python3.6/site-packages/aimet_common/:/data/anaconda/envs/resnet50_pytorch2/lib/:$LD_LIBRARY_PATH
export PYTHONPATH=/data/anaconda/envs/resnet50_pytorch2/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:$PYTHONPATH
I have also tried, similarly to @suakim to set the variables in Vscode, but I keep getting that error.
I checked, and the PYTHONPATH and LD_LIBRARY_PATH variables were indeed set:
Does any have any idea what else I can do? Thanks!
@luchangli03 Thanks, it works!
you need modify the aimet_common/bin/envsetup.sh to set cuda env and set LD_LIBRARY_PATH and PYTHONPATH properly source /root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/bin/envsetup.sh
export LD_LIBRARY_PATH=/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/:/root/anaconda3/envs/aimet/lib/:$LD_LIBRARY_PATH
export PYTHONPATH=/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:$PYTHONPATH
Hi have you tired version 1.16 onwards? I tried to make them run, but even after setting the env variables, it still encounter the libpymo issue
I have the same issue, I have tried everything here and I still had the same issue ModuleNotFoundError: No module named 'libpymo'
I have the same issue, I have tried everything here and I still had the same issue ModuleNotFoundError: No module named 'libpymo'
It is the so package inside the AIMET. Probably you should search for it and record its path later you add it into LD_LIBRARY_PATH loh....
I did and this is my path ['', '/content', '/env/python', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.7/dist-packages/IPython/extensions', '/root/.ipython', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu/aimet_tensor_quantizer-0.0.0-py3.6-linux-x86_64.egg/', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu/aimet_tensor_quantizer-0.0.0-py3.6-linux-x86_64.egg/']
I mean I tried everything and I always end up with same issue
I did and this is my path ['', '/content', '/env/python', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.7/dist-packages/IPython/extensions', '/root/.ipython', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu/aimet_tensor_quantizer-0.0.0-py3.6-linux-x86_64.egg/', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu/aimet_tensor_quantizer-0.0.0-py3.6-linux-x86_64.egg/']
I mean I tried everything and I always end up with same issue
But in the first place, where is your AIMET installed?
I did and this is my path ['', '/content', '/env/python', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.7/dist-packages/IPython/extensions', '/root/.ipython', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu/aimet_tensor_quantizer-0.0.0-py3.6-linux-x86_64.egg/', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu', '/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu/aimet_tensor_quantizer-0.0.0-py3.6-linux-x86_64.egg/'] I mean I tried everything and I always end up with same issue
But in the first place, where is your AIMET installed?
what do you mean where is installed I follow this for google Colab, is there any terminal instruction you want me to run and the the results, I would love to do this if you will help me to solve this issue thanks https://github.com/quic/aimet/blob/develop/packaging/google_colab/Install_AIMET_GoogleColab_torch_gpu.ipynb
Hello, everybody
Before this, I have always had this problem, until today I went to check my environment variables. As the document "https://github.com/quic/aimet/blob/develop/packaging/google_colab/google_colab_install.md" says, these environment variables are necessary and correct, so make sure that the variable path and the actual file path correspond correctly. It is best to add them to .bashrc, which can ensure that in most cases Quote these variables correctly. At present, I have solved this problem in 3.7, so I think this suggestion is worth trying, after all, it won't take too much time.
Good luck, and can solve this problem smoothly !
you need modify the aimet_common/bin/envsetup.sh to set cuda env and set LD_LIBRARY_PATH and PYTHONPATH properly source /root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/bin/envsetup.sh
export LD_LIBRARY_PATH=/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/:/root/anaconda3/envs/aimet/lib/:$LD_LIBRARY_PATH
export PYTHONPATH=/root/anaconda3/envs/aimet/lib/python3.6/site-packages/aimet_common/x86_64-linux-gnu:$PYTHONPATH
so good,Thank you
I tried every methods ahead and found no use. But after I found my souce code have a libpymo.so provided by project author and I deleted it , it works!! Because that one conflits with my env and being searched firstly.
my env is ubuntu20, python38, torch, gpu
- install aimet-torch
- delete unrelevant libpymo.so
- add path in code:
import sys
sys.path.append('/home/xxxx/anaconda3/envs/xxxx/lib/python3.8/site-packages/aimet_common')
import libpymo
Closing this issue due to inactivity. Please re-open it/ create a new issue if you need further help.
Resolving ModuleNotFoundError: No module named 'libpymo' in AIMET
As suggested in the docs , you should put your code inside this block in Colab :
%%bash
sh /usr/local/lib/python3.8/site-packages/aimet_common/bin/envsetup.sh
python -c "
<PUT YOUR CODE HERE>
"
Note: If you use local Linux environment, first open a terminal and run the following in that terminal :
source /usr/local/lib/python3.8/site-packages/aimet_common/bin/envsetup.sh
After that, you can run your scripts in the same terminal and hopefully it works!
This solution worked for me in Colab using AIMET 1.28.0. I hope it'll be helpful for you too!
Quick Explanation:
- Executing envsetup.sh ensures the environment variables (LD_LIBRARY_PATH and PYTHONPATH) are set correctly for finding the libpymo module.
Additional Considerations:
- Replace /usr/local/lib/python3.8/site-packages/aimet_common/bin/envsetup.sh with the actual path on your system if it differs.
- Ensure you have a compatible version of AIMET installed (check documentation for specific requirements).
- By following these steps, you should be able to successfully import and utilize the libpymo module within your AIMET code on Google Colab or your local Linux environment.