question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] mlflow tutorial: error running curl command on Windows 10

See original GitHub issue

I am attempting to use the mlflow tutorial https://www.mlflow.org/docs/latest/tutorials-and-examples/tutorial.html#serving-the-model.

The curl invocation line when trying to call the served model is not working for me.

Windows 10.

Attempted on curl 7.55.1 and on 7.71.1.

Error:

curl -X POST -H "Content-Type:application/json; format=pandas-split" --data '{"columns":["alcohol", "chlorides", "citric acid", "density", "fixed acidity", "free sulfur dioxide", "pH", "residual sugar", "sulphates", "total sulfur dioxide", "volatile acidity"],"data":[[12.8, 0.029, 0.48, 0.98, 6.2, 29, 3.33, 1.2, 0.39, 75, 0.66]]}' http://127.0.0.1:1234/invocations
curl: (6) Could not resolve host: chlorides,
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: density,
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: pH,
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: sulphates,
curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched close brace/bracket in URL position 17:
volatile acidity],data:[[12.8,

Willingness to contribute

The MLflow Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the MLflow code base?

  • Yes. I can contribute a fix for this bug independently.
  • [x ] Yes. I would be willing to contribute a fix for this bug with guidance from the MLflow community.
  • No. I cannot contribute a bug fix at this time.

System information

  • Have I written custom code (as opposed to using a stock example script provided in MLflow): no
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • MLflow installed from (source or binary): binary
  • MLflow version (run mlflow --version): 1.10.0
  • Python version: 3.7.8
  • npm version, if running the dev UI:
  • Exact command to reproduce: curl -X POST -H “Content-Type:application/json; format=pandas-split” --data ‘{“columns”:[“alcohol”, “chlorides”, “citric acid”, “density”, “fixed acidity”, “free sulfur dioxide”, “pH”, “residual sugar”, “sulphates”, “total sulfur dioxide”, “volatile acidity”],“data”:[[12.8, 0.029, 0.48, 0.98, 6.2, 29, 3.33, 1.2, 0.39, 75, 0.66]]}’ http://127.0.0.1:1234/invocations

Describe the problem

I am attempting to use the mlflow tutorial https://www.mlflow.org/docs/latest/tutorials-and-examples/tutorial.html#serving-the-model.

Simply following the tutorial and it does not work.

Code to reproduce issue

the curl command above does not work

Other info / logs

curl -X POST -H "Content-Type:application/json; format=pandas-split" --data '{"columns":["alcohol", "chlorides", "citric acid", "density", "fixed acidity", "free sulfur dioxide", "pH", "residual sugar", "sulphates", "total sulfur dioxide", "volatile acidity"],"data":[[12.8, 0.029, 0.48, 0.98, 6.2, 29, 3.33, 1.2, 0.39, 75, 0.66]]}' http://127.0.0.1:1234/invocations
curl: (6) Could not resolve host: chlorides,
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: density,
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: pH,
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: sulphates,
curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched close brace/bracket in URL position 17:
volatile acidity],data:[[12.8,

What component(s), interfaces, languages, and integrations does this bug affect?

Components

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • [] area/docs: MLflow documentation pages
  • area/examples: Example code
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/projects: MLproject format, project running backends
  • area/scoring: Local serving, model deployment tools, spark UDFs
  • area/server-infra: MLflow server, JavaScript dev server
  • area/tracking: Tracking Service, tracking client APIs, autologging

Interface

  • area/uiux: Front-end, user experience, JavaScript, plotting
  • area/docker: Docker use across MLflow’s components, such as MLflow Projects and MLflow Models
  • area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • [x ] area/windows: Windows support

Language

  • language/r: R APIs and clients
  • language/java: Java APIs and clients
  • language/new: Proposals for new client languages

Integrations

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
extrospectivecommented, Aug 15, 2020

Thank you, I was able to get it working by doing the following quoting:

curl -X POST -H "Content-Type:application/json; format=pandas-split" --data "{\"columns\":[\"alcohol\", \"chlorides\", \"citric acid\", \"density\", \"fixed acidity\", \"free sulfur dioxide\", \"pH\", \"residual sugar\", \"sulphates\", \"total sulfur dioxide\", \"volatile acidity\"],\"data\":[[12.8, 0.029, 0.48, 0.98, 6.2, 29, 3.33, 1.2, 0.39, 75, 0.66]]}" http://localhost:1234/invocations

What I did, per the stackoverflow link:

  • Converted the outer single quotes into double quotes
  • Took the double quotes embedded within the double quotes and escaped them with a backslash

This worked.

I did try PowerShell and ran into this error:

Invoke-WebRequest : Cannot bind parameter 'Headers'. Cannot convert the "Content-Type:application/json;
format=pandas-split" value of type "System.String" to type "System.Collections.IDictionary".
At line:1 char:17
+ ...  -X POST -H "Content-Type:application/json; format=pandas-split" --da ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

I was not trying to get PowerShell working, but documenting in case one wants to support PowerShell or someone else is searching for solutions.

I’m all set.

I might suggest the documentation get some sort of update to make the tutorial work for all. It’s too bad it might not look pretty, and will be harder for a newbie to interpret.

0reactions
potoo0commented, Oct 10, 2020

There a easier way than escaping all those symbols in powershell: use Replace build-in string method, demo:

curl.exe http://127.0.0.1:5051/invocations `
	-X POST `
	-H "Content-Type:application/json; format=pandas-split" `
	--data '{"columns":["feature1", "feature2", "feature3"],"data":[[1.2, -2, 2.6]]}'.Replace('"', '\"')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Curl not working Windows 10 cmd - Stack Overflow
But when I open the cmd and type curl, it gives no response whatsoever and also no error is seen. What should be...
Read more >
mlflow - PyPI
Running a Sample App With the Tracking API. The programs in examples use the MLflow Tracking API. For instance, run: python examples/quickstart/mlflow_tracking.
Read more >
Experiment tracking with MLflow inside Amazon SageMaker
MLflow solves the problem of tracking experiments evolution and deploying agnostic and fully reproducible ML scoring solutions.
Read more >
PDF - BentoML
Tutorial : Intro to BentoML A simple example of using BentoML in action. ... Note that we will use docker to run the...
Read more >
Databricks - RSSing.com
For data with 6M rows, the running time is still below 10 seconds, ... Through a one-line MLflow API call or CLI commands,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found