Skip to content

Commit 7c52523

Browse files
authored
Merge pull request #2311 from firedrakeproject/JDBetteridge/python3.10
Update for Python3.10
2 parents 0a1ed29 + bf848fd commit 7c52523

File tree

3 files changed

+22
-47
lines changed

3 files changed

+22
-47
lines changed

firedrake/paraview_reordering.py

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,11 @@
1-
import os
2-
import importlib
3-
41
from tsfc.finatinterface import create_base_element
52
import numpy as np
63
from pyop2.utils import as_tuple
74

8-
"""
9-
This requires some explanation:
10-
VTK has some .so deps that might not be present (e.g. libsm.so (X11 Sessions))
11-
However, we only need vtkCommonDataModel (previously vtkCommonKitPython),
12-
which, according to ldd, only cares about things that we should expect:
13-
libc, libdl.so, libstdc++, libm, libgcc_s,
14-
as well as "vtkCommon" libs and "vtkPython" libs.
15-
Thus, we hackily import the module that lives in vtkCommonDataModel.so
16-
However, since VTK9 this library name is now polluted with the Python version
17-
and othe system information hence we fish out the exact name by trawling
18-
through the VTK library directory.
19-
"""
20-
vtkSoLoc = importlib.util.find_spec("vtkmodules").submodule_search_locations[0]
21-
findStr = "vtkCommonDataModel"
22-
# Find the module name as this is system dependent in VTK9
23-
contents = os.listdir(vtkSoLoc)
24-
for item in contents:
25-
if (findStr in item) and ("lib" not in item):
26-
vtkSoName = "/" + item
27-
break
28-
29-
moduleName = "vtkCommonDataModel"
30-
loader = importlib.machinery.ExtensionFileLoader(moduleName,
31-
vtkSoLoc+vtkSoName)
32-
mod = loader.load_module(moduleName)
33-
34-
vtkLagrangeTetra = mod.vtkLagrangeTetra
35-
vtkLagrangeHexahedron = mod.vtkLagrangeHexahedron
36-
vtkLagrangeTriangle = mod.vtkLagrangeTriangle
37-
vtkLagrangeQuadrilateral = mod.vtkLagrangeQuadrilateral
38-
vtkLagrangeWedge = mod.vtkLagrangeWedge
5+
from vtkmodules.vtkCommonDataModel import (
6+
vtkLagrangeTriangle, vtkLagrangeTetra,
7+
vtkLagrangeQuadrilateral, vtkLagrangeHexahedron, vtkLagrangeWedge
8+
)
399

4010
paraviewUsesVTK8 = True
4111

requirements-ext.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pytest-xdist
55
ipython
66
matplotlib
77
pylint
8-
vtk==9.0.1
8+
vtk>=9.0.1
99
pkgconfig
1010
cached_property
1111
requests

scripts/firedrake-install

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ log = logging.getLogger()
121121

122122
log.info("Running %s" % " ".join(sys.argv))
123123

124-
if sys.version_info >= (3, 10):
125-
print("""\nCan not install Firedrake with Python 3.10 at the moment:
126-
Some wheels are not yet available for Python 3.10 for some required package(s).
127-
Please install with Python 3.9 (or an earlier version >= 3.6).""")
124+
if sys.version_info >= (3, 11):
125+
print("""\nCan not install Firedrake with Python 3.11 at the moment:
126+
Some wheels are not yet available for Python 3.11 for some required package(s).
127+
Please install with Python 3.10 (or an earlier version >= 3.6).""")
128128
sys.exit(1)
129129
elif sys.version_info < (3, 6):
130130
if mode == "install":
@@ -1616,20 +1616,25 @@ if mode == "install":
16161616
log.info("Pip installing %s to venv" % package)
16171617
run_pip_install(package.split())
16181618

1619-
# Temporary workaround for missing VTK wheel on Python 3.9
1620-
if sys.version_info[:2] == (3, 9):
1621-
source = "https://github.com/firedrakeproject/VTKPythonPackage/releases/download/firedrake_20210113/"
1619+
# "Temporary" workaround for missing VTK wheel on Python 3.10
1620+
if sys.version_info[:2] == (3, 10):
1621+
source = "https://github.com/firedrakeproject/VTKPythonPackage/releases/download/firedrake_20220106/"
16221622
if osname == "Darwin":
16231623
if arch == "arm64":
1624-
source += "vtk-9.0.1-cp39-cp39-macosx_11_0_arm64.whl"
1624+
source += "vtk-9.1.0.dev0-cp310-cp310-macosx_11_0_arm64.whl"
16251625
elif arch == "x86_64":
1626-
source += "vtk-9.0.1-cp39-cp39-macosx_10_14_x86_64.whl"
1626+
source += "vtk-9.1.0.dev0-cp310-cp310-macosx_10_15_x86_64.whl"
16271627
else:
1628-
log.error("unknown Darwin architecture {0}.".format(arch))
1628+
log.error("Cannot install VTK for Python 3.10: unknown Darwin architecture {0}.".format(arch))
1629+
raise InstallError("Cannot install VTK for Python 3.10: unknown Darwin architecture {0}.".format(arch))
16291630
elif osname == "Linux":
1630-
source += "vtk-9.0.1-cp39-cp39-linux_x86_64.whl"
1631-
log.info("Pip installing VTK for Python 3.9 to venv")
1631+
source += "vtk-9.1.0.dev0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
1632+
else:
1633+
log.error("Cannot install VTK for Python 3.10: unknown operating system {0}.".format(osname))
1634+
raise InstallError("Cannot install VTK for Python 3.10: unknown operating system {0}.".format(osname))
1635+
log.info("Pip installing VTK for Python 3.10 to venv")
16321636
run_pip_install([source])
1637+
if sys.version_info[:2] >= (3, 9):
16331638
# Also lazy-object-proxy
16341639
run_pip(["install", "lazy-object-proxy==1.4.*"])
16351640

0 commit comments

Comments
 (0)