ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
253 stars 42 forks source link

Pyfluent launch from linux WSL filepath problem #2570

Open tone-cukon opened 5 months ago

tone-cukon commented 5 months ago

🔍 Before submitting the issue

🐞 Description of the bug

I installed pyansys through minifiroge in separate mamba/conda virtual environment on ubuntu WSL I launched an example script from the virtual environment through ipython I specified the file path to my Ansys installation on windows in the .profile file

I get the following error:

File ~/conda/envs/pyansys/lib/python3.12/site-packages/ansys/fluent/core/launcher/launcher.py:797, in launch_fluent(failed resolving arguments) 795 except Exception as ex: 796 logger.error(f"Exception caught - {type(ex).name}: {ex}") --> 797 raise LaunchFluentError(launch_cmd) from ex 798 finally: 799 server_info_file = Path(server_info_filepath)

LaunchFluentError: Fluent Launch string: /mnt/c/Program Files/ANSYS Inc/ANSYS Student/v241/fluent/bin/fluent 3ddp -t2 -sifile=/tmp/serverinfo-o24xk9my.txt -nm -hidden

📝 Steps to reproduce

install ubuntu 22.04. (LTS) on windows ( WSL) install miniforge for linux create vritual environment using conda/mamba pip install pyansys[fluent-all] add environment variable export=AWP_ROOT232=/mnt/c/file/path/to/ANSYS to ~/.profile (mine is ---> export AWP_ROOT241="/mnt/c/Program Files/ANSYS Inc/ANSYS Student/v241")

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

ANSYS 2024 R1 student version

🐍 Which Python version are you using?

3.12

📦 Installed packages

i installed pyansys with pip install pyansys[fluent-all]
and installed ipython using mamba install ipython
(i tried running script with spyder IDE and its also not working)
when I try the same outside linux wsl (Ubuntu22.04 LTS) through miniforge on windows everything works

