ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
422 stars 119 forks source link

FileNotFoundError: [WinError 2] The system cannot find the file specified #3291

Open kunal-3196 opened 1 month ago

kunal-3196 commented 1 month ago

🤓 Before submitting the issue

🔍 Description of the bug

[WinError 2] The system cannot find the file specified

Facing above error while launching mapdl

🕵️ Steps To Reproduce

import matplotlib.pyplot as plt
import numpy as np

from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl(loglevel="ERROR")

mapdl.clear()
mapdl.prep7()

# Material properties-- 1020 steel in imperial
mapdl.units("BIN")  # U.S. Customary system using inches (in, lbf*s2/in, s, °F).
mapdl.mp("EX", 1, 30023280.0)
mapdl.mp("NUXY", 1, 0.290000000)
mapdl.mp("ALPX", 1, 8.388888889e-06)
mapdl.mp("DENS", 1, 7.346344000e-04)
mapdl.mp("KXX", 1, 6.252196000e-04)
mapdl.mp("C", 1, 38.6334760)

# use a thermal element type
mapdl.et(1, "SOLID70")

Above code throwing the error

💻 Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.11

💾 Which MAPDL version are you using?

2024R1

📝 PyMAPDL Report

ansys-mapdl-core-0.68.4

📝 Installed packages

Show the installed packages! ```text # PASTE HERE THE OUTPUT OF `python -m pip freeze` here ```

📝 Logger output file

runfile('C:/MISC/Python_code/untitled0.py', wdir='C:/MISC/Python_code') Traceback (most recent call last):

File C:\ProgramData\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals)

File c:\misc\python_code\untitled0.py:27 mapdl = launch_mapdl(loglevel="ERROR")

File ~\AppData\Roaming\Python\Python311\site-packages\ansys\mapdl\core\launcher.py:1833 in launch_mapdl raise exception

