Search code examples
pythonpython-3.xdatabasepython-module

ModuleNotFoundError: No module named 'database'


I am trying to import a package. And when it is imported, it seems to be working, i can use its elements, but, i get an error still that says that there i no package named after what i imported. the error is this:

from database import DataBase
 ModuleNotFoundError: No module named 'database'

I think people would try to suggest to do

pip install databases

in to the terminal, and i have done that, and i have also done these in to the terminal as well just incase:

pip install databases[postgresql]
pip install databases[mysql]
pip install databases[sqlite]

And it just does not seem to work.


Solution

  • The following should work - note that Database is case sensitive. You can see the docs and some examples here.

    from databases import Database