Skip to main content

68 posts tagged with "Python"

Python Programming Language

View All Tags

How to Run a Python Script with uv run

· 9 min read
Jagdish Kumawat
Founder @ Dewiride

You added a package with uv, ran your script with python3, and got ModuleNotFoundError. The package is installed, just not in the Python you started. uv run runs everything inside the project's own environment, and brings that environment up to date first. This guide explains the command's syntax first, then runs a small script, a project command and a tool in a hello-world project, with real output from uv 0.13.9.

How to Add a Package to a Python Project with uv

· 9 min read
Jagdish Kumawat
Founder @ Dewiride

uv add installs a package into your project and records it, all in one step. It updates pyproject.toml, writes the exact versions to uv.lock, and installs everything into the project's own environment. This guide explains the command's syntax first, then adds a package and two development tools to a small hello-world project, with real output from uv 0.13.9.

Fixed: "TypeError: got an unexpected keyword argument 'squared'" in scikit-learn mean_squared_error

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

mean_squared_error(y_true, y_pred, squared=False) is how many tutorials calculate RMSE. In scikit-learn 1.9.1 it fails with TypeError: got an unexpected keyword argument 'squared': the argument was deprecated in scikit-learn 1.4 and has since been removed. root_mean_squared_error() does the same calculation.

Fixed: "MlflowException: API request to … failed with exception … Max retries exceeded" Connection Refused in MLflow

· 9 min read
Jagdish Kumawat
Founder @ Dewiride

An MLflow training run printed seven urllib3 retry warnings over about four minutes, then failed with MlflowException: API request to … failed with exception … Max retries exceeded … [Errno 61] Connection refused. Nothing was listening at the tracking URI. MLflow's client retries for minutes before it gives up, which makes a missing server look like a hang. Starting the server fixed it, and MLFLOW_HTTP_REQUEST_MAX_RETRIES makes the same mistake fail in seconds.

Fixed: SADeprecationWarning "The noload loader strategy is deprecated" When You Run pytest with MLflow

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

pytest passed all 12 tests of a project that logs to MLflow, then printed a warnings summary: SADeprecationWarning: The ``noload`` loader strategy is deprecated. It comes from MLflow 3.18.0's SQL tracking store meeting SQLAlchemy 2.1, and MLflow fixed it the day after 3.18.0 shipped. Until a release includes the fix, one filterwarnings line hides exactly this warning in your tests.

Fixed: "Exception ignored on threading shutdown" KeyboardInterrupt When You Stop the MLflow Server

· 9 min read
Jagdish Kumawat
Founder @ Dewiride

Pressing Ctrl+C to stop MLflow 3.18.0's tracking server printed Exception ignored on threading shutdown: and a KeyboardInterrupt traceback from Python's own threading.py. Nothing crashed: the server stopped cleanly, and the message comes from its background job runner being interrupted at exit. If you don't use MLflow's server jobs, MLFLOW_SERVER_ENABLE_JOB_EXECUTION=false makes it go away.

Fixed: "StarletteDeprecationWarning: starlette.middleware.wsgi is deprecated" When You Start the MLflow Server

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

Starting MLflow 3.18.0's tracking server printed StarletteDeprecationWarning: starlette.middleware.wsgi is deprecated four times. Nothing was wrong with my setup: the warning comes from MLflow's own code meeting Starlette 1.10.0, and the server works. One PYTHONWARNINGS filter hides this warning, and only this one, until MLflow changes its code.

Fixed: "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate" in Python on macOS

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

A Python script on my Mac couldn't open an HTTPS address: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate. curl opened the same address without a problem. Python from python.org brings its own OpenSSL, which doesn't use the Mac's certificates, and the fix is a script that comes with it: Install Certificates.