ImportError on Windows

Hi, I already tried many different solutions which I found with search, but nothing really worked. And before completely breaking it, I’ll give this forum a shot. I installed Carla with this guide and think it could be a problem with the environmental path: https://carla.readthedocs.io/en/0.9.11/build_windows/

I get the following error message:

E:\Program Files\CARLA\carla\PythonAPI\examples>py spawn_npc.py
Traceback (most recent call last):
File “E:\Program Files\CARLA\carla\PythonAPI\examples\spawn_npc.py”, line 27, in
from carla import VehicleLightState as vls
ImportError: cannot import name ‘VehicleLightState’ from ‘carla’ (…\carla\dist\carla-0.9.11-py3.9-win-amd64.egg\carla_init_.py)

The previously used “import carla” command didn’t give any errors. When deleting the “from carla import VehicleLightState as vls” command I get the same issue with the subsequent import command “from numpy import random”, even though I already installed numpy via: "
cd PythonAPI\examples
pip install -r requirements.txt"

I use Python 3.9. And by the way, I can’t use the command “python3 spawn_npc.py” but have to use “py spawn_npc.py” because “Python was not found” follows after I use “python3…”
The only environment variable I had to set up, as described in the guide, is “UE4_ROOT”, which shows the path to Unreal Engine 4.24.

I installed CARLA a few days ago.
My egg file is this one : carla-0.9.10-py3.7-win-amd64 which required Python 3.7 so to launch a Python script I use the following command :
py -3.7 spawn_npc.py

Probably not going to fix the problem. But you never know.
Btw the only environment variable I had to set up was “pip”.

Thanks for the answer! Tried it with py -3.9 spawn_npc.py, but it didn’t work. Can you tell me how exactly you set up “pip”?

To add pip as a variable I follow this tutorial : https://www.youtube.com/watch?v=zYdHr-LxsJ0
You find you pip.exe file, you copy the path, and paste it when you add the variable !
But unlike in the video I added it as a system variable