-2

I am trying to create a simulation using webots in python. Although the libraries (NumPy, matplotlib, etc..) are installed on my ubuntu system, I cannot import them in my controller!! how can I use these libraries in my webots controller ??

from controller import Robot, DistanceSensor, Motor, CameraSupervisor,Node
import random
import numpy as np


ModuleNotFoundError: No module named 'numpy'
  • Please provide a minimal reproducible example of your issue: https://stackoverflow.com/help/minimal-reproducible-example – Thomas Schillaci Mar 09 '20 at 09:57
  • You should be able to import your python module in Webots as with any regular python script. Can you please provide an example and the error message you get? – David Mansolino Mar 11 '20 at 08:08

2 Answers2

2

You need to install the numpy package first. Open terminal and type

pip install numpy
# or
python -m pip install -U numpy
m02ph3u5
  • 3,022
  • 7
  • 38
  • 51
0

I just came up with similar error.

Run this command "PYTHON_PATH\Scripts\pip.exe install opencv-python" on cmd.exe if you use Windows otherwise check the link below:

https://github.com/cyberbotics/webots-doc/blob/master/guide/using-python.md