ansys / pymechanical-env

Repository for loading environment variables when using PyMechanical embedding instances in Linux
MIT License
1 stars 0 forks source link

Error running the find-mechanical. #54

Closed CollinsJnr-001 closed 5 months ago

CollinsJnr-001 commented 5 months ago

🔍 Before submitting the issue

Description of the error

I have installed pymechanical on the HPC python env I created using

python -m pip install ansys-mechanical-env

and when I try to run it

mechanical-env python

I get this error

Traceback (most recent call last): File "/.conda/envs/mynumpy/bin/find-mechanica", line 8, in sys.exit(cli_find_mechanical()) File "/.conda/envs/mynumpy/lib/python3.8/site-packages/click/c ore.py", line 1157, in call return self.main(args, kwargs) File "/.conda/envs/mynumpy/lib/python3.8/site-packages/click/c ore.py", line 1078, in main rv = self.invoke(ctx) File "/.conda/envs/mynumpy/lib/python3.8/site-packages/click/c ore.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/.conda/envs/mynumpy/lib/python3.8/site-packages/click/c ore.py", line 783, in invoke return __callback(args, **kwargs) File "/.conda/envs/mynumpy/lib/python3.8/site-packages/ansys/m echanical/env/run.py", line 58, in cli_find_mechanical exe = atp.get_mechanical_path() # check for saved mechanical path File "/.conda/envs/mynumpy/lib/python3.8/site-packages/ansys/t ools/path/path.py", line 1064, in get_mechanical_path return _get_application_path("mechanical", allow_input, version, find) File "/.conda/envs/mynumpy/lib/python3.8/site-packages/ansys/t ools/path/path.py", line 958, in _get_application_path exe_loc = _read_executable_path_from_config_file(product) File "/.conda/envs/mynumpy/lib/python3.8/site-packages/ansys/t ools/path/path.py", line 947, in _read_executable_path_from_config_file config_data = _read_config_file() File "/.conda/envs/mynumpy/lib/python3.8/site-packages/ansys/t ools/path/path.py", line 849, in _read_config_file _migrate_config_file() File "/.conda/envs/mynumpy/lib/python3.8/site-packages/ansys/t ools/path/path.py", line 903, in _migrate_config_file class FileMigrationStrategy: File "/.conda/envs/mynumpy/lib/python3.8/site-packages/ansys/t ools/path/path.py", line 904, in FileMigrationStrategy paths: list[str] TypeError: 'type' object is not subscriptable Error running the find-mechanical.

📝 Steps to reproduce

python -m pip install ansys-mechanical-env

mechanical-env python

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

v232

🐍 Which Python version are you using?

3.8

📦 Installed packages

ansys-api-mechanical==0.1.1
ansys-api-platform-instancemanagement==1.0.0
ansys-mechanical-core==0.10.4
ansys-mechanical-env==0.1.5
ansys-platform-instancemanagement==1.1.2
ansys-pythonnet==3.1.0rc3
ansys-tools-path==0.4.1
appdirs==1.4.4
asttokens @ file:///opt/conda/conda-bld/asttokens_1646925590279/work
backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work
cffi==1.16.0
click==8.1.7
clr-loader==0.2.6
decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work
executing @ file:///opt/conda/conda-bld/executing_1646925071911/work
grpcio==1.60.1
importlib-metadata==7.0.1
ipython @ file:///croot/ipython_1691532092695/work
jedi @ file:///tmp/build/80754af9/jedi_1644315233700/work
matplotlib-inline @ file:///opt/conda/conda-bld/matplotlib-inline_1662014470464/work
mkl-fft @ file:///croot/mkl_fft_1695058164594/work
mkl-random @ file:///croot/mkl_random_1695059800811/work
mkl-service==2.4.0
numpy @ file:///work/mkl/numpy_and_numpy_base_1682953417311/work
parso @ file:///opt/conda/conda-bld/parso_1641458642106/work
pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work
pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work
platformdirs==4.2.0
prompt-toolkit @ file:///croot/prompt-toolkit_1704404351921/work
protobuf==3.20.3
ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pure-eval @ file:///opt/conda/conda-bld/pure_eval_1646925070566/work
pycparser==2.21
Pygments @ file:///croot/pygments_1684279966437/work
scipy==1.10.1
six @ file:///tmp/build/80754af9/six_1644875935023/work
stack-data @ file:///opt/conda/conda-bld/stack_data_1646927590127/work
tqdm==4.66.2
traitlets==5.14.1
typing_extensions @ file:///croot/typing_extensions_1705599297034/work
wcwidth==0.2.13
zipp==3.17.0
dipinknair commented 5 months ago

@CollinsJnr-001 . Can you try running find-mechanical from the after activating the same virtual env. if you are not seeing the mechanical version and path that means ansys-tools-path is unable to find Mechanical in default installation paths. you can use below cli commands from ansys-tools-path to save mechanical path.

save-ansys-path --name mechanical <path to .workbench> then you can run find-mechanical and check the path is saved correctly.

alternatively find-mechanical directly ask you to the Ansys Mechanical (.workbench) path eg:

save-ansys-path --name mechanical "/user/ansys_inc/v232/aisol/.workbench"
find-mechanical
232 /user/ansys_inc/v232/aisol/.workbench

Let me know if this works.

CollinsJnr-001 commented 5 months ago

@dipinknair

Thank you

save-ansys-path --name mechanical "/user/ansys_inc/v232/aisol/.workbench" find-mechanical 232 /user/ansys_inc/v232/aisol/.workbench

I found the file here.

dipinknair commented 5 months ago

@dipinknair

Thank you

save-ansys-path --name mechanical "/user/ansys_inc/v232/aisol/.workbench" find-mechanical 232 /user/ansys_inc/v232/aisol/.workbench

I found the file here.

@CollinsJnr-001 Did this work for you. Were you able to use mechanical-env python successfully ?

CollinsJnr-001 commented 5 months ago

@dipinknair Thank you save-ansys-path --name mechanical "/user/ansys_inc/v232/aisol/.workbench" find-mechanical 232 /user/ansys_inc/v232/aisol/.workbench I found the file here.

@CollinsJnr-001 Did this work for you. Were you able to use mechanical-env python successfully ?

Yes it worked just fine I can run mechanical-env python successfully

CollinsJnr-001 commented 5 months ago

Thank you for the help.