no module name, underscore import

Viewed 1088

Try to run a python app through command line like python -m myapp.start --config <myFile>.

Got exception

    from awscrt import mqtt
  File "/Myapp/lib/python3.6/site-packages/awscrt/mqtt.py", line 14, in <module>
    import _awscrt
ImportError: No module named '_awscrt'

https://github.com/awslabs/aws-crt-python/blob/master/awscrt/mqtt.py#L14

Really not a python guy, any idea or resolution? BTW, I am using python 3.5.

2 Answers

To make sure you have the module for the correct version try:

python -m pip install awscrt

This will guarantee that the pip version matches the current python version you are trying to run the app with.

I just stumbled over a similar error and blogged about it here. Basically the underscore in the module name shows that it is a module written in C or C++. The reason it is missing from your system is most likely missing system dependencies during installation. Those vary by platform. The setup.py seems to be a good place find those needed for your system. After installation of those dependencies awscrt has to be removed and installed again.

Related