AfieldTrails / s2-postgis

S2 Cell Id functions for PostgreSQL and PostGIS
MIT License
18 stars 5 forks source link

role "root" does not exist #2

Closed ppKrauss closed 6 years ago

ppKrauss commented 6 years ago

Hi, trying to install... After sucess with sudo pip3 install s2sphere, and at my ~/sandbox/s2-postgis cloned folder, using UBUNTU 16 LTS, run sudo make install && make installcheck:

Makefile:8: /usr/lib/postgresql/10/lib/pgxs/src/makefiles/pgxs.mk: No such file or directory
make: *** No rule to make target '/usr/lib/postgresql/10/lib/pgxs/src/makefiles/pgxs.mk'.  Stop.

So I do sudo apt-get install postgresql-server-dev-all... running again sudo make install && make installcheck:

/bin/mkdir -p '/usr/share/postgresql/10/extension'
/bin/mkdir -p '/usr/share/postgresql/10/extension'
/usr/bin/install -c -m 644 .//s2.control '/usr/share/postgresql/10/extension/'
/usr/bin/install -c -m 644 .//s2--0.0.2.sql  '/usr/share/postgresql/10/extension/'
/usr/lib/postgresql/10/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/lib/postgresql/10/bin'    --dbname=contrib_regression s2_test
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
psql: FATAL:  role "root" does not exist
command failed: "/usr/lib/postgresql/10/bin/psql" -X -c "DROP DATABASE IF EXISTS \"contrib_regression\"" "postgres"
/usr/lib/postgresql/10/lib/pgxs/src/makefiles/pgxs.mk:283: recipe for target 'installcheck' failed
make: *** [installcheck] Error 2
placz commented 6 years ago

It looks like it's installed, but failing in executing the tests. You don't have a postgresql database user for the user you're executing as -- root. It would probably be good to use a different user, but if you're doing this in a Docker container, that makes sense.

createuser --createdb root (if there's another permissions-related error, you might need --superuser.. let me know)

placz commented 6 years ago

You may also need to switch to the postgres user to run that command: sudo -u postgres createuser --createdb root

ppKrauss commented 6 years ago

Hi, thanks the reply (!). Only a fast feedback, I not analysing in deep...

whoami
root

sudo -u postgres createuser --createdb root
could not change directory to "/root": Permission denied
createuser: creation of new role failed: ERROR:  role "root" already exists
ppKrauss commented 6 years ago

Try to run SQL tests directly, as you say "looks like installed",


CREATE LANGUAGE plpython3u;
ERROR:  could not access file "$libdir/plpython3": No such file or directory

CREATE EXTENSION s2;
ERROR:  language "plpython3u" does not exist
HINT:  Use CREATE LANGUAGE to load the language into the database.

There are some clues at this old discussion... but I not see what to do. There are a a way to use plpythonu instead plpython3u?

placz commented 6 years ago

It uses python3, so you need plpython3u

sudo apt-get install postgresql-plpython3-

ppKrauss commented 6 years ago

Ok apt install postgresql-plpython3-10 was fine... and psql _etc_ < s2-postgis/sql/s2_test.sql is running!

Thank you for all your patience and attention! (supposing that we must to close)