Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verdi profile delete #3534

Closed
young-han opened this issue Nov 10, 2019 · 10 comments
Closed

verdi profile delete #3534

young-han opened this issue Nov 10, 2019 · 10 comments

Comments

@young-han
Copy link

young-han commented Nov 10, 2019

When I try to delete my test profiles, I have error messages as below.
I am using postgresql-9.6 and aiida-core 1.0.0 on centos6.

(aiida) $ verdi -v
AiiDA version 1.0.0
(aiida) $ verdi profile delete test3
Info: Deleting profile 'test3'
[sudo] password for yhshin:
  File "<string>", line 1
    import sys; print sys.version[:3]
                        ^
SyntaxError: invalid syntax
/var/tmp/sclTWtkP1: line 8: -V: command not found
Warning: Could not find `sudo` for connecting to the database.
Warning: Unable to autodetect postgres setup - do you know how to access it?
postgres host [localhost]:
@sphuber
Copy link
Contributor

sphuber commented Nov 10, 2019

Thanks @young-han for the report. This seems maybe like a python version error. Can you print the output of python --version. I think you should be running python 3, but you have a library that is only python 2. At least the line import sys; print sys.version[:3] is invalid python 3 because of the print statement. Could you also attach the output of pip freeze as a file here?

@young-han
Copy link
Author

Hi Sebastian, here is the result that I have when I run "python --version" and "pip freeze" as well as "which python". Thank you!

--
(aiida) $ python --version
Python 3.6.7

(aiida) $ which python
~/.virtualenvs/aiida/bin/python

(aiida) $ ls -l ~/.virtualenvs/aiida/bin/python
lrwxrwxrwx 1 yhshin shingroup 7 2019-10-22 19:28 /home/yhshin/.virtualenvs/aiida/bin/python -> python3

(aiida) $ ls -l ~/.virtualenvs/aiida/bin/python3
-rwxr-xr-x 1 yhshin shingroup 10029602 2019-10-22 19:28 /home/yhshin/.virtualenvs/aiida/bin/python3

(aiida) $ pip freeze
aiida-core==1.0.0
aiida-diff==1.0.0b1
aiida-quantumespresso==3.0.0a5
aiida-vasp==0.3.0
aldjemy==0.9.1
alembic==1.2.1
aniso8601==8.0.0
appnope==0.1.0
ase==3.17.0
asn1crypto==1.0.0
bcrypt==3.1.7
certifi==2019.9.11
cffi==1.12.3
chainmap==1.0.3
chardet==3.0.4
circus==0.15.0
Click==7.0
click-completion==0.5.1
click-config-file==0.5.0
click-spinner==0.1.8
configobj==5.0.6
cryptography==2.7
cycler==0.10.0
dataclasses==0.7
decorator==4.4.0
distro==1.4.0
Django==1.11.25
elementpath==1.1.8
ete3==3.1.1
Flask==1.1.1
Flask-Cors==3.0.8
Flask-RESTful==0.3.7
frozendict==1.2
furl==2.1.0
future==0.17.1
graphviz==0.13
idna==2.8
ipython==5.8.0
ipython-genutils==0.2.0
itsdangerous==1.1.0
Jinja2==2.10.1
kiwipy==0.5.1
kiwisolver==1.1.0
lxml==4.4.1
Mako==1.1.0
MarkupSafe==1.1.1
matplotlib==3.1.1
mock==3.0.5
monty==2.0.4
mpmath==1.1.0
networkx==2.3
numpy==1.16.4
orderedmultidict==1.0.1
packaging==19.2
palettable==3.3.0
pandas==0.25.1
paramiko==2.6.0
parsevasp==0.4.3
passlib==1.7.1
pbr==5.4.3
pexpect==4.7.0
pickleshare==0.7.5
pika==1.1.0
plumpy==0.14.3
prompt-toolkit==1.0.16
psutil==5.6.3
psycopg2-binary==2.8.3
ptyprocess==0.6.0
py==1.5.4
PyCifRW==4.4.1
pycparser==2.19
PyDispatcher==2.0.5
Pygments==2.4.2
pymatgen==2018.12.12
PyMySQL==0.9.3
PyNaCl==1.3.0
pyparsing==2.4.2
python-dateutil==2.8.0
python-editor==1.0.4
pytz==2019.3
PyYAML==3.13
pyzmq==16.0.4
qe-tools==1.1.3
reentry==1.3.1
requests==2.22.0
ruamel.yaml==0.16.5
ruamel.yaml.clib==0.2.0
scipy==1.3.1
seekpath==1.9.3
shellingham==1.3.1
shortuuid==0.5.0
simplegeneric==0.8.1
simplejson==3.16.0
six==1.12.0
spglib==1.14.1.post0
SQLAlchemy==1.3.10
SQLAlchemy-Utils==0.34.2
subprocess32==3.5.4
sympy==1.4
tabulate==0.8.5
topika==0.2.0
tornado==4.5.3
traitlets==4.3.2
tzlocal==2.0.0
upf-to-json==0.9.2
uritools==2.2.0
urllib3==1.25.6
voluptuous==0.11.7
wcwidth==0.1.7
Werkzeug==0.16.0
wrapt==1.11.2
xmlschema==1.0.13

