Skip to content
Merged
Changes from all commits
Commits
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
19 changes: 15 additions & 4 deletions src/ansys/tools/installer/installed_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,16 @@ def launch_cmd(
always_use_pip : bool, default: False
Whether to always use pip for the command or not.
"""
path = os.environ["PATH"].split(";")
altered_path = path.copy()
for p in path:
if (
"Ansys Python Manager\_internal" in p
or "ansys_python_manager\_internal" in p
):
altered_path.remove(p)
myenv = ";".join(altered_path)

# Handle unexpected bool parameter for linux
if is_linux_os() and isinstance(extra, bool):
extra = ""
Expand All @@ -567,7 +577,8 @@ def launch_cmd(

if is_vanilla_python and not is_venv:
scripts_path = os.path.join(py_path, "Scripts")
new_path = f"{py_path};{scripts_path};%PATH%"

new_path = f"{py_path};{scripts_path};{myenv}"

if extra:
cmd = f"&& {extra}"
Expand All @@ -591,7 +602,7 @@ def launch_cmd(
run_linux_command(py_path, extra, True)
else:
subprocess.call(
f'start {min_win} cmd /K "{py_path}\\Scripts\\activate.bat && cd %userprofile% {cmd}"',
f'start {min_win} cmd /K "set PATH={myenv} && {py_path}\\Scripts\\activate.bat && cd %userprofile% {cmd}"',
shell=True,
)
elif not is_vanilla_python and is_venv:
Expand All @@ -608,7 +619,7 @@ def launch_cmd(
run_linux_command_conda(py_path, extra, True)
else:
subprocess.call(
f'start {min_win} cmd /K "{miniforge_path}\\Scripts\\activate.bat && conda activate {py_path} && cd %userprofile% {cmd}"',
f'start {min_win} cmd /K "set PATH={myenv} && {miniforge_path}\\Scripts\\activate.bat && conda activate {py_path} && cd %userprofile% {cmd}"',
shell=True,
)
else:
Expand All @@ -625,6 +636,6 @@ def launch_cmd(
run_linux_command_conda(py_path, extra, False)
else:
subprocess.call(
f'start {min_win} cmd /K "{miniforge_path}\\Scripts\\activate.bat && conda activate {py_path} && cd %userprofile% {cmd}"',
f'start {min_win} cmd /K "set PATH={myenv} && {miniforge_path}\\Scripts\\activate.bat && conda activate {py_path} && cd %userprofile% {cmd}"',
shell=True,
)