Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0d672dd
FEAT: Install pyaedt via uv
eblanco-ansys Jun 30, 2025
85fd5b6
chore: adding changelog file 6338.added.md [dependabot-skip]
pyansys-ci-bot Jun 30, 2025
ed3c9d8
uv fix
tusharbana-ansys Jul 1, 2025
809dc9c
FIX: Updated pyaedtversion to the latest
eblanco-ansys Jul 1, 2025
56cbc2c
FIX: Reverted pyaedt version
eblanco-ansys Jul 1, 2025
4370b63
FIX: Increased timeout for UV
eblanco-ansys Jul 1, 2025
6a1e311
FIX: Removed extra whitespace
eblanco-ansys Jul 3, 2025
8575b4c
FIX: Applied suggested fixes
eblanco-ansys Jul 7, 2025
7818c01
Merge branch 'main' into 6317-update-the-pyaedt-installer-python-file…
eblanco-ansys Jul 8, 2025
d85ff06
Merge branch 'main' into 6317-update-the-pyaedt-installer-python-file…
eblanco-ansys Sep 15, 2025
b3ffdc0
Moved uv installation to online part
eblanco-ansys Sep 15, 2025
5cdac74
Added uv to "all" dependencies
eblanco-ansys Sep 15, 2025
ebf4ede
Merge branch 'main' into 6317-update-the-pyaedt-installer-python-file…
eblanco-ansys Sep 15, 2025
217bd47
chore: adding changelog file 6338.added.md [dependabot-skip]
pyansys-ci-bot Sep 15, 2025
b29d916
Use pip instead uv
eblanco-ansys Sep 16, 2025
d0e2dfc
Improved unzip funcion to handle nested cases and do it in temp folder
eblanco-ansys Sep 16, 2025
6f3ff32
Improved wheel argument handling
eblanco-ansys Sep 16, 2025
923d183
Install wheel using uv
eblanco-ansys Sep 16, 2025
4faaf86
Merge branch 'main' into 6317-update-the-pyaedt-installer-python-file…
eblanco-ansys Sep 16, 2025
5a06f03
Formatted file
eblanco-ansys Sep 16, 2025
e18fa6a
Added default timeout argument for slow connections
eblanco-ansys Sep 16, 2025
4408407
Reverted path functionality
eblanco-ansys Sep 17, 2025
43b28cd
Fixed bug in recursive zip extraction
eblanco-ansys Sep 17, 2025
28ef6ec
Added uv docs
eblanco-ansys Sep 17, 2025
aa2912d
Fixed words
eblanco-ansys Sep 17, 2025
d01cc8e
Merge branch 'main' into 6317-update-the-pyaedt-installer-python-file…
Samuelopez-ansys Sep 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/6338.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Install pyaedt via uv
53 changes: 32 additions & 21 deletions doc/source/Resources/pyaedt_installer_from_aedt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ruff: noqa: F821
#
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
Expand Down Expand Up @@ -224,10 +224,12 @@ def install_pyaedt():
venv_dir = Path(VENV_DIR, python_version)
python_exe = venv_dir / "Scripts" / "python.exe"
pip_exe = venv_dir / "Scripts" / "pip.exe"
uv_exe = venv_dir / "Scripts" / "uv.exe"
else:
venv_dir = Path(VENV_DIR, python_version)
python_exe = venv_dir / "bin" / "python"
pip_exe = venv_dir / "bin" / "pip"
uv_exe = venv_dir / "bin" / "uv"
os.environ["ANSYSEM_ROOT{}".format(args.version)] = args.edt_root
ld_library_path_dirs_to_add = [
r"{}/commonfiles/CPython/{}/linx64/Release/python/lib".format(
Expand All @@ -245,6 +247,11 @@ def install_pyaedt():
os.environ["TCL_LIBRARY"] = r"{}/commonfiles/CPython/{}/linx64/Release/python/lib/tcl8.5".format(
args.edt_root, args.python_version.replace(".", "_")
)
# Prepare environment for subprocess
env = os.environ.copy()
env["VIRTUAL_ENV"] = str(venv_dir)
env["PATH"] = str(venv_dir / "Scripts") + os.pathsep + env.get("PATH", "")
env["UV_HTTP_TIMEOUT"] = "1000" # Increase timeout for uv

if not venv_dir.exists():
print("Creating the virtual environment in {}".format(venv_dir))
Expand All @@ -253,12 +260,15 @@ def install_pyaedt():
else:
subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True) # nosec

# Install uv in the virtual environment
print("Installing uv in the virtual environment...")
subprocess.run([str(pip_exe), "install", "uv"], check=True) # nosec

if args.wheel and Path(args.wheel).exists():
print("Installing PyAEDT using provided wheels argument")
unzipped_path = unzip_if_zip(Path(args.wheel))
command = [
str(pip_exe),
"install",
str(uv_exe), "pip", "install",
"--no-cache-dir",
"--no-index",
r"--find-links={}".format(str(unzipped_path)),
Expand All @@ -269,30 +279,31 @@ def install_pyaedt():
command.append("pyaedt[all]")
subprocess.run(command, check=True) # nosec
else:
print("Installing PyAEDT using online sources")
subprocess.run([str(python_exe), "-m", "pip", "install", "--upgrade", "pip"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "wheel"], check=True) # nosec
print("Installing PyAEDT using online sources with uv...")
subprocess.run([str(uv_exe), "pip", "install", "--upgrade", "pip"], check=True, env=env) # nosec
subprocess.run([str(uv_exe), "pip", "install", "wheel"], check=True, env=env) # nosec
if args.version <= "231":
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[all]=='0.9.0'"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "jupyterlab"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "ipython", "-U"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "ipyvtklink"], check=True) # nosec
subprocess.run([str(uv_exe), "pip", "install", "pyaedt[all]=='0.9.0'"] , check=True, env=env) # nosec
subprocess.run([str(uv_exe), "pip", "install", "jupyterlab"], check=True, env=env) # nosec
subprocess.run([str(uv_exe), "pip", "install", "ipython", "-U"], check=True, env=env) # nosec
subprocess.run([str(uv_exe), "pip", "install", "ipyvtklink"], check=True, env=env) # nosec
else:
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[all]"], check=True) # nosec
subprocess.run([str(uv_exe), "pip", "install", "pyaedt[all]"], check=True, env=env) # nosec

if args.version <= "231":
subprocess.run([str(pip_exe), "uninstall", "-y", "pywin32"], check=True) # nosec
subprocess.run([str(uv_exe), "pip", "uninstall", "-y", "pywin32"], check=True) # nosec

else:
print("Using existing virtual environment in {}".format(venv_dir))
subprocess.call([str(pip_exe), "uninstall", "-y", "pyaedt"], check=True) # nosec
# Ensure uv is installed in the venv
subprocess.run([str(pip_exe), "install", "uv"], check=True) # nosec
subprocess.call([str(uv_exe), "pip", "uninstall", "-y", "pyaedt"], check=True) # nosec

if args.wheel and Path(args.wheel).exists():
print("Installing PyAEDT using provided wheels argument")
unzipped_path = unzip_if_zip(Path(args.wheel))
command = [
str(pip_exe),
"install",
str(uv_exe), "pip", "install",
"--no-cache-dir",
"--no-index",
r"--find-links={}".format(str(unzipped_path)),
Expand All @@ -303,14 +314,14 @@ def install_pyaedt():
command.append("pyaedt[all]")
subprocess.run(command, check=True) # nosec
else:
print("Installing PyAEDT using online sources")
print("Installing PyAEDT using online sources with uv...")
if args.version <= "231":
subprocess.run([str(pip_exe), "pip=1000", "install", "pyaedt[all]=='0.9.0'"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "jupyterlab"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "ipython", "-U"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "ipyvtklink"], check=True) # nosec
subprocess.run([str(uv_exe), "pip", "install", "pyaedt[all]=='0.9.0'"] , check=True, env=env) # nosec
subprocess.run([str(uv_exe), "pip", "install", "jupyterlab"], check=True, env=env) # nosec
subprocess.run([str(uv_exe), "pip", "install", "ipython", "-U"], check=True, env=env) # nosec
subprocess.run([str(uv_exe), "pip", "install", "ipyvtklink"], check=True, env=env) # nosec
else:
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[all]"], check=True) # nosec
subprocess.run([str(uv_exe), "pip", "install", "pyaedt[all]"], check=True, env=env) # nosec
sys.exit(0)


Expand Down
Loading