Skip to content

Help requested to run the pre keyword serverΒ #710

@lionel-wilhelm

Description

@lionel-wilhelm

πŸ” Before submitting the issue

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

🐞 Description of the bug

Following the instructions here https://github.com/ansys/pydyna/blob/main/src/ansys/dyna/core/pre/README.md, I can't manage to start the kwserver.

I'm running Jupyterlab in a Docker image (on the cloud) and I have a module creating geometries in python. I would like to automate the creation of lsdyna input files so that they can then be transferred to an other machine with a proper lsdyna installation and solver.

As far as I understand, my Jupyter instance doesn't need to access any ansys license server to create my input k-file. Is this correct ?

As I'm already running in a docker container, I don't want to run the server in a separate docker instance.

It seems that there is something wrong with the keywordreader python package as I get the following error message when I try to start the keyword server (python kwserver.py) :

Traceback (most recent call last):
  File "/home/container_user/workspace/pydyna/pydyna-venv/share/linux-binaries/kwserver.py", line 25, in <module>
    from keywordreader import KeywordReader as kp
SystemError: initialization of keywordreader raised unreported exception

I tried few things to figure out what was wrong but none of them was successful.

Running Ubuntu 22.04.5 LTS and Python 3.11.11.

Any help would be greatly appreciated. Thanks in advance

πŸ“ Steps to reproduce

# Step 1: Create and activate a Python virtual environment
python -m venv pydyna-venv
source ./pydyna-venv/bin/activate

# Step 2: Clone the pydyna repository from GitHub
git clone https://github.com/pyansys/pydyna.git
cd pydyna

# Step 3: Install the dependencies from the setup.py
pip install .  # Mostly to install dependencies

# Step 4: Change to the docker/pre directory
cd docker/pre

# Step 5: Download the linux-binaries.zip from the release
wget https://github.com/ansys/pydyna/releases/download/v0.4.6/linux-binaries.zip

# Step 6: Unzip the downloaded file and remove the zip file
unzip -uq linux-binaries.zip && rm linux-binaries.zip

# Step 7: Install necessary Python packages for gRPC and protobuf
pip install grpcio grpcio-tools protobuf

# Step 8: Generate Python code from the kwprocess.proto file using gRPC tools
python -m grpc_tools.protoc --python_out=./linux-binaries --grpc_python_out=./linux-binaries -I./linux-binaries ./linux-binaries/kwprocess.proto

# Step 9: Create required directories and move files to the correct location
mkdir --parents linux-binaries/lib/linux; mv linux-binaries/keywordreader.so $_

# Step 10: Make sure that the library is available in the python path
cp linux-binaries/lib/linux/keywordreader.so ../../../pydyna-venv/lib/python3.11/site-packages/

# Step 11: Run the kwserver.py script to start the server
python linux-binaries/kwserver.py

πŸ’» Which operating system are you using?

Linux

πŸ“€ Which ANSYS version are you using?

No response

🐍 Which Python version are you using?

3.11

πŸ“¦ Installed packages

ansys-api-dyna==0.4.2
ansys-dpf-core==0.13.4
ansys-dyna-core @ file:///home/container_user/workspace/pydyna
ansys-tools-path==0.7.1
appdirs==1.4.4
cachetools==5.5.1
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
contourpy==1.3.1
cycler==0.12.1
fonttools==4.56.0
google-api-core==2.24.1
google-api-python-client==2.160.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
googleapis-common-protos==1.66.0
grpcio==1.70.0
grpcio-tools==1.70.0
hollerith==0.6.0
httplib2==0.22.0
idna==3.10
importlib_metadata==8.6.1
kiwisolver==1.4.8
matplotlib==3.10.0
numpy==2.2.2
packaging==24.2
pandas==2.2.3
pillow==11.1.0
platformdirs==4.3.6
pooch==1.8.2
proto-plus==1.26.0
protobuf==5.29.3
psutil==6.1.1
pyasn1==0.6.1
pyasn1_modules==0.4.1
pyparsing==3.2.1
python-dateutil==2.9.0.post0
pytz==2025.1
pyvista==0.44.2
requests==2.32.3
rsa==4.9
scooby==0.10.0
six==1.17.0
tqdm==4.67.1
typing_extensions==4.12.2
tzdata==2025.1
uritemplate==4.1.1
urllib3==2.3.0
vtk==9.3.1
zipp==3.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    KeywordsAnything related to keyword subpackagebugDefects or glitches reported by users or developers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions