PyChrono sensor import failed

312 views
Skip to first unread message

Jeremy Kimball

unread,
Feb 13, 2023, 4:46:38 PM2/13/23
to ProjectChrono
Hello everyone, 

I am relatively new to python programming and am just getting started with PyChrono for my masters thesis research, specifically I am interested in the sensor module. 

I have installed pychrono according to the steps outlined at: https://api.projectchrono.org/pychrono_installation.html.

All of the demos other than the sensor ones run on my machine, however, when I attempt to run any of the sensor demos I get an import error: ImportError: cannot import name '_sensor' from 'pychrono'.

I have Nvidia graphics driver version 528.02 and my machine has an Nvidia GeForce MX250 GPU. All of the packages in my venv seem to align with the required versions as per chrono documentation.

I would also like to mention that I have only had success running the other demos when either 1) in VSCode I paste all of the .dll chrono files into the active folder or 2) when I run the demo scripts directly from the anaconda prompt. 

I am hopeful that there is a simple fix here that I am overlooking or that other users have encountered the same issue and found a solution.

Any help would be greatly appreciated.

Thanks,

Jeremy

Nevindu Batagoda

unread,
Feb 13, 2023, 6:52:04 PM2/13/23
to ProjectChrono
Hi Jeremy,

Can you please answer a few questions so I can understand your issue better,
  1. What is your Operating System?
  2. Which version of Python are you using?
  3. When you used conda to install Chrono, did you use  "conda install -c projectchrono pychrono" command or did you specify a specific package with conda install <pychrono_package>.tar.bz2?
  4. Go to the anaconda installation folder: In windows: "C:\Users\<username>\anaconda3\pkgs\", In linux: "~/anaconda3/pkgs" and see if you have a directory called: pychrono-X.0.0-py3X_XXXX. Is the py3X version consistent with your own python version? Ex: If you have python 3.10, you should have a directory called: pychrono-X.0.0-py310_XXXX.
If there is a version mismatch for question 4, you need to install the correct chrono package corresponding to your python version. Go to: https://anaconda.org/projectchrono/pychrono/files to find the relevant package name and use conda install <pychrono_package>.tar.bz2 to install the package.

Also, make sure you have all the requirements listed in https://api.projectchrono.org/pychrono_installation.html properly installed.

Hope these steps fix your problem. Please let me know if this doesn't work, so we can further look into it.

Best,
Nevindu

Jeremy Kimball

unread,
Feb 13, 2023, 7:19:52 PM2/13/23
to ProjectChrono
Thanks for the response!

1) My operating system is Windows 10 Enterprise
2) I am using Python 3.9.15
3) I specified a specific package with conda install <pychrono_package>.tar.bz2. I used 'pychrono 8.0.0-py39_0.tar.bz2'.
4) Yes, I have a directory called pychrono-8.0.0-py39_0.

As far as I can tell when I run "conda list" I have all of the correct versions of the required packages. I have attached a .txt file of the "conda list" output in the venv. Maybe there is something out of place there that I am missing.

Any ideas / other troubleshooting steps I could take?

Thanks so much,

Jeremy
conda list.txt

Nevindu Batagoda

unread,
Feb 13, 2023, 7:53:17 PM2/13/23
to ProjectChrono
Hello,

Thanks for the info, Can you try the following,

1. Go to `C:\Users\<user name>\anaconda3\envs\<environment name>\Lib\site-packages` and check if you have the _sensor.pyd file.
2. Can you share the contents of your PYTHON_PATH environment variable (if you have one)?
3. Check if you have the cuda toolkit properly installed? Can you please share the outputs of the following commands: 1)nvidia-smi, 2)nvcc -V.

Best,
Nevindu

Dan Negrut

unread,
Feb 13, 2023, 8:09:46 PM2/13/23
to Jeremy Kimball, ProjectChrono

Jeremy – also tell us, ball park, what you want to do.

We might be able to give you one of our models, with sensors and everything, for you to get going fast, rather than struggling to put things together…

Are you into small AVs and such? I think we have one such model all set up, ready to go.

Dan

 

-------------------------------------------------

Bernard A. and Frances M. Weideman Professor

NVIDIA CUDA Fellow

Director, Wisconsin Applied Computing Center

Department of Mechanical Engineering

Department of Computer Science

University of Wisconsin - Madison

4150ME, 1513 University Avenue

Madison, WI 53706-1572

608 772 0914

http://sbel.wisc.edu/

http://projectchrono.org/

-------------------------------------------------

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/07475c16-26a5-40e3-b563-c30b74d36c29n%40googlegroups.com.

Jeremy Kimball

unread,
Feb 13, 2023, 8:11:41 PM2/13/23
to ProjectChrono
Thanks again for the suggestions.

1) I do have the _sensor.pyd file.
2) I do not have a PYTHON_PATH (or PYTHONPATH) environment variable.
3) I have attached the outputs of the commands you specified.

Let me know if that helps diagnose my issue.

Thanks,

Jeremy
nvcc -V.txt
nvidia-smi.txt

Jeremy Kimball

unread,
Feb 13, 2023, 8:23:09 PM2/13/23
to ProjectChrono
Hi Dan,

Sure thing. My research is pertaining to active suspension control with terrain preview for off-road vehicles, and so I was hoping to use Project Chrono to play around with simulating sensor readings (LiDAR, stereo camera) that could be used for extracting road profile information for upcoming terrain.

The ultimate goal would be to feed that sensor data into a controller to generate the active suspension control action. I also want to look at reinforcement learning control methods for active suspension and was considering using Chrono as a training environment.

Any thoughts on that?

Jeremy

Dan Negrut

unread,
Feb 13, 2023, 8:46:42 PM2/13/23
to Jeremy Kimball, ProjectChrono

Hey Jeremy - This is an interesting project.

The pieces are there I think. Probably start with a demo of the HMMWV and use rigid terrain. You can add sensors to the HMMWV model. In the past, we also did something like this with SCM deformable terrain. For instance, see here:

“Enabling Artificial Intelligence Studies in Off-Road Mobility Through Physics-Based Simulation of Multi-Agent Scenarios,” A. Young, J. Taves, A. Elmquist, S. Benatti, A. Tasora, R. Serban, D. Negrut, ASME Journal on Computational and Nonlinear Dynamics, 17(5): 051001, 2022

“End-to-end learning for off-road terrain navigation using the Chrono open-source simulation platform,” S. Benatti, A. Young, A. Elmquist, J. Taves, A. Tasora, R. Serban, D. Negrut, Multibody System Dynamics, vol. 54, 399–414, 2022

 

Beyond looking at the examples provided in demos, another place where you can look for tidbits is here: https://github.com/uwsbel/public-metadata .

Jeremy Kimball

unread,
Feb 13, 2023, 8:59:53 PM2/13/23
to ProjectChrono
Thanks so much for the info Dan. Those papers look quite interesting and I'm sure that repo will be an extremely useful resource.

Now I just need to get the sensor module to import!

Best,

Jeremy

Nevindu Batagoda

unread,
Feb 13, 2023, 9:28:05 PM2/13/23
to ProjectChrono
Jeremy,

Do you have the ChronoEngine_sensor.dll file in the "C:\Users\<user name>\anaconda3\pkgs\pychrono-8.0.0-py39_0\Library\bin" folder?

I installed the same chrono build in a windows system within a conda environment with python 3.9.15 and managed to run the sensor demos without any issues. The issue in your build likely stems from an incomplete install of any of the dependencies for the sensor module (CUDA, GLFW,...). 

Would you be open to trying installing pychrono from the C++ sources? You can follow the instructions in Section B of https://api.projectchrono.org/pychrono_installation.html.

Best,
Nevindu

Jeremy Kimball

unread,
Feb 13, 2023, 10:02:55 PM2/13/23
to ProjectChrono
I do have the ChronoEngine_sensor.dll file in that folder. 

I just created a new virtual environment and followed the steps at https://api.projectchrono.org/pychrono_installation.html in order and have attached a .txt file of the entire installation process including me trying to run a demo in the fresh environment at the end and getting the same error. 

Yes, I can try installing PyChrono from the C++ sources next, although I would still like to know why the Anaconda installation is not working for me.

If anything in that .txt file gives you any hints as to what my issue is please let me know.

Thanks so much for your help,

Jeremy
full install process.txt

Jeremy Kimball

unread,
Feb 13, 2023, 10:39:30 PM2/13/23
to ProjectChrono
Seems like I've gotten it to work. I knew it was going to be an easy fix; I just downloaded CUDA toolkit from NVIDIA (https://developer.nvidia.com/cuda-toolkit) and all of the demos seem to be running fine :).

Maybe it would be a good idea to add installing CUDA toolkit from NVIDIA.com as a requirement on the PyChrono installation page, as I don't think it is listed in the current steps at https://api.projectchrono.org/pychrono_installation.html.

Thanks so much for your help, I will be sure to reach out again if any other issues arise.

All the best,

Jeremy

Nevindu Batagoda

unread,
Feb 13, 2023, 10:42:35 PM2/13/23
to ProjectChrono
I assumed you had CUDA Toolkit installed since the nvcc and nvidia-smi returned positive results. It was a bad assumption on my part, sorry about that. Glad it worked out in the end!

Best,
Nevindu

Radu Serban

unread,
Feb 14, 2023, 3:27:22 AM2/14/23
to ProjectChrono

Jeremy,

 

I am confused.  Installing the cuda-toolkit package is clearly listed as a requirement for getting Chrono::Sensor support in PyChrono:

  • For Chrono::Sensor support:
    • Requires NVIDIA graphics driver 515.xx +
    • Install CUDA 11.7:

conda install -c nvidia/label/cuda-11.7.0 cuda-toolkit

    • install GLFW:

conda install -c conda-forge glfw

What am I missing?

 

--Radu

Jeremy Kimball

unread,
Feb 22, 2023, 10:08:31 AM2/22/23
to ProjectChrono
Sorry - I had installed the cuda-toolkit python package via conda as per the instructions, but the sensor module was not working until I installed the actual cuda toolkit application from https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64 (not through conda).

Installing the cuda toolkit application from the above link was not listed in the installation guide.

Hope that clears up what my problem was.

Jeremy 

Reply all
Reply to author
Forward
0 new messages