Sometimes rclpy
fails to be imported because of some missing DLLs on your system.
If so make sure to install all the dependencies listed in the "Installing prerequisites" sections of the installation instructions (Windows <windows-install-binary-installing-prerequisites>, MacOS <osx-install-binary-installling-prerequisites>).
If you are installing from binaries, you may need to update your dependencies: they must be the same version as those used to build the binaries.