I am getting error in aws lambda

I did pip install pinecone-client and then ran my code it ran in local but in aws-lambda it throws me the below error.
[ERROR] AttributeError: module ‘os’ has no attribute ‘add_dll_directory’
Traceback (most recent call last):
File “/var/lang/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1006, in _find_and_load_unlocked
File “”, line 688, in _load_unlocked
File “”, line 883, in exec_module
File “”, line 241, in _call_with_frames_removed
File “/var/task/app.py”, line 6, in
import pinecone
File “/var/task/pinecone/init.py”, line 9, in
from .index import *
File “/var/task/pinecone/index.py”, line 7, in
import numpy as np
File “/var/task/numpy/init.py”, line 126, in
_delvewheel_patch_1_5_1()
File “/var/task/numpy/init.py”, line 114, in _delvewheel_patch_1_5_1
os.add_dll_directory(libs_dir)

can you please let me know how to resolve this error

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

hi @nitin. So, this isn’t a Pinecone error, it’s coming from the Python install you’re using. Specifically, the version of numpy you have installed. add_dll_directory is a Windows only method, but Lambda runs Linux. Check that you’re installing the Linux version of Python and the related dependencies.

There’s a thread on stackoverflow about the problem.

Hi Support,

I resolved the issue using Ubuntu to run my code and yes this is a install issue.

Thanks for your help.

1 Like