ImportError: cannot import name 'types' from 'google.cloud.vision' though I have google cloud vision installed
Oct 1
I have installed google-cloud-vision library following the documentation. It is for some reason unable to import types from google.cloud.vision. It worked fine on my pc, now when I shared with my client, he had a problem with imports though he has the library installed via pip. Here's the line that throws error:
from google.cloud import vision
from google.cloud.vision import types # this line throws error
Any idea how to resolve this issue?
1 answer
Accepted answer · original discussion
Oct 1
It's probably because there's some version mismatch (or less likely there's other library(s) with the same name). Have your client use a virtual environment. This should resolve the issue.
P.S. You'll have to provide him with a requirements.txt file (obtained from pip3 freeze) so that he can do a pip3 install -r requirements.txt on his virtual environment to have the exact same packages as yours.
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.