Skip to content

launch_sherlock() fails if installed Sherlock version is earlier than installed version of other Ansys products #523

@EDCarman

Description

@EDCarman

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

If you use ansys.sherlock.core.launcher.launch_sherlock() without specifying year and release_number it will fail if other Ansys products have been installed from a later release. e.g. launch_sherlock() or launch_sherlock(year=2025) will fail if the latest Sherlock version is 2025 R1, but the 2025 R2 version of another tool e.g. Ansys Twin Builder, has been installed.

ansys.sherlock.core.launcher._get_base_ansys() checks for the AWP_ROOTxxx environment variable and chooses the most recent one to decide the version to launch. When later products are installed, a newer variable is created, but there may not be an associated Sherlock installation for that version.

A workaround is to always specify the exact Sherlock version to use, but ideally the default behaviour should check for the latest Sherlock version .exe, not just Ansys version variable.

📝 Steps to reproduce

Install Sherlock release e.g. 2024 R2.
Install other Ansys product from later release (do not install this Sherlock version) e.g. Ansys Twin Builder 2025 R2

Run commands:

from ansys.sherlock.core.launcher import launch_sherlock
sherlock = launch_sherlock(year=2024)

Output is:

['C:\\Program Files\\ANSYS Inc\\v252\\sherlock\\SherlockClient.exe', '-grpcPort=9090']
ERROR - launcher - launch_sherlock - Error encountered while starting or executing Sherlock, error = %s[WinError 2] The system cannot find the file specified

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

Sherlock 2024 R2 and 2025 R1
Twin Builder 2025 R2

🐍 Which Python version are you using?

3.11

📦 Installed packages

ansys-api-sherlock==0.1.35
ansys-sherlock-core==0.8.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions