Error when running muscle-driven simulations

New project for OpenCap, which is a new software package to estimate 3D human movement dynamics from smartphone videos. OpenCap strongly relies on OpenSim.
POST REPLY
User avatar
Zhenyuan Zhang
Posts: 5
Joined: Sun Dec 13, 2020 6:05 pm

Error when running muscle-driven simulations

Post by Zhenyuan Zhang » Mon Dec 12, 2022 9:24 am

Hi,

When I was trying to run the "createAuthenticationEnvFile.py" and the "example_kinetics.py" using Spyder within the correct directory, I got some errors saying "ModuleNotFound" (please see attached screenshot from my Spyder console).

I have done all the steps for general install requirements shown on GitHub. So, I suspect the cause of these errors is that I didn't configure CMake on my MacBook properly, as I simply just downloaded and installed it without any other operations...

If my guess is right, could you please instruct me further about how to configure CMake and fix those errors?

Thanks in advance,
Zhenyuan
Attachments
Screen Shot 2022-12-12 at 16.02.03.png
Screen Shot 2022-12-12 at 16.02.03.png (319.59 KiB) Viewed 1120 times

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: Error when running muscle-driven simulations

Post by Antoine Falisse » Mon Dec 12, 2022 10:09 am

Hey, it is not a CMake problem. My guess is that you are not working in the conda environment where you installed the different packages (eg, you might be in the base environment whereas your installed the packages, such as decouple, in the opencap-processing environment). We actually faced something similar with another mac user, and I believe it is a mac thing.

To confirm this, run createAuthenticationEnvFile.py from the terminal.
1. Launch an anaconda prompt
2. Activate your environment (eg, conda activate opencap-processing)
3. Run the script: python createAuthenticationEnvFile.py

If that works, that confirms that it is a Spyder issue. Let us know and we can move forward.

Btw, if the terminal approach worked, you can also run example_kinetics.py from there.

User avatar
Zhenyuan Zhang
Posts: 5
Joined: Sun Dec 13, 2020 6:05 pm

Re: Error when running muscle-driven simulations

Post by Zhenyuan Zhang » Mon Dec 12, 2022 10:30 am

Hi Antoine,

Thanks for your quick reply. I have done what you instructed.

However, it seemed doesn't work (see attached screenshot for the command I entered in terminal). And the same error just showed up again... So it might be a mac issue?

Thanks for all your and your team's effort and I look forward to what's coming up next.

Zhenyuan
Attachments
Screen Shot 2022-12-12 at 17.23.04.png
Screen Shot 2022-12-12 at 17.23.04.png (225.13 KiB) Viewed 1098 times

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: Error when running muscle-driven simulations

Post by Antoine Falisse » Mon Dec 12, 2022 10:45 am

Did you follow all the steps here: https://github.com/stanfordnmbl/opencap ... ng#general
It seems like you have not installed python-decouple, which should get installed when running step 8.

If you type `conda list` in your anaconda prompt, you should see all the modules that have been installed. Check if there is python-decouple. If not re-run python -m pip install -r requirements.txt. Make sure first:
1. That you navigated to the opencap-processing repo
2. That you activated your environment

User avatar
Zhenyuan Zhang
Posts: 5
Joined: Sun Dec 13, 2020 6:05 pm

Re: Error when running muscle-driven simulations

Post by Zhenyuan Zhang » Mon Dec 12, 2022 11:46 am

I have tried to re-install the required packages (i.e. step 8), and this time it worked. Now I have successfully authenticated my device via the terminal. I just had a quick reflection on why this error happened and it might be that I executed step 8 without activating my environment on my first try.

However, there are still some issues existing when I run the example_kinetics.py through the Terminal (see attached screenshot). And I think it is the same ones which were mentioned by Cameron Stephen in this forum (viewtopicPhpbb.php?f=2385&t=15114&p=0&s ... 558a73d49d). It says FileNotFound for foo.py...

