Deploying MLflow Model without Conda environment

2024/10/12 2:19:51

Currently working on deploying my MLflow Model in a Docker container. The Docker container is set up with all the necessary dependencies for the model so it seems redundant for MLflow to also then create/activate a conda environment for the model. Looking at the documentation (https://www.mlflow.org/docs/latest/cli.html#mlflow-models-serve) it says you can serve the model with the --no-conda flag and that MLflow will assume you are “running within a Conda environment with the necessary dependencies”. This solution is working for us when we run in any environment with necessary dependencies, not necessarily a Conda environment. Is this correct? Or do we absolutely need to have a Conda environment active when running with the --no-conda flag?

For example, I can create a virtualenv and, with the virtualenv active, serve the model locally using mlflow models serve -m [model/path] --no-conda. The model then performs properly, but the documentation makes it sound like this shouldn’t work because it explicitly calls for a Conda environment.

Answer

You do not need to have a Conda environment installed with the --no-conda option.

As described in the comment (Thanks @Nander Speersta) --no-conda is getting deprecated in newer versions of MLFlow for --env-manager=local.

From the Quickstart guide (https://www.mlflow.org/docs/latest/quickstart.html) it notes that it is fine as long as all dependencies are installed. Doesn't matter how you installed these dependencies (pipenv, poetry or pip).

Caveat being: this way you can't define dependencies for your project in MLFlow (since that uses conda to install these dependencies)

You should be able to safely continue your current practice.

https://en.xdnf.cn/q/69707.html

Related Q&A

Insert Data to SQL Server Table using pymssql

I am trying to write the data frame into the SQL Server Table. My code:conn = pymssql.connect(host="Dev02", database="DEVDb") cur = conn.cursor() query = "INSERT INTO dbo.SCORE…

module object has no attribute discover_devices

Im trying to get Pybluez to work for me. Here is what happens when I try to discover bluetooth devises. import bluetooth nearby_devices = bluetooth.discover_devices()Traceback (most recent call last):F…

scipy sparse matrix: remove the rows whose all elements are zero

I have a sparse matrix which is transformed from sklearn tfidfVectorier. I believe that some rows are all-zero rows. I want to remove them. However, as far as I know, the existing built-in functions, e…

Time complexity for adding elements to list vs set in python

Why does adding elements to a set take longer than adding elements to a list in python? I created a loop and iterated over 1000000 elements added it to a list and a set. List is consistently taking ar…

ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

I was trying to install turicreate using pip install -U turicreate But got the error Could not install packages due to an EnvironmentError: [Errno 28] Nospace left on device.I followed all the steps on…

How to find cluster centroid with Scikit-learn [closed]

Closed. This question needs debugging details. It is not currently accepting answers.Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to repro…

How do I use the FPS argument in cv2.VideoWriter?

Ok, so I am making a video. I want to know exactly how to use the FPS argument. It is a float, so I assumed it was what interval do I want between each frame. Can you give an example? I just want to k…

Best practice for using common subexpression elimination with lambdify in SymPy

Im currently attempting to use SymPy to generate and numerically evaluate a function and its gradient. For simplicity, Ill use the following function as an example (keeping in mind that the real functi…

Determine if a text extract from spacy is a complete sentence

We are working on sentences extracted from a PDF. The problem is that it includes the title, footers, table of contents, etc. Is there a way to determine if the sentence we get when pass the document t…

Drawing labels that follow their edges in a Networkx graph

Working with Networkx, I have several edges that need to be displayed in different ways. For that I use the connectionstyle, some edges are straight lines, some others are Arc3. The problem is that eve…