8000 Bug located in setup_environment.py for solution template · Issue #426 · ansys/ansys-templates · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Bug located in setup_environment.py for solution template #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
kmahajan-cadfem opened this issue Jan 4, 2024 · 0 comments
Open
2 tasks done

Bug located in setup_environment.py for solution template #426

kmahajan-cadfem opened this issue Jan 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kmahajan-cadfem
Copy link

🔍 Before submitting the issue

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

🐞 Description of the bug

  • when using the setup_environment.py on windows 10, it will ask for Admin privileges
  • the process will give out the following error
Create virtual environment


New-Item : Administrator privilege required for this operation.
At line:1 char:1
+ New-Item -ItemType SymbolicLink -Path D:\temp\saf-install-test\beam-t ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + FullyQualifiedErrorId : NewItemSymbolicLinkElevationRequired,Microsoft.PowerShell.Commands.NewItemCommand
Traceback (most recent call last):
  File "D:\temp\saf-install-test\beam-test\setup_environment.py", line 1044, in <module>
    main()
  File "D:\temp\saf-install-test\beam-test\setup_environment.py", line 1012, in main
    configure_build_system(args)
  File "D:\temp\saf-install-test\beam-test\setup_environment.py", line 635, in configure_build_system
    configure_poetry(
  File "D:\temp\saf-install-test\beam-test\setup_environment.py", line 658, in configure_poetry
  File "C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\subprocess.py", line 503, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\subprocess.py", line 1440, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

The problem is that many people still using the older powershell (version 5.1) and according to this issue, it is not possible to create the Symbolic Links without Admin privileges

exact lines where problem occurs are as following

https://github.com/ansys/ansys-templates/blob/aacdb44cc7053ca92bd4e8a289b0e1b90a7e3d30/src/ansys/templates/python/solution/%7B%7Bcookiecutter.__project_name_slug%7D%7D/setup_environment.py#L602C1-L614C18

                subprocess.run(
                    [
                        "powershell",
                        "-Command",
                        "New-Item",
                        "-ItemType",
                        "SymbolicLink",
                        "-Path",
                        f"'{DEPENDENCY_MANAGER_PATHS[sys.platform]['dep_bin_venv_path']}'",
                        "-Target",
                        f"'{build_system_executable}'",
                    ]
                )

📝 Steps to reproduce

  • make sure that windows uses the Powershell 5.1
  • call setup_environment.py

💻 Which operating system are you using?

Windows

🐍 Which Python version are you using?

3.10

📦 Installed packages

-
@kmahajan-cadfem kmahajan-cadfem added the bug Something isn't working label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Milestone
No milestone
Development

No branches or pull requests

1 participant
0