File ~\AppData\Roaming\Python\Python311\site-packages\ansys\mapdl\core\launcher.py:1795 in launch_mapdl port, actual_run_location, process = launch_grpc(

File ~\AppData\Roaming\Python\Python311\site-packages\ansys\mapdl\core\launcher.py:605 in launch_grpc process = subprocess.Popen(

File C:\ProgramData\anaconda3\Lib\site-packages\spyder_kernels\customize\spydercustomize.py:109 in init super(SubprocessPopen, self).init(*args, **kwargs)

File C:\ProgramData\anaconda3\Lib\subprocess.py:1026 in init self._execute_child(args, executable, preexec_fn, close_fds,

File C:\ProgramData\anaconda3\Lib\subprocess.py:1538 in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

FileNotFoundError: [WinError 2] The system cannot find the file specified

kunal-3196 commented 1 month ago

dpf is working but mapdl doesn't

germa89 commented 1 month ago

Hi @kunal-3196

Can you post here the output of python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())" ?

kunal-3196 commented 1 month ago

Hi @germa89 thanks for replying, please check below output:

C:\Users\LENOVO\AppData\Roaming\Python\Python311\site-packages\pyvista\utilities\__init__.py:72: PyVistaDeprecationWarning: The `pyvista.utilities` module has been deprecated. `GPUInfo` is now imported as: `from pyvista.report import GPUInfo`.
  warnings.warn(
-------------------------------------------------------------------------------

PyMAPDL Software and Environment Report

Packages Requirements
*********************

Core packages
-------------
ansys.mapdl.core    : 0.68.4
numpy               : 1.26.4
platformdirs        : 4.2.2
scipy               : 1.14.0
grpc                : Package not found
ansys.api.mapdl.v0  : Package not found
ansys.mapdl.reader  : 0.53.0
google.protobuf     : Package not found

Optional packages
-----------------
matplotlib          : 3.9.1
pyvista             : 0.44.0
pyiges              : 0.3.1
tqdm                : 4.66.4

Ansys Installation
******************
Version   Location
------------------
241       C:\Program Files\ANSYS Inc\ANSYS Student\v241

Ansys Environment Variables
***************************
ANSYS241_DIR                   C:\Program Files\ANSYS Inc\ANSYS Student\v241\ANSYS
AWP_LOCALE241                  en-us
AWP_ROOT241                    C:\Program Files\ANSYS Inc\ANSYS Student\v241
CADOE_LIBDIR241                C:\Program Files\ANSYS Inc\ANSYS Student\v241\CommonFiles\Language\en-us
germa89 commented 1 month ago

Can you launch it? https://mapdl.docs.pyansys.com/version/stable/user_guide/troubleshoot.html#testing-mapdl-launching

Troubleshooting PyMAPDL — PyMAPDL
kunal-3196 commented 1 month ago

@germa89 Launched, below is the output: DEBUG - pymapdl_global - launcher - get_start_instance - PYMAPDL_START_INSTANCE is unset. Using default value None. DEBUG - pymapdl_global - launcher - get_start_instance - 'PYMAPDL_START_INSTANCE' is unset, and there is no supplied value. Using default, which is 'True'. DEBUG - pymapdl_global - launcher - launch_mapdl - Using 'start_instance' equal to True. DEBUG - pymapdl_global - launcher - launch_mapdl - No IP address was supplied. Using the default IP address: 127.0.0.1 DEBUG - pymapdl_global - launcher - launch_mapdl - Using default port 50052 DEBUG - pymapdl_global - launcher - launch_mapdl - Using default executable. DEBUG - pymapdl_global - launcher - launch_mapdl - Using default run location. DEBUG - pymapdl_global - launcher - launch_mapdl - Created run location at C:\Users\LENOVO\AppData\Local\Temp\ansys_yzpepcughi DEBUG - pymapdl_global - launcher - launch_mapdl - Using run location at C:\Users\LENOVO\AppData\Local\Temp\ansys_yzpepcughi DEBUG - pymapdl_global - launcher - check_lock_file - Checking for lock file DEBUG - pymapdl_global - launcher - launch_mapdl - Using mode grpc DEBUG - pymapdl_global - launcher - _force_smp_student_version - Student version detected, using '-smp' switch by default. DEBUG - pymapdl_global - launcher - launch_mapdl - Using additional switches -smp. DEBUG - pymapdl_global - launcher - launch_mapdl - Using start parameters {'exec_file': 'C:\Program Files\ANSYS Inc\ANSYS Student\v222\ansys\bin\winx64\ansys222.exe', 'run_location': 'C:\Users\LENOVO\AppData\Local\Temp\ansys_yzpepcughi', 'additional_switches': ' -smp', 'jobname': 'file', 'nproc': 2, 'print_com': False, 'ram': None, 'override': False, 'timeout': 45} DEBUG - pymapdl_global - launcher - launch_mapdl - Checking license server. DEBUG - pymapdl_global - launcher - launch_mapdl - Starting MAPDL DEBUG - pymapdl_global - launcher - launch_grpc - Starting 'launch_mapdl'. DEBUG - pymapdl_global - launcher - check_lock_file - Checking for lock file DEBUG - pymapdl_global - launcher - launch_grpc - Writing temporary input file: .tmp.inp with 'FINISH' command. DEBUG - pymapdl_global - launcher - launch_grpc - Starting MAPDL with command: "C:\Program Files\ANSYS Inc\ANSYS Student\v222\ansys\bin\winx64\ansys222.exe" -j file -np 2 -b -i .tmp.inp -o .tmp.out -smp -port 50052 -grpc INFO - pymapdl_global - launcher - launch_grpc - Running a local instance at port 50052 the following command: '"C:\Program Files\ANSYS Inc\ANSYS Student\v222\ansys\bin\winx64\ansys222.exe" -j file -np 2 -b -i .tmp.inp -o .tmp.out -smp -port 50052 -grpc' DEBUG - pymapdl_global - launcher - launch_grpc - MAPDL starting in background. DEBUG - pymapdl_global - launcher - launch_mapdl - Checking license server. Traceback (most recent call last):

File C:\ProgramData\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals)

File c:\misc\iu_downloads\thesis\untitled0.py:8 mapdl = launch_mapdl(loglevel="DEBUG")

File ~\AppData\Roaming\Python\Python311\site-packages\ansys\mapdl\core\launcher.py:1833 in launch_mapdl raise exception

File ~\AppData\Roaming\Python\Python311\site-packages\ansys\mapdl\core\launcher.py:1795 in launch_mapdl port, actual_run_location, process = launch_grpc(

File ~\AppData\Roaming\Python\Python311\site-packages\ansys\mapdl\core\launcher.py:605 in launch_grpc process = subprocess.Popen(

File C:\ProgramData\anaconda3\Lib\site-packages\spyder_kernels\customize\spydercustomize.py:109 in init super(SubprocessPopen, self).init(*args, **kwargs)

File C:\ProgramData\anaconda3\Lib\subprocess.py:1026 in init self._execute_child(args, executable, preexec_fn, close_fds,

File C:\ProgramData\anaconda3\Lib\subprocess.py:1538 in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

FileNotFoundError: [WinError 2] The system cannot find the file specified

germa89 commented 1 week ago

You are running MAPDL v222:

DEBUG - pymapdl_global - launcher - launch_mapdl - Using start parameters {'exec_file': 'C:\Program Files\ANSYS Inc\ANSYS Student\v222\ansys\bin\winx64\ansys222.exe', 'run_location': 'C:\Users\LENOVO\AppData\Local\Temp\ansys_yzpepcughi', 'additional_switches': ' -smp', 'jobname': 'file', 'nproc': 2, 'print_com': False, 'ram': None, 'override': False, 'timeout': 45}

However, you do not have that version installed, from the report, you have:

Ansys Installation
******************
Version   Location
------------------
241       C:\Program Files\ANSYS Inc\ANSYS Student\v241

Make sure you using the right executable, or just do not specify the exec path. PyMAPDL should detect it.

germa89 commented 1 week ago

Also... I believe you installed v222 and then update to v241 and uninstalled v222.

So I guess your CONFIG_FILE is outdate. Check this link to fix it by using save_ansys_path:

https://mapdl.docs.pyansys.com/version/stable/user_guide/troubleshoot.html#default-location-of-the-executable-file

Troubleshooting PyMAPDL — PyMAPDL