问题
Google Cloud AutoML has python example code for detection, but I have error when importing these modules
from google.cloud import automl_v1beta1
from google.cloud.automl_v1beta1.proto import service_pb2
It says cannot import name automl_v1beta1
. I know it's a common problem and there are many solutions on internet but nothing has worked so far. I'm using Windows 10 and run python 2.7 on Anaconda environment.
I tried these, but nothing worked :
conda install -c conda-forge google-cloud-sdk
conda install -c conda-forge google-cloud-storage
python -m pip install google-cloud
pip install google-cloud-automl
回答1:
I just solved it and it's a very simple problem. I reinstall google-cloud-automl
using below command and works.
pip.exe install google-cloud-automl
Why it didn't work last time I tried it? It's because I didn't run anaconda prompt as administrator. The reason is when installing google-cloud-automl
it will uninstall deprecated projects like future
, like this :
Found existing installation: futures 3.1.1
DEPRECATION: Uninstalling a distutils installed project (futures) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling futures-3.1.1:
Successfully uninstalled futures-3.1.1
Future will be only successfully removed if I run the command as administrator. Last time it thrown authentication error that I didn't realize, so the re-installation process stopped. Hope it will help some people in the future.
回答2:
You can install packages inside the Jupiter notebook cell, I hope it will work for you.
来源:https://stackoverflow.com/questions/55606725/how-to-install-google-cloud-automl-v1beta1-for-python-using-anaconda