Open william2313 opened 1 year ago
I have now made my Postgresql user account a superuser with:
ALTER USER adam WITH SUPERUSER
However, I'm still getting the same error.
Could you perhaps give more detailed instructions on how to setup Postgreql for this purpose? Not everybody is an experienced Postgresql user.
@william2313 I just use Sqlite, it works out-of-the-box
@nalbion So you just installed it without doing anything else? And what did you put in the .env file?
Ok, this worked out of the box indeed. Thanks. Leaving it open though because still unclear how to use postgresql which they seem to recommend.
A solution for this would be creating the gpt-pilot database:
After installing the postgresql connect to it and create a username
$ sudo -u postgres -i
postgres@:~$ createuser -l -d -P your_username
Afterwards create the database for gpt-pilot:
postgres@:~$ createdb gpt-pilot -O your_username
Note that your_username is the username set in postgresql
@william2313, @filimongeorge if the process is not clear, please feel free to submit a PR with updated documentation in the README
How exactly do I need to setup Postgresql? I installed it and verified that the service was running. This all went fine. I created a user with the same name as my user account using "sudo -u postgres createuser adam". (It said "could not change directory to "/home/adam/gpt-pilot/pilot": Permission denied" but when I ran the \du command in postgres it showed the new created role). I then followed the gpt-pilot installation instructions. In the .env file I only uncommented the line "DATABASE_TYPE=postgres" and added my name to "DB_USER=". I kept password blank as I hadn't set a password for the user. I didn't enter anything at DB_HOST and DB_PORT.
When I ran "python db_init.py" I got the following error:
Traceback (most recent call last): File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3187, in connect self._state.set_connection(self._connect()) ^^^^^^^^^^^^^^^ File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3926, in _connect conn = psycopg2.connect(params) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/psycopg2/init.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, kwasync) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ psycopg2.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "gpt-pilot" does not exist
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/adam/gpt-pilot/pilot/db_init.py", line 5, in
drop_tables()
File "/home/adam/gpt-pilot/pilot/database/database.py", line 432, in drop_tables
with database.atomic():
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 4363, in enter
return self._helper.enter()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 4398, in enter
self._begin()
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 4384, in _begin
self.db.begin(*args, *kwargs)
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3390, in begin
self.connect()
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3186, in connect
with __exception_wrapper:
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3014, in exit__
reraise(new_type, new_type(exc_value, exc_args), traceback)
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 192, in reraise
raise value.with_traceback(tb)
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3187, in connect
self._state.set_connection(self._connect())
^^^^^^^^^^^^^^^
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3926, in _connect
conn = psycopg2.connect(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/gpt-pilot/pilot-env/lib/python3.11/site-packages/psycopg2/init.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, kwasync)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
peewee.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "gpt-pilot" does not exist