confluent-kafka-python
confluent-kafka-python copied to clipboard
"module 'os' has no attribute 'add_dll_directory'"
Description
Getting the above error when importing the from confluent_kafka.admin import (AdminClient, NewTopic)
How to reproduce
- Spin up a Amazon Linux EC2 environment
- Check Python3 Version (3.7.6)
- create a directory /usr/local/source/sample
- sudo pip3 install -U confluent-kafka -t python
WARNING: Running pip install with root privileges is generally not a good idea. Try
pip3 install --user
instead. Collecting confluent-kafka Using cached confluent_kafka-2.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB) Installing collected packages: confluent-kafka Successfully installed confluent-kafka-2.0.2 - zip the python file as confluent-kafka.zip
- download the zip file to windows environment
- Create a AWS Lambda Layer using the zip file
- Attach the Lambda layer to the Lambda function (Python 3.9)
- Test the Lambda function
Checklist
Please provide the following information:
- [x] confluent-kafka-python and librdkafka version (
2.02
): - [x] Apache Kafka broker version: AWS MSK 2.8.1
- [ ] Client configuration:
{...}
- [x] Operating system: Lambda Function
- [ ] Provide client logs (with
'debug': '..'
as necessary) - [ ] Provide broker log excerpts
- [ ] Critical issue
I already reviewed the https://github.com/confluentinc/confluent-kafka-python/issues/1462 & https://github.com/confluentinc/confluent-kafka-python/issues/1528
Lambda function (Python 3.9)
Then why are you using Python 3.7 on EC2 to write the code? Also, don't use sudo to run pip, as the error says
Why do you need EC2 if you're going to submit the code to the lambda from Windows?
@pradeepjaladi is this still an issue you are facing?