HttpError 403 with CONSUMER_INVALID as the reason when deploying a machine learning model to Google cloud's AI platform - google-api-client

I am following the tutorial here (https://cloud.google.com/ai-platform/training/docs/training-jobs#python_1) and using Python to deploy a machine learning model to Google cloud for training. However, I got HttpError 403: "Permission denied on resource project my_project." The reason for the error is "CONSUMER_INVALID." Specifically, the returned metadata shows that the consumer is "projects/my_project," and the service is "ml.googleapis.com".
I went to the AI platform and my project is indeed there. The API I am requesting to use is enabled for the project and the environment variable GOOGLE_APPLICATION_CREDENTIALS has been set correctly. I am wondering how to fix the problem. Thanks!

I ran into this issue when I used my literal Project Name. I had to instead use the 'ProjectID' which is listed in the 'Home' Dashboard, in the 'Project info' widget.

Related

ERROR: (gcloud.app.deploy) Error Response: [9] Flex operation projects/.../regions/us-central1/operations/... error [FAILED_PRECONDITION]

I'm pretty new on Google Cloud, and I just wanted to deploy my first streamlit webapp. I'm on Windows in command line. I already did the Google Cloud "Hello World" Example, which worked without any error.
When I deploy the streamlit webapp, I got after 3-4 minutes waiting "Updating Server" the following error:
ERROR: (gcloud.app.deploy) Error Response: [9] Flex operation projects/XXXX/regions/us-central1/operations/f0c89d22-2d09-410d-bf99-fc49ad337800 error [FAILED_PRECONDITION]: An internal error occurred while processing task /app-engine-flex/flex_await_healthy/flex_await_healthy>2021-05-27T06:13:50.278Z10796.jc.0: 2021-05-27 06:15:32.787 An update to the [server] config option section was detected. To have these changes be reflected, please restart streamlit.
That's my app.yaml file:
service: default
runtime: custom
env: flex
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
Posting my comment as an answer for better visibility and to summarize.
In this particular case, the error was caused by a mistake in the Dockerfile.
Here are some steps you can follow to fix or narrow down the error:
Try to deploy a test app to see the differences in configuration. Example.
Try deploying your app after updating the gcloud with gcloud components update command.
Make sure you run the SDK as an Admin.
If the error recurs, run the gcloud app deploy app.yaml --verbosity=debug to try getting more specified error.
It's good practice to include references in questions for folks who aren't familiar with e.g. Streamlit. I assume it's this: https://streamlit.io/
I suspect (!) that Streamlit does not (by default) satisfy App Engine's requirements:
A web app on port 8080
No additional (apt get) dependencies
No C-based dependencies
The Streamlit wiki references various deployment alternatives and includes Google Kubernetes Engine (aka GKE) (see below) but not App Engine.
This doesn't mean that it won't work on App Engine (standard) just that it may not be trivial.
The GKE instructions reference installing Cython an optimizing c-compiler and that gives me pause about using App Engine standard. Unless you're familiar with Kubernetes, I'd discourage you from trying GKE as there's more complexity.
So, it would be helpful if others with experience with Streamlit weigh in but, until then, you may wish to consider using Streamlit sharing.
It would be helpful if someone who has deployed Streamlit to App Engine (flexible?) or perhaps Cloud Run can provide an overview.

HMS Core AI Model Integration Error 403 on Template File Download when Using MindSpore Lite Inference Engine

I'm using HMS Core Plugin - Model Integration from Coding Assistant to try to integrate my pre-trained model. I use MindSpore Lite inference engine and use caffemodel.
Setup my caffemodel with MindSpore Lite Inference engine
When I try to finish my setup, it says "checkAndDownload" file not exists and trying to download. After that, I get a 403 error on template download from http://cdn.ide.deveco.huawei.com//ai/download/foundation/template-1.3.1.zip
error 403 on download
Did I miss some configuration or it is a bug from the HMS plugin itself?
A 403 error is an access forbidden error. The reason for the error can be that the directory does not exist, the index is wrong, or that they are unpermitted to access the information/download.
At this time, the download may not be accessible by you.

Error fetching custom collections: Error in Watson Visual Recognition service: Recieved invalid status 403 response

I am using IBM Watson Visual Recognition for a custom model. I have uploaded my dataset as .zip files, which is fine so far. However, I cannot test already trained model and I cannot label new images. When I go on my Watson services, it says:
Error fetching custom collections: Error in Watson Visual Recognition service: Recieved invalid status 403 in getAllCollections response for guid crn:v1:bluemix:public:watson-vision-combined:us-south:a/649b0335a5a44f6d80d1fd6909e466f9:8a71daa3-b0be-42ac-bb72-1473de835c19:: at endpoint https://gateway.watsonplatform.net/visual-recognition/api/
When I try to label new images , it says: Error in Watson Visual Recognition service: Received empty image data response
To the best of my knowledge, I have checked Google and StackOverflow for solutions, but didn't find any. I am using the Lite version. I only have one project, and one Visual Recognition instance. Please note that it worked for a different Visual Recognition model before, but later I could not use or access that model.
403 is a forbidden error, implying that you don't have authority to access the custom collections. Which is strange as its part of the V4 API available to lite accounts.
If you are doing everything inside Watson Studio, then Watson Studio is accessing the service on your behalf. Watson Studio may have expired its access token. Try flushing your browser cache, logging back into Watson Studio and trying again.
If that doesn't work, you should raise a ticket against Watson Studio.
You can verify if it is a Watson Studio problem by using cURL to list the customised collections - https://cloud.ibm.com/apidocs/visual-recognition/visual-recognition-v4#list-collections
curl -u "apikey:{apikey}" "{url}/v4/collections?version=2019-02-11"
If you still get a 403, then the problem lies with the service. If the cURL command works, then the problem lies with Watson Studio, and how you are using it.
Another thing to consider, since you mentioned you were using a lite plan, is that once you have exhausted the monthly quota of resources for this free plan, you will get 403 error codes.

Unable to install gcloud SDK

When I try to install google cloud SDK, I was getting the following error:
ERROR:
(gcloud.components.update) Failed to fetch component listing from
server. Check your network settings and try again. This will install
all the core command line tools necessary for working with the Google
Cloud Platform. Failed to install.
After reinstalling python (v3.7.0), I added the path and also added CLOUDSDK_PYTHON environment variable to make sure. Now when I attempt the installation, the installation simply hangs:
If I attempt the installation trough terminal by executing install.bat, it also gets stuck after requesting to send diagnostics to google:
Welcome to the Google Cloud SDK!
Active code page: 65001
To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. This data is
handled in accordance with our privacy policy
<https://policies.google.com/privacy>. You may choose to opt in this
collection now (by choosing 'Y' at the below prompt), or at any time in the
future by running the following command:
gcloud config set disable_usage_reporting false
Do you want to help improve the Google Cloud SDK (y/N)? n
Nothing gets printed after that.
it seems that the "(gcloud.components.update) Failed to fetch component listing from server" error might be caused by some proxies or antivirus in your environment, I'd recommend you to try a clean installation in a vm or using another network.
Also, I was able to find soem similar errors for this on issue tracker and the team gave a soltion at comment10, also, as you can see on the issue tracker, sometimes this behavior is because the Python SDK is installed on default "Program Files" location, you could give it a try by changing the location of the python SDK

How to deploy an Orchard CMS web project to a Windows Azure Cloud Service?

Basically, I want to be able to deploy a Orchard CMS web application to a windows azure cloud service. I v'e tried following the same steps as I would normally do for any other web application but it just never works.
UPDATE
I downloaded the Orchard.Source.1.5.1 from orchardproject.net website. Added my custom modules and themes. Published the web application to a local folder. That would result in a Orchard web application. I open this web application, add the Windows Azure Cloud Service project and my web application is the web role in this project. I set up DataConnectionString to my azure cloud storage with my name and key. Published to Azure.
Once the deployment is over when I go to the site url to see the result I get this the YSOD with the following exception:
Server Error in '/' Application.
None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func1[Autofac.Features.OwnedInstances.Owned1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Autofac.Core.DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func1[Autofac.Features.OwnedInstances.Owned1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.
UPDATE:
I followed the guide in the orchard project website "Deploying Orchard to Windows Azure" and didn't touch anything, just got all the source code from the repository, ran ClickToBuildAzure from the Visual Studio 2010 command line, didn't get any error messages, set up my storage in the ServiceConfiguration file and uploaded my package and ServiceConfiguration files. Deployment went ok. I got to the Orchard Get Started screen but after input all the information, including a connection string to my SQL Azure DB (got the connection string from Azure Portal and inserted my password), I got the following error:
Setup failed: An exception was thrown while invoking the constructor 'Void .ctor(Orchard.Environment.Configuration.ShellSettings, Orchard.Data.ISessionLocator, System.Collections.Generic.IEnumerable`1[Orchard.Data.Migration.Interpreters.ICommandInterpreter], Orchard.Data.ISessionFactoryHolder, Orchard.Reports.Services.IReportsCoordinator)' on type 'DefaultDataMigrationInterpreter'.
I didn't even get to the AddingaModuletotheDistribution point.
The guide provided by the Orchard Team is not the ideal solution for me.
I have developed custom modules and themes and I work in a development environment with Visual Studio and TFS and would not like to use it with WebMatrix and and deploy to Azure Web site.
I downloaded the source code from the orchard website and added an azure web role project.
By the way, I've checked this question and this blog post and still could not resolve my problem.
Everything I find regarding this is fairly outdated!
I am almost giving up. Could anybody tell me if this is possible? Or the only way to work with Orchard is WebMatrix?
You need to read the documentation more carefully, as adding modules and themes is covered here: http://docs.orchardproject.net/Documentation/Deploying-Orchard-to-Windows-Azure#AddingaModuletotheDistribution
You need to add your modules and themes to the Azure solution, not the Orchard solution the is in src. Once you've done that, the ClickToBuildAzure script will generate a package that contains your modules and themes, and that will deploy well to Azure.
You could try http://docs.orchardproject.net/Documentation/Building-and-deploying-Orchard-from-a-source-code-drop This solved the exact same exception for me just now, but I built with the intent to run on IIS rather than Azure.
Didn't investigate to figure out what the steps in the link did to satisfy the IoC container that was not satisfied by doing a regular file system publish.