Skip to content

AWS Glue 5.0 Not Installing Libraries from requirements.txt

2

I followed the documented steps for installing additional Python libraries in AWS Glue 5.0 using a requirements.txt file but encountered issues where Glue does not pick up the specified libraries.

Steps Followed: Created a requirements.txt file with the following content:

makefile Copy code paramiko==2.12.0 Uploaded the requirements.txt file to my S3 bucket:

vbnet Copy code s3://my-new-glue-requirements-bucket/requirements.txt Configured the Glue job parameters as follows:

Key: --python-modules-installer-option Value: -r Key: --additional-python-modules Value: s3://my-new-glue-requirements-bucket/requirements.txt Verified the S3 path and IAM permissions:

The Glue role has s3:GetObject permissions for the bucket. S3 bucket and file path are correct. Ran the Glue job, but it failed with the following error:

vbnet Copy code ModuleNotFoundError: No module named 'paramiko' Expected Behavior: The Glue job should have installed the paramiko library from the requirements.txt file.

Actual Behavior: The Glue job fails to detect or install the package, resulting in a ModuleNotFoundError.

Environment Details: AWS Glue Version: 5.0 Python Version: 3.x IAM Role: Verified with proper S3 access permissions.

  • It worked with Glue 5, then suddenly started having similar issues about 24 hours ago. It started in one region and then happened in a second. I was installing via --additional-python-modules and then with a requirements.txt. After comparing the logs of the successful prior runs, it appears that the pip install simply did not run in the failed job log outputs. I had to downgrade to Glue 4, then specify compatible versions of pandas and numpy to get my jobs working again. It is only working in one region for me with Glue 5.

  • Yes, Using the --additional-python-modules parameter, it was working in us-east-1 on Tuesday, but on Wednesday (12/18) even that stopped and broke a production release I had initiated... I had to revert back to Glue 4.0! Need this option to work so we can install the retry module... (And for some reason Glue 5.0 also needed us to add the tqdm module, where 4.0 does not.)

  • Seems to be working again today in Glue 5

  • I can confirm using the --additional-python-modules also works again in us-east-1.

asked 2 years ago1.3K views

2 Answers
0

Hello

I have also implemented by the same steps by writing paramiko==2.12.0 in requirements file. It worked fine for me and the library was also installed. If you are still facing issues, please reach out to AWS Glue support and share your job run id, we ll probably reach out to Service team if we can replicate the issue.

AWS
SUPPORT ENGINEER

answered 2 years ago

-2

It appears that you've correctly followed the documented steps for installing additional Python libraries in AWS Glue 5.0 using a requirements.txt file. However, there are a few things we can check to troubleshoot this issue:

  1. File Format: Ensure that your requirements.txt file is in the correct format. Each library should be on a new line, and there should be no extra spaces or characters. Your current format looks correct.

  2. S3 Path: Double-check that the S3 path in your --additional-python-modules parameter exactly matches the location of your requirements.txt file. Even a small typo can cause issues.

  3. File Permissions: Verify that the requirements.txt file in S3 has the correct permissions for the Glue job to access it.

  4. Job Parameters: Confirm that both job parameters (--python-modules-installer-option and --additional-python-modules) are correctly set in your Glue job configuration.

  5. Glue Version: Ensure you're using AWS Glue 5.0, as this feature is specific to this version.

  6. CloudWatch Logs: Check the full CloudWatch logs for your Glue job. Look for any error messages or warnings related to package installation or S3 access issues.

  7. Network Configuration: If your Glue job is running in a VPC, ensure it has the necessary network access to reach S3.

  8. Try Direct Installation: As a test, you could try specifying the package directly in the --additional-python-modules parameter like this: --additional-python-modules paramiko==2.12.0

If after checking these points the issue persists, you may want to try creating a new Glue job with minimal configuration to isolate the problem. If the problem continues, it could potentially be a bug or limitation in the current implementation, and you may need to contact AWS support for further assistance.

Remember, AWS Glue uses PySpark, so some Python libraries might not be compatible or may require special handling in a distributed environment. Always ensure that the libraries you're trying to install are compatible with your Glue environment.
Sources
Using Python libraries with AWS Glue - AWS Glue
Setting up to use Python with AWS Glue - AWS Glue
Introducing AWS Glue 5.0 for Apache Spark | AWS Big Data Blog
Troubleshoot AWS Glue streaming job | AWS re:Post

answered 2 years ago

  • Using the --additional-python-modules parameter, it was working on Tuesday, but on Wednesday (12/18) even that stopped and broke a production release I had initiated... I had to revert back to Glue 4.0!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.