# packages in environment at /home/mlaznica/conda/envs/pyansys:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
annotated-types           0.6.0                    pypi_0    pypi
ansys-additive-core       0.17.2                   pypi_0    pypi
ansys-api-additive        1.4.1                    pypi_0    pypi
ansys-api-dbu             0.2.5                    pypi_0    pypi
ansys-api-dyna            0.3.6                    pypi_0    pypi
ansys-api-edb             1.0.0                    pypi_0    pypi
ansys-api-fluent          0.3.22                   pypi_0    pypi
ansys-api-geometry        0.3.8                    pypi_0    pypi
ansys-api-mapdl           0.5.1                    pypi_0    pypi
ansys-api-mechanical      0.1.1                    pypi_0    pypi
ansys-api-meshing-prime   0.1.2                    pypi_0    pypi
ansys-api-platform-instancemanagement 1.0.0                    pypi_0    pypi
ansys-api-pyensight       0.3.4                    pypi_0    pypi
ansys-api-sherlock        0.1.22                   pypi_0    pypi
ansys-api-systemcoupling  0.1.0                    pypi_0    pypi
ansys-dpf-composites      0.4.0                    pypi_0    pypi
ansys-dpf-core            0.10.1                   pypi_0    pypi
ansys-dpf-gate            0.4.1                    pypi_0    pypi
ansys-dpf-gatebin         0.4.1                    pypi_0    pypi
ansys-dpf-post            0.6.0                    pypi_0    pypi
ansys-dyna-core           0.4.12                   pypi_0    pypi
ansys-dynamicreporting-core 0.5.1                    pypi_0    pypi
ansys-edb-core            0.1.3                    pypi_0    pypi
ansys-fluent-core         0.18.2                   pypi_0    pypi
ansys-fluent-parametric   0.9.0                    pypi_0    pypi
ansys-fluent-visualization 0.8.0                    pypi_0    pypi
ansys-geometry-core       0.4.11                   pypi_0    pypi
ansys-grantami-bomanalytics 2.0.0                    pypi_0    pypi
ansys-grantami-bomanalytics-openapi 2.0.0                    pypi_0    pypi
ansys-grantami-recordlists 1.1.0                    pypi_0    pypi
ansys-grantami-serverapi-openapi 2.0.0                    pypi_0    pypi
ansys-grpc-dpf            0.8.1                    pypi_0    pypi
ansys-hps-client          0.7.1                    pypi_0    pypi
ansys-mapdl-core          0.67.0                   pypi_0    pypi
ansys-mapdl-reader        0.53.0                   pypi_0    pypi
ansys-math-core           0.1.3                    pypi_0    pypi
ansys-mechanical-core     0.10.7                   pypi_0    pypi
ansys-mechanical-env      0.1.3                    pypi_0    pypi
ansys-meshing-prime       0.5.1                    pypi_0    pypi
ansys-motorcad-core       0.4.2                    pypi_0    pypi
ansys-openapi-common      1.5.1                    pypi_0    pypi
ansys-optislang-core      0.6.1                    pypi_0    pypi
ansys-platform-instancemanagement 1.1.2                    pypi_0    pypi
ansys-pyensight-core      0.7.5                    pypi_0    pypi
ansys-pythonnet           3.1.0rc3                 pypi_0    pypi
ansys-rocky-core          0.1.0                    pypi_0    pypi
ansys-seascape            0.2.0                    pypi_0    pypi
ansys-sherlock-core       0.4.0                    pypi_0    pypi
ansys-simai-core          0.1.4                    pypi_0    pypi
ansys-systemcoupling-core 0.4.1                    pypi_0    pypi
ansys-tools-path          0.4.1                    pypi_0    pypi
ansys-turbogrid-api       0.4.0                    pypi_0    pypi
ansys-turbogrid-core      0.4.0                    pypi_0    pypi
appdirs                   1.4.4                    pypi_0    pypi
asgiref                   3.7.2                    pypi_0    pypi
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
backoff                   2.2.1                    pypi_0    pypi
bcrypt                    4.1.2                    pypi_0    pypi
beartype                  0.17.2                   pypi_0    pypi
bleach                    6.1.0                    pypi_0    pypi
bokeh                     3.3.4                    pypi_0    pypi
build                     1.1.1                    pypi_0    pypi
bzip2                     1.0.8                hd590300_5    conda-forge
ca-certificates           2024.2.2             hbcca054_0    conda-forge
cachetools                5.3.3                    pypi_0    pypi
certifi                   2024.2.2                 pypi_0    pypi
cffi                      1.16.0                   pypi_0    pypi
charset-normalizer        3.3.2                    pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
clr-loader                0.2.6                    pypi_0    pypi
contourpy                 1.2.0                    pypi_0    pypi
cryptography              42.0.5                   pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1                    pypi_0    pypi
deprecated                1.2.14                   pypi_0    pypi
dill                      0.3.8                    pypi_0    pypi
distro                    1.9.0                    pypi_0    pypi
django                    5.0.3                    pypi_0    pypi
docker                    7.0.0                    pypi_0    pypi
docutils                  0.20.1                   pypi_0    pypi
dotnetcore2               3.1.23                   pypi_0    pypi
ecdsa                     0.18.0                   pypi_0    pypi
elementpath               4.4.0                    pypi_0    pypi
exceptiongroup            1.2.0              pyhd8ed1ab_2    conda-forge
executing                 2.0.1              pyhd8ed1ab_0    conda-forge
fabric                    3.2.2                    pypi_0    pypi
filelock                  3.13.1                   pypi_0    pypi
fonttools                 4.49.0                   pypi_0    pypi
fpdf2                     2.7.8                    pypi_0    pypi
geomdl                    5.3.1                    pypi_0    pypi
google-api-core           2.17.1                   pypi_0    pypi
google-api-python-client  2.122.0                  pypi_0    pypi
google-auth               2.28.2                   pypi_0    pypi
google-auth-httplib2      0.2.0                    pypi_0    pypi
googleapis-common-protos  1.63.0                   pypi_0    pypi
grpcio                    1.62.1                   pypi_0    pypi
grpcio-health-checking    1.48.2                   pypi_0    pypi
grpcio-status             1.48.2                   pypi_0    pypi
h5py                      3.10.0                   pypi_0    pypi
httplib2                  0.22.0                   pypi_0    pypi
idna                      3.6                      pypi_0    pypi
importlib-metadata        7.0.2                    pypi_0    pypi
invoke                    2.2.0                    pypi_0    pypi
ipython                   8.22.2             pyh707e725_0    conda-forge
jaraco-classes            3.3.1                    pypi_0    pypi
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
jeepney                   0.8.0                    pypi_0    pypi
jinja2                    3.1.3                    pypi_0    pypi
keyring                   24.3.1                   pypi_0    pypi
kiwisolver                1.4.5                    pypi_0    pypi
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
libexpat                  2.6.1                h59595ed_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 13.2.0               h807b86a_5    conda-forge
libgomp                   13.2.0               h807b86a_5    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libsqlite                 3.45.2               h2797004_0    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
linkify-it-py             2.0.3                    pypi_0    pypi
lxml                      5.1.0                    pypi_0    pypi
markdown                  3.5.2                    pypi_0    pypi
markdown-it-py            3.0.0                    pypi_0    pypi
markupsafe                2.1.5                    pypi_0    pypi
marshmallow               3.21.1                   pypi_0    pypi
marshmallow-oneofschema   3.1.1                    pypi_0    pypi
matplotlib                3.8.3                    pypi_0    pypi
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mdit-py-plugins           0.4.0                    pypi_0    pypi
mdurl                     0.1.2                    pypi_0    pypi
more-itertools            10.2.0                   pypi_0    pypi
ncurses                   6.4                  h59595ed_2    conda-forge
nh3                       0.2.15                   pypi_0    pypi
numpy                     1.26.4                   pypi_0    pypi
openssl                   3.2.1                hd590300_0    conda-forge
packaging                 24.0                     pypi_0    pypi
pandas                    2.2.1                    pypi_0    pypi
panel                     1.3.8                    pypi_0    pypi
param                     2.0.2                    pypi_0    pypi
paramiko                  3.4.0                    pypi_0    pypi
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    10.2.0                   pypi_0    pypi
pint                      0.23                     pypi_0    pypi
pip                       24.0               pyhd8ed1ab_0    conda-forge
pkginfo                   1.10.0                   pypi_0    pypi
platformdirs              4.2.0                    pypi_0    pypi
plotly                    5.20.0                   pypi_0    pypi
plumbum                   1.8.2                    pypi_0    pypi
pooch                     1.8.1                    pypi_0    pypi
prompt-toolkit            3.0.42             pyha770c72_0    conda-forge
protobuf                  3.20.3                   pypi_0    pypi
psutil                    5.9.8                    pypi_0    pypi
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pyaedt                    0.7.10                   pypi_0    pypi
pyansys                   2024.1.6                 pypi_0    pypi
pyansys-tools-versioning  0.5.0                    pypi_0    pypi
pyasn1                    0.5.1                    pypi_0    pypi
pyasn1-modules            0.3.0                    pypi_0    pypi
pycparser                 2.21                     pypi_0    pypi
pydantic                  2.6.4                    pypi_0    pypi
pydantic-core             2.16.3                   pypi_0    pypi
pygments                  2.17.2             pyhd8ed1ab_0    conda-forge
pygranta                  2024.1.0                 pypi_0    pypi
pyiges                    0.3.1                    pypi_0    pypi
pynacl                    1.5.0                    pypi_0    pypi
pyparsing                 3.1.2                    pypi_0    pypi
pypng                     0.20220715.0             pypi_0    pypi
pyproject-hooks           1.0.0                    pypi_0    pypi
pyro5                     5.15                     pypi_0    pypi
pyside6                   6.6.2                    pypi_0    pypi
pyside6-addons            6.6.2                    pypi_0    pypi
pyside6-essentials        6.6.2                    pypi_0    pypi
pyspnego                  0.10.2                   pypi_0    pypi
python                    3.12.2          hab00c5b_0_cpython    conda-forge
python-dateutil           2.9.0.post0              pypi_0    pypi
python-jose               3.3.0                    pypi_0    pypi
python-keycloak           2.0.0                    pypi_0    pypi
pytwin                    0.6.0                    pypi_0    pypi
pytz                      2024.1                   pypi_0    pypi
pyvista                   0.43.4                   pypi_0    pypi
pyvistaqt                 0.11.0                   pypi_0    pypi
pyviz-comms               3.0.1                    pypi_0    pypi
pyyaml                    6.0.1                    pypi_0    pypi
qtpy                      2.4.1                    pypi_0    pypi
readline                  8.2                  h8228510_1    conda-forge
readme-renderer           43.0                     pypi_0    pypi
requests                  2.31.0                   pypi_0    pypi
requests-ntlm             1.2.0                    pypi_0    pypi
requests-toolbelt         1.0.0                    pypi_0    pypi
rfc3986                   2.0.0                    pypi_0    pypi
rich                      13.7.1                   pypi_0    pypi
rpyc                      5.3.1                    pypi_0    pypi
rsa                       4.9                      pypi_0    pypi
scipy                     1.12.0                   pypi_0    pypi
scooby                    0.9.2                    pypi_0    pypi
secretstorage             3.3.3                    pypi_0    pypi
semver                    3.0.2                    pypi_0    pypi
serpent                   1.41                     pypi_0    pypi
setuptools                69.2.0             pyhd8ed1ab_0    conda-forge
shiboken6                 6.6.2                    pypi_0    pypi
six                       1.16.0             pyh6c4a22f_0    conda-forge
sqlparse                  0.4.4                    pypi_0    pypi
sseclient-py              1.8.0                    pypi_0    pypi
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
tenacity                  8.2.3                    pypi_0    pypi
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.0.1                    pypi_0    pypi
tornado                   6.4                      pypi_0    pypi
tqdm                      4.66.2                   pypi_0    pypi
traitlets                 5.14.2             pyhd8ed1ab_0    conda-forge
twine                     5.0.0                    pypi_0    pypi
typing_extensions         4.10.0             pyha770c72_0    conda-forge
tzdata                    2024.1                   pypi_0    pypi
uc-micro-py               1.0.3                    pypi_0    pypi
uritemplate               4.1.1                    pypi_0    pypi
urllib3                   1.26.18                  pypi_0    pypi
vtk                       9.3.0                    pypi_0    pypi
wakepy                    0.7.2                    pypi_0    pypi
wcwidth                   0.2.13             pyhd8ed1ab_0    conda-forge
webencodings              0.5.1                    pypi_0    pypi
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
wrapt                     1.16.0                   pypi_0    pypi
xmlschema                 2.5.1                    pypi_0    pypi
xyzservices               2023.10.1                pypi_0    pypi
xz                        5.2.6                h166bdaf_0    conda-forge
zipp                      3.18.0                   pypi_0    pypi
mkundu1 commented 5 months ago

