0

i have problem with setting up python script on aws lambda function for IBM MQ client. The things I did:

  1. I install IBM MQ client on Ubuntu linux server and there I installed pymqi with pip install pymqi
  2. I zipped MQ installation path (/opt/mqm) and pymqi in same zip file
  3. I uploaded this zip on AWS lambda layer
  4. then I created new lambda function and add layer and wrote in function code "import pymqi"
  5. In enviroment variables I added LD_LIBRARY_PATH = /opt/mqm/lib64

I get next error: "errorMessage": "Unable to import module 'lambda_function': No module named 'pymqe'"

4
  • Could be how you are setting LD_LIBRARY_PATH. Refer to AWS documentation on how to add to it - docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html - it needs to be set before the pymqi c libraries are built, and also for your lambda function. Commented Jan 18, 2021 at 10:23
  • Can you pleasae tell me what excatly do you mean? :) Commented Jan 19, 2021 at 7:59
  • When a pip install of the pymqi library is performed, it also creates c object code to interact with. For this compile it needs access to a c compiler, the mq c headers, and object libraries. So all have to be already on the machine, configured and locatable. So LD_LIBRARY_PATH needs to be already set. AWS like many cloud platforms limits which environment variables are inherited by spawned systems. Hence you need to read the AWS documentation on setting LD_LIBRARY_PATH Commented Jan 19, 2021 at 9:40
  • You resolved this on the pymqi issues list right? Can you post an answer? Commented Feb 7, 2021 at 23:15

1 Answer 1

0

Here is a similar question: aws lambda Unable to import module 'lambda_function': No module named 'requests'

This bug report on GitHub seems to be similar to your issue: https://github.com/dsuch/pymqi/issues/121

Sign up to request clarification or add additional context in comments.

1 Comment

weird is because on linux machine pymqi was working, on aws is not. So I did something wrong with uploading to layer. Maybe my path was wrong. In zip file are 2 folders 1 is "python" where pymqi is installed. Second folder is "opt" where ibm mq is installed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.