@young-han
Copy link
Author

young-han commented Nov 12, 2019

I found that the problem disappeared when I set pg_hba.conf as

local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust

@young-han
Copy link
Author

I tried to follow the instruction at https://aiida-core.readthedocs.io/en/latest/install/installation.html, but I could not make the password empty. It seems that "!" does not work for password.

@sphuber
Copy link
Contributor

sphuber commented Nov 12, 2019

What command are you using to create a profile, verdi quicksetup or verdi setup? If verdi quicksetup does not work, but you have successfully created a database in PostgreSQL manually, use verdi setup instead. That should always work.

@young-han
Copy link
Author

I used verdi setup. When I used md5 in pg_hba.conf, I couldn't delete my profile with verdi profile delete. As a next trial, I am following the Database setup using Unix sockets section, but I don't understand how to leave host, port, password empty. When I used "!", verdi setup returns errors that they could not be empty.

스크린샷 2019-11-12 오후 11 08 12

@sphuber
Copy link
Contributor

sphuber commented Nov 12, 2019

To be honest I am not familiar with that section of the docs nor that method of connecting. Do you have a database created in PostgresSQL? That is to say, can you connect to it from the command line e.g.:

psql -h localhost -p 5432 -d <database_name> -U <database_username> -W

If that works, then I would suggest to run verdi setup normally and provide those values in there. This should then work.

@young-han
Copy link
Author

When I set host all all 127.0.0.1/32 ident in pg_hba.conf, just psql aiidadb works. If I specify -h localhost, it doesn't work. But, -p 5432 or -W work.

I will use the following trust METHOD for the local access until finding out the ident METHOD:.
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust

@ltalirz
Copy link
Member

ltalirz commented Apr 5, 2020

Hi @young-han , I've finally found a bit of time to look into the wider issue of verdi quicksetup and autodetecting the postgresql setup.
There is now an open PR #3892 that moves out the relevant code to a separate package, which I'm already testing on a wide range of operating systems and postgresql setups.

Reading through your reports, I notice a couple of issues:

  1. It is not possible to enter an empty password. While you can actually enter any password if you are hitting the trust setting of postgresql, we need to fix this - it should be possible to enter an empty password.
  2. The same issue applies to the host and port arguments
  3. The documentation on "setting up the DB via sockets". I believe the instructions in this documentation are not correct.
  4. The python2 code that showed up on your screen - I'm still puzzled where this might come from...

I will look into issues 1-3 now.

As for your issue with the database setup in the pg_hba.conf, here is the list of settings that the new pgsu module is tested with.
After PR #3892 is merged, you should be able to change your pg_hba.conf e.g. to

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

and should be able to use verdi quicksetup to set up a profile (as well as verdi profile delete to delete it). If not, it's a bug, and with pgsu we now finally have a better way of adding tests for those.

Note that I can't say what applies to the profiles set up in the meanwhile since the settings of their databases may differ.

@unkcpz
Copy link
Member

unkcpz commented Nov 9, 2021

@young-han is the new aiida working for you? Then, it will be safe to close this issue I guess.

@sphuber sphuber closed this as completed May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants