Skip to main content
Open

Python VENV

Related products:Transformers
  • March 16, 2023
  • 2 replies
  • 122 views

hkingsbury
Celebrity
Forum|alt.badge.img+65

Allow for the python caller to use Python Virtual Environments


Comms around it were had a couple of years ago, but nothing seems to have progressed - https://community.safe.com/s/question/0D54Q000080hOlhSAE/is-there-a-way-to-use-a-python-virtual-environment

2 replies

david_r
Celebrity
  • April 8, 2024

Fully agree, it would be fantastic if FME could support Python virtual environments out of the box, the way e.g. ArcGIS Pro does.


vlroyrenn
Enthusiast
Forum|alt.badge.img+14
  • Enthusiast
  • November 14, 2025

I’m becoming increasingly partial to the apprach UV is taking, where virtual environments are treated as disposable and built from cached packages, which enables things like having single-file scripts with the dependencies writted directly inside, or letting your Python interpreter be treated as essentially just another dependency to be pulled, with no single “system version” that could change from under your feet.

#!/usr/bin/env -S uv run --script
#
# /// script
# requires-python = "pypy>=3.12"
# dependencies = ["httpx>=0.23.0, <1"]
# ///

import httpx

print(httpx.get("https://example.com"))

There is a lot to be gained for a program like FME from using an approach like this. It would avoid instances of FME Form and FME Flow falling out of sync dependency-wise or updates to libraries requiring every other flow to be thoroughly tested and re-tested.

My main worry here would be including FME-specific Python libraries. Sure, you can pull fmetools or fme-packager from PyPI, but fmeobjects, fme and fmegeneral (among others) are all “private” to FME. I’ve not experimented with the feasability of handling these with current tools (the officially supported method by FME just adds a pth file to your virtual environment), but it’s the on less straightforward issue I can forsee.