Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Google Cloud Function: No module named pip #56

Closed
apsears opened this issue Jun 20, 2020 · 2 comments
Closed

Google Cloud Function: No module named pip #56

apsears opened this issue Jun 20, 2020 · 2 comments
Assignees
Labels
api: texttospeech Issues related to the googleapis/python-texttospeech API. type: question Request for information or clarification. Not an issue.

Comments

@apsears
Copy link

apsears commented Jun 20, 2020

When attempting to use google.cloud's texttospeech module in a Google Cloud Functions, Python 3.7 Runtime, there is an error stating:

"""
Build failed: pip_install_from_wheels had stderr output:
/opt/python3.7/bin/python3.7: No module named pip

error: pip_install_from_wheels returned code: 1; Error ID: ECB5F712
"""

This occurs when google-cloud-texttospeech has been included in the requirements.txt, particularly when uploaded from a terminal, or when derived from a google cloud source repository.

Steps to reproduce

  1. Make a new folder with any example main.py + a requirements.txt that includes google-cloud-texttospeech
  2. Upload to a gcf: gcloud functions deploy my-python-function --entry-point helloworld --runtime python37 --trigger-http --allow-unauthenticated

Code example

def helloworld():
return

This originally showed up when I was trying to use the Serverless framework. It works fine with the inline editor, but once a cloud repo is used it fails.

@product-auto-label product-auto-label bot added the api: texttospeech Issues related to the googleapis/python-texttospeech API. label Jun 20, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jun 21, 2020
@IlyaFaer
Copy link

IlyaFaer commented Jun 22, 2020

@apsears, thanks for the detailed explanation of the problem.

Do you have pip mentioned in your requirements.txt file? Usually the error with such a code shows up because of pip explicitly set as a requirement, though it should not.

(I suppose that's not the actual question, but, after all, do you have pip installed on your Python 3.7?)

@IlyaFaer IlyaFaer added type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. labels Jun 22, 2020
@apsears
Copy link
Author

apsears commented Jun 22, 2020

This is embarrassing, but I think I have located the likely culprit. I thought I had narrowed it down to google-cloud-texttospeech, but it seems to instead be other packages in the requirements.txt, as you suggest. In particular, this is the exact code that reproduces my issue instead of the above:

main.py:
from google.cloud import texttospeech
def hello(request):
return 'success'

requirements.txt:
google-cloud-texttospeech
pypandoc

But of course the texttospeech part is not necessary for the error... because the fault is with pypandoc [which I did not include in the original report -- oof]. It seems like this version of the pypandoc library may be doing something funky with pip (c.f. JessicaTegner/pypandoc#159), so is the likely explanation.

Excited now about not having to use the inline editor.

@apsears apsears closed this as completed Jun 22, 2020
@IlyaFaer IlyaFaer self-assigned this Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: texttospeech Issues related to the googleapis/python-texttospeech API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants