Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
LS Dyna

LS Dyna

Topics related to LS-DYNA, Autodyn, Explicit STR and more.

License Error running LS-Dyna with a python script on Linux

    • Christoph Hollweck
      Subscriber

      Hello,

      when I try to start a simulation within a python script, I get an error termination caused by a license problem.

      However, I have no problems starting a simulation in the linux terminal with the comand:

      ~/LSDYNA/Solver/ls-dyna_smp_s_R13_1_0_centos79_intel190/ls-dyna_smp_s_R13_1_0_x64_centos79_ifort190 i=/home/christoph/LSDYNA/LS_Dyna_k_Files/002_sphere_impact_FE/kugel.k ncpu=10 memory=20m

      For simplicity, I created a bash file called "Start_sim" to execute this command. So I can start the simulation by only calling the bash file in the terminal with:

      bash /home/christoph/LSDYNA/Docs/Start_sim

      Now, I am trying to start the Simulation within a Python script. The script is also calling the bash file with:

      import subprocess

      command = ["bash", "/home/christoph/LSDYNA/Docs/Start_sim.sh"]
      subprocess.run(command)

       

      So this script should do exactly the same as calling the bash file by hand. However, I get the following error:

      *** License problem ***
       Local license:

       *** Error Environment variable LSTC_FILE not set!

       
       *** Error 70022 (OTH+22)

      Briefly said, If I call the bash file in the terminal by hand everything works fine, but when I use the python script, a license problem occurs.

      I have set the environment variables LSTC_LICENSE_SERVER and LSTC_LICENSE. I tried to create a file called LSTC_FILE containing 

      #LICENSE_TYPE: network
      #LICENSE_SERVER: corresponding license server

      and saved it in usr/local/lstc. But the error still occured. I also created an environment variable called LSTC_FILE containing the path to the file "LSTC_FILE". Still didn't work.

      I would be very happy, if anyone could help me or maybe had a similar problem.

      Thanks :)

      Christoph

       

       

    • Christoph Hollweck
      Subscriber

      I could find a solution by myself. When you work in a virtual environment (venv), it seems that the environment variables LSTC_LICENSE and LSTC_LICENSE_SERVER are not available in the venv, even though the variables should be defined globally. However, after defining them in the run/debug configurations, the script runs perfectly.

    • Aniket Chavan
      Forum Moderator

      Thanks for being proactive and sharing the solution, this will help the others having similar issue!

      -Aniket

      How to access Ansys help links

      Guidelines for Posting on Ansys Learning Forum

Viewing 2 reply threads
  • The topic ‘License Error running LS-Dyna with a python script on Linux’ is closed to new replies.
[bingo_chatbox]