DistributionNotFound error with google-cloud-translate
See original GitHub issueBug Report
Description
- What did you do?
I run pip install -r requirements.txt
and all the imports work. I’ve done this in a isolated virtual environment running Python 3.7. Running sls deploy
is fine.
sls invoke -f stagger --log
fails because of a missing dependency.
my requirements.txt
boto3==1.10.0
fasttext==0.9.1
google-api-python-client==1.7.11
google-cloud-translate==1.7.0
spacy==2.2.1
Flask==1.1.1
joblib==0.14.0
scikit-learn==0.21.3
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz
- What happened?
{
"errorMessage": "The 'google-cloud-translate' distribution was not found and is required by the application",
"errorType": "DistributionNotFound",
"stackTrace": [
" File \"/var/lang/lib/python3.7/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n",
" File \"/var/lang/lib/python3.7/imp.py\", line 171, in load_source\n module = _load(spec)\n",
" File \"<frozen importlib._bootstrap>\", line 696, in _load\n",
" File \"<frozen importlib._bootstrap>\", line 677, in _load_unlocked\n",
" File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module\n",
" File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n",
" File \"/var/task/handler.py\", line 14, in <module>\n from translate import detect_and_translate\n",
" File \"/var/task/translate.py\", line 5, in <module>\n from google.cloud import translate\n",
" File \"/tmp/sls-py-req/google/cloud/translate.py\", line 18, in <module>\n from google.cloud.translate_v2 import __version__\n",
" File \"/tmp/sls-py-req/google/cloud/translate_v2/__init__.py\", line 20, in <module>\n __version__ = get_distribution(\"google-cloud-translate\").version\n",
" File \"/tmp/sls-py-req/pkg_resources/__init__.py\", line 481, in get_distribution\n dist = get_provider(dist)\n",
" File \"/tmp/sls-py-req/pkg_resources/__init__.py\", line 357, in get_provider\n return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]\n",
" File \"/tmp/sls-py-req/pkg_resources/__init__.py\", line 900, in require\n needed = self.resolve(parse_requirements(requirements))\n",
" File \"/tmp/sls-py-req/pkg_resources/__init__.py\", line 786, in resolve\n raise DistributionNotFound(req, requirers)\n"
]
}
- What should’ve happened?
Should call a Lambda function on AWS.
- What’s the content of your
serverless.yml
file?
service: stagger
plugins:
- serverless-python-requirements
- serverless-wsgi
- serverless-offline
custom:
wsgi:
app: app.app
packRequirements: false
pythonRequirements:
dockerizePip: non-linux
zip: true
provider:
name: aws
runtime: python3.7
timeout: 29
stage: dev
region: eu-west-1
apiKeys:
- myStaggerKey
functions:
stagger:
handler: handler.stagger
events:
- http:
path: stagger
method: post
private: true
package:
exclude:
- venv/**
- What’s the output you get when you use the
SLS_DEBUG=*
environment variable (e.g.SLS_DEBUG=* serverless deploy
)
No errors.
Similar or dependent issues:
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Pythone error: pkg_resources.DistributionNotFound
I build a google translate application and it was ...
Read more >Troubleshooting | Cloud Translation
If Google cannot determine the source language given the text (usually because the text is too short), we will return a 500. This...
Read more >PyInstaller文件无法执行脚本- DistributionNotFound
This is my 替换for the file content of hook-google.cloud.py为了建立一个使用谷歌语音的exe。 # PATCH: PROVIDED ALTERNATE PACKAGE NAME from PyInstaller.utils.hooks ...
Read more >AWS Lambda "distribution was not found and is required" ...
[ERROR] DistributionNotFound: The 'google-api-python-client' distribution was not found and is required by the application Traceback (most ...
Read more >google-cloud/translate
Cloud Translation API Client Library for Node.js. Latest version: 7.0.5, last published: 7 days ago. Start using @google-cloud/translate in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nope. Never solved it, moved to use a AWS service instead of GCP.
I solved it by disabling all kinds of cache options, such as useDownloadCache and useStaticCache.