Unable to use Pycharm debug mode because of DistributionNotFound Error
Environment details:
- OS: macOS
- Python version: python3.7/3.8
- lambda-proxy version: 5.2.1
Issue:
We are trying to apply lambda-proxy for our AWS Lambda Development. However there is some problem when we trying to use Pycharm/IntelliJ to local debug our Lambda function. In Running mode is everything fine. But in Debug mode we meet the strange DistributionNotFound Error. Since our Lambda Function involve some Crypto package, we have to build our function inside a container. Here is the error we meet in Debug mode:
/usr/local/bin/sam local invoke Function --template xxxxx/lambda/.aws-sam/build/template.yaml --event "/private/var/folders/wf/xxxxxxx/T/[Local] Function-event7.json" --debug-port 64332 --debugger-path "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev" --debug-args "-u /tmp/lambci_debug_files/pydevd.py --multiprocess --port 64332 --file" Invoking entry_point.lambda_handler (python3.7) Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-python3.7:rapid-1.6.2.
Mounting xxxx/lambda/.aws-sam/build/Function as /var/task:ro,delegated inside runtime container
Connected to pydev debugger (build 193.5662.61)
[ERROR] DistributionNotFound: The 'lambda_proxy' distribution was not found and is required by the application
Traceback (most recent call last):
File "/var/lang/lib/python3.7/imp.py", line 234, in load_module
return load_source(name, filename, file)
File "/var/lang/lib/python3.7/imp.py", line 171, in load_source
module = _load(spec)
File "
We have search that there is some issue regarding pkg_resources.get_distribution(..).version https://github.com/googleapis/python-api-core/issues/27