It seems you are trying to launch a windows program from within wsl which is not generally possible. If you have a Python environment in windows, you can install PyFluent and use it from there. Launching Fluent in windows and then connecting from PyFluent from wsl might work if the networking between windows and wsl can be established (I haven't tested this).

raph-luc commented 5 months ago

Testing this locally, I was able to launch Fluent installed on Windows through WSL, and this seems to be a configuration that we could support in PyFluent.

I've changed this bug tracker to a feature request, as I think this would be better classified as a new feature, rather than a bug fix.

Edit: Launching Fluent in the current working directory of WSL (Fluent ends up using the \\wsl.localhost network path), one issue I've noticed so far is that some startup command line argument combinations don't seem to work properly and cause Fluent to fail to launch with a cx2420.exe error, need to investigate further. Other than that, can read/write files with no issues in the Windows file system.

greschd commented 5 months ago

This appears to be the relevant WSL documentation: https://learn.microsoft.com/en-us/windows/wsl/filesystems#run-windows-tools-from-linux

germa89 commented 4 months ago

Comming here from teams...

PyMAPDL can launch and connect to MAPDL if given the executable path: https://mapdl.docs.pyansys.com/version/stable/getting_started/wsl.html#launch-mapdl-in-the-windows-host-os

This was implemented here: https://github.com/ansys/pymapdl/issues/2315

I hope it helps!