Keep Your Semantic Link Libraries Up to Date in Fabric Notebooks
- Prathy Kamasani

- Jan 28
- 2 min read
It's one of those blog posts I write for my own reference, and I suspect many of you will find it useful too.
If you're working with Semantic Link and Semantic Link Labs in Microsoft Fabric, you've probably hit that moment where something doesn't work, and you realise your library version is out of date. Fabric pre-installs semantic-link, but the version bundled with your runtime isn't always the latest. And semantic-link-labs? That one you need to install yourself.
I got tired of manually checking PyPI, so I put together a quick snippet that does the heavy lifting for me.
What the code does

The script checks your currently installed version of semantic-link against the latest on PyPI and warns you if you're behind. It then installs or upgrades semantic-link-labs automatically.
A few things to note:
semantic-link is pre-installed in Fabric (Spark 3.4+), so we're not reinstalling it here. We're just checking whether you're on the latest version.
semantic-link-labs needs to be installed separately, and this script handles that for you.
The version check uses the PyPI JSON API, so it's lightweight and doesn't require any extra dependencies.
The code
import subprocess
import sys
import json
import urllib.request
from packaging.version import Version
from importlib.metadata import version, PackageNotFoundError
def get_latest_version(package_name):
"""Fetch latest version from PyPI"""
try:
url = f"https://pypi.org/pypi/{package_name}/json"
with urllib.request.urlopen(url, timeout=5) as response:
data = json.loads(response.read())
return data['info']['version']
except Exception as e:
print(f"⚠ Could not fetch latest version: {e}")
return None
# Check semantic-link version (pre-installed, don't reinstall)
try:
installed_version = version('semantic-link-sempy')
latest_version = get_latest_version('semantic-link')
print(f"Current semantic-link version: {installed_version}")
if latest_version:
print(f"Latest semantic-link version: {latest_version}")
if Version(installed_version) < Version(latest_version):
print(f"⚠ Warning: semantic-link version {installed_version} < {latest_version}")
else:
print("⚠ Could not determine latest version")
except PackageNotFoundError:
print("⚠ semantic-link not found (unexpected in Fabric)")
# Check semantic-link-labs version
try:
labs_version = version('semantic-link-labs')
print(f"Current semantic-link-labs version: {labs_version}")
except PackageNotFoundError:
labs_version = None
print("semantic-link-labs not found")
# Install/upgrade semantic-link-labs only
print("\n--- Installing/upgrading semantic-link-labs ---")
result = subprocess.run(
[sys.executable, "-m", "pip", "install", "--upgrade", "--quiet", "semantic-link-labs"],
capture_output=True,
text=True
)
if result.returncode == 0:
print("✓ semantic-link-labs installed/upgraded successfully")
else:
print(f"⚠ Installation warning: {result.stderr[:200]}")
Why bother?
Michael Kovalsky and the team are constantly shipping new features in semantic-link-labs. If you're not on the latest version, you might be missing out on new functions or bug fixes. This little snippet at the top of your notebook keeps you up to date.
I hope this saves someone a few minutes of head-scratching.
Until next time, Prathy 🙂



Comments