How to get Astropy on AWS Lambda working?

Hey there,

I have been trying to get astropy working on aws lambda with no luck. The methods that I have tried are:

  1. Installing astropy with pip locally on my windows machine and then uploading them into the root of my lambda (Didn’t work at all)
  2. Installing astropy with pip locally on my windows machine and then creating a layer, adding the layer to my lambda(Didn’t work at all)
  3. Creating an EC2 instance with the same OS as lambda, installing astropy with pip and then adding them directly to lambda root directory (Something working this time with error: cannot import name ‘ufunc’ from partially initialized module ‘erfa’ (most likely due to a circular import))
  4. Creating an EC2 instance with the same OS as lambda, installing astropy with pip and then adding them to a lambda layer. Same error as last step.
  5. Repeating the last 2 steps using cloud9, same error as last 2 steps as well.

I have found some git projects that used to be able to get astropy working on aws lambda however they are no longer working anymore and are very outdated.

Any help would be much appricated <3 I’m pulling my hair out haha

Wrong python version was the issue! Pip3 was picking up an older version installed.

1 Like

This is pretty cool. Can you share what you’re working on? I’m using AWS services for my dissertation topic as well.