MCPcopy
hub / github.com/marimo-team/marimo / check_python_version_compatibility

Function check_python_version_compatibility

marimo/_session/_venv.py:175–199  ·  view source on GitHub ↗

Check if venv Python version matches current Python. Binary dependencies (pyzmq, msgspec) aren't cross-version compatible, so the venv must use the same Python major.minor version. Args: venv_python: Path to the venv's Python interpreter. Returns: True if versions

(venv_python: str)

Source from the content-addressed store, hash-verified

173
174
175def check_python_version_compatibility(venv_python: str) -> bool:
176 """Check if venv Python version matches current Python.
177
178 Binary dependencies (pyzmq, msgspec) aren't cross-version compatible,
179 so the venv must use the same Python major.minor version.
180
181 Args:
182 venv_python: Path to the venv's Python interpreter.
183
184 Returns:
185 True if versions match, False otherwise.
186 """
187 result = subprocess.run(
188 [
189 venv_python,
190 "-c",
191 "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')",
192 ],
193 capture_output=True,
194 text=True,
195 )
196 venv_version = result.stdout.strip()
197 current_version = f"{sys.version_info.major}.{sys.version_info.minor}"
198
199 return venv_version == current_version
200
201
202def install_marimo_into_venv(venv_python: str) -> None:

Calls 2

stripMethod · 0.80
runMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…