Anyway, thanks for your help and your patience. They are much appreciated!
Attachments
Screen Shot 2022-12-12 at 18.45.33.png
Screen Shot 2022-12-12 at 18.45.33.png (421.71 KiB) Viewed 1078 times

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: Error when running muscle-driven simulations

Post by Antoine Falisse » Mon Dec 12, 2022 12:43 pm

Could you check on line 1606 of utilsOpenSimAD if you have {} of "{}". I fixed a bug, but that is a little while ago already so I'm not sure if it is related.
The good version should look like this: https://github.com/stanfordnmbl/opencap ... D.py#L1606

User avatar
Zhenyuan Zhang
Posts: 5
Joined: Sun Dec 13, 2020 6:05 pm

Re: Error when running muscle-driven simulations

Post by Zhenyuan Zhang » Mon Dec 12, 2022 4:38 pm

Hi Antoine,

I just checked line 1606 of the utilsOpenSimAD file in my local repository. And the code is: cmd_tar = 'tar -xf macOS.tgz -C "{}"'.format(OpenSimAD_DIR), which is in accordance with that in the good version.

Now I can run example.py successfully to compute the kinematics without any error. But when it comes to example_kinetics.py, the same errors still exist.

Thanks for your effort,
Zhenyuan

User avatar
Zhenyuan Zhang
Posts: 5
Joined: Sun Dec 13, 2020 6:05 pm

Re: Error when running muscle-driven simulations

Post by Zhenyuan Zhang » Tue Dec 13, 2022 7:09 am

Hi Antoine,

Just a quick update for you. I had the access to a Windows PC earlier today and I configured its environment quickly. This time the configuration process went quite well without any error.

However, after the configuration, I tried to run the example kinetics.py using Anaconda Prompt (within the opencap-processing environment and correct directory). Then same error occurred again saying as below:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\spszzhan\\Downloads\\opencap-processing\\UtilsDynamicSimulations\\OpenSimAD\\opensimAD-install\\windows\\bin\\foo.py'

Then I checked the corresponding local folder and it seemed like the utilsOpenSimAD script didn't really generate foo.py even for a Windows OS.

Hope it's helpful for your debugging and I really look forward to your future work.

Many thanks,
Zhenyuan

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: Error when running muscle-driven simulations

Post by Antoine Falisse » Tue Dec 13, 2022 12:59 pm

It is actually a CMake issue. It seems that CMake is not in your path.

macOS
Please follow the instructions here: https://cmake.org/install/ under macOS - "How to Install For Command Line Use"

Launch CMake and click on Tools. From there you can click on How to Install For Command Line Use, and you will have three options (see screenshot attached). The first should work fine. Copy the line PATH="/Applications/... in the terminal and hit enter. CMake should now be in your path and the code should run without issues.

Windows
On Windows, you should get a chance to add CMake to the path during the installation process. If you are still experiencing issues, verify that CMake is effectively in your path. You should see something similar to the attached screenshot when checking what is in your path. If you don't see CMake there then add it manually. You should point to the bin folder of CMake. In the example, it is C:\Program Files\CMake\bin.

Hope it helps,
Let me know for issues
Attachments
Screen Shot 2022-12-13 at 19.34.22.png
Screen Shot 2022-12-13 at 19.34.22.png (96.96 KiB) Viewed 1033 times
Picture1.png
Picture1.png (280.24 KiB) Viewed 1033 times

User avatar
Antoine Falisse
Posts: 438
Joined: Wed Jan 07, 2015 2:21 am

Re: Error when running muscle-driven simulations

Post by Antoine Falisse » Fri Dec 16, 2022 3:23 pm

In the latest version of opencap-processing, you should not need to install CMake manually anymore. CMake is now installed automatically in your conda environment and this should take care of your path.

To refresh your version of opencap-processing, pull the latest version from github. You can then update your conda environment by running `python -m pip install -r requirements.txt` (step 8 of the install requirements). If you type `conda list`, you should see that cmake is in there.

POST REPLY