After installing Selenium in Ubuntu and adding geckodriver to path I get this error when I run
from selenium import webdriver driver = webdriver.Firefox()
In addition to the provided answers, there is also this option where you can copy the driver to /usr/bin:
/usr/bin
sudo cp geckodriver /usr/bin