Home > front end >  AWS Lambda and X-Ray: (Python) How To Install
AWS Lambda and X-Ray: (Python) How To Install

Time:01-12

TL;DR How do I install AWS X-Ray sdk, because the pip install doesn't seem to get the full package

Hello Folks,

I'm working on trying out AWS X-Ray for my Python lambda. I know the library is large, but I wanted to get a POC before putting it into a layer. The issue is that when I install it, it doesn't seem to get installed.

When I run pip install -r requirements.txt I see that it installs two packages, aws_xray_sdk and aws_xray_sdk-2.9.0.dist-info. When I look into these packages I see that they are 740 kilobytes altogether (makes me think this is a stub of some sort)

When I upload my lambda and test it, I get the following error even though the directories are in my venv:

[ERROR] Runtime.ImportModuleError: Unable to import module 'users/main': No module named 'aws_xray_sdk' Traceback (most recent call last):

Any help is greatly appreciated.

CodePudding user response:

To install the X-Ray SDK for Python, you simply do pip install aws-xray-sdk and that should work. This is explained in the documentation.

If this is not working, there is something else that's wrong with your setup.

CodePudding user response:

The issue was that I was not putting my dependencies in the root of my .zip file as the docs clearly show ='(

4. Create a deployment package with the installed libraries at the root.

  •  Tags:  
  • Related