-
Notifications
You must be signed in to change notification settings - Fork 5
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
⬆️ Update to aiida-core v1.4.2 #48
Conversation
Also drop sperate numpy install , since this should no longer be needed, in accordance with: aiidateam/aiida-core#4378
@ltalirz do you know if there was a reasoning behind this setuptools pinning
given that aiida-core's build dependency is |
@chrisjsewell I saw that it was introduced by me and I can't remember a specific reason that would still be valid. I think it's safe to delete. |
This failure with numpy 1.19.2 seems weird... the "test-install" worfklow on the aiida-core repo is still working fine: https://github.com/aiidateam/aiida-core/runs/1245377894?check_suite_focus=true#step:4:61 |
As usual, it pymatgen being a pile ***. It looks like it requires cython to build, so will try adding cython to the virtulenv. perhaps cython gets pre-installed on GH actions? 🤷 |
Yeh that looks to have fixed it. One thought I had, before realising the issue with pymatgen, is that perhaps it would be better to use the CI requirements files, to use specific versions of dependencies (rather than them possibly changing over time), i.e. - name: Install aiida-core dependencies
pip:
requirements: "{{ aiida_source_folder }}/aiida-core/requirements/requirements-py-3.{{ ansible_python_version.split('.')[1] }}.txt"
virtualenv: "{{ aiida_venv }}"
# According to https://github.com/ansible/ansible/issues/52275
virtualenv_command: /usr/bin/python3 -m venv
- name: Install aiida-core package and dependencies
pip:
name:
- "{{ aiida_source_folder }}/aiida-core"
virtualenv: "{{ aiida_venv }}"
# According to https://github.com/ansible/ansible/issues/52275
virtualenv_command: /usr/bin/python3 -m venv
editable: true
extra_args: "--no-deps"
notify: reentry scan
# this guard is necessary because, for some reason, installs with
# 'editable: true' always show as "changed"
when: git_checkout.changed The drawback would be that you could no longer specify particular extras, Thoughts @ltalirz? |
Hmm, I added a |
These would be the Currently, the role defaults to even more extras: ansible-role-aiida/defaults/main.yml Lines 3 to 8 in c709088
It seems to me that being able to select extras is useful and perhaps we should actually reduce the number of extras installed by default to The installation of AiiDA with extras from scratch is tested on the test-install workflow for python 3.6-3.8 Finally, would it make sense to add your |
tasks/aiida-prepare.yml
Outdated
- wheel | ||
- numpy==1.17.4 | ||
- cython # required by pymatgen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, to recap: I think the problem is that pymatgen still specifies its build dependencies (numpy) via an antiquated method, which results in easy_install
being used instead of pip, which then requires numpy to be built from source (rather than just using a wheel).
I.e. just putting numpy here should probably also solve the problem and would be faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll give it a go thanks:
pymatgen does have numpy as a setup dependency not cython: https://github.com/materialsproject/pymatgen/blob/cea7587e40cff1d8b476601176b034d753301971/setup.py#L108
although feels weird that this is the dependency to build the cython files: https://github.com/materialsproject/pymatgen/blob/cea7587e40cff1d8b476601176b034d753301971/setup.py#L164
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works 👍
I think it wouldn't hurt cc @csadorf, FYI see above for some issues we've had; firstly with pymatgen install failing, then with |
Ermm what the heck, @ltalirz molecule has suddenly broken 🤦 (maybe a new version release, I'll check)
latest versions:
last working:
|
They moved the docker driver out of molecule core: ansible/molecule#2891 (comment) |
Shame on them! |
Poor geerlingguy did 87 commits in 87 repositories yesterday https://github.com/geerlingguy |
Not very funny for him probably... Perhaps he has an automated procedure for this? We may need to do the same. They're not done via PRs, i.e. it's probably just a bash script iterating over all local repo folders. |
Or using the github API? |
Anyway I blame it all on @webknjaz 😝 (ansible/molecule#2891): ansible giveth and ansible taketh away |
@chrisjsewell not my fault! I stopped maintaining molecule a long time ago. Blame @ssbarnea :) |
Wow, that is indeed rather extensive. I suspect he does it from Ansible. |
Ok, so this is what they suggest: https://github.com/openstack/tripleo-quickstart-extras/blob/a3cec1fd88f249b6997593f3e4d933c2f516d1cf/molecule-requirements.txt#L10 @chrisjsewell Up to you whether you want to make the upgrade to 3.1 or just keep 3.0 In the end, the fastest might be just to loop over local clones of all role repositories, commit and push. |
TBH its OK, because I'm going through all repos and applying marvel-nccr/quantum-mobile#132 anyway |
@ltalirz in a175318 I've solved the pip versioning issue 😄 (as long as the tests pass 🤞): I now generate a pip constraints file from aiida-core's setup.json, then that is applied to all plugin installs, e.g. |
ah damn this worked locally 🤔 |
haha @pradyun was just reading up on pip constraints and saw you snuck in tabs 👀 |
success! |
- notebook | ||
aiida_data_folder: "${HOME}/.local/share/aiida" | ||
aiida_templates_folder: "${HOME}/.local/share/aiida" | ||
aiida_source_folder: "${HOME}/src" | ||
aiida_examples_folder: "${HOME}" | ||
aiida_venv: "${HOME}/.virtualenvs/aiida" | ||
aiida_constraints_file: "{{ aiida_data_folder }}/constraints.txt" | ||
# these are additional to those extracted from aiida-core and its extras | ||
aiida_constraints: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see; we need to lock things down even further (?).
Should we be adding this constraint in the setup.json
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps 🤷 (to the docs extra), I guess with the new pip --use-feature=2020-resolver
it should resolve this and not allow such a broken environment to transpire. But without it, and with this particular set of extras it definitely creates a broken environment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisjsewell that's why I advocate for having proper env requirements+pins managed by pip-tools instead of extras
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh we do already have lock files for CI testing: https://github.com/aiidateam/aiida-core/tree/develop/requirements.
The problem is that we are not just trying to install aiida-core, we need to install a range of other plugin packages that might not be exactly compatible with these hard pinnings:
ansible-role-aiida/defaults/main.yml
Lines 60 to 71 in c709088
aiida_plugin_versions: | |
aiida_cp2k: "1.1.0" | |
aiida_fleur: "1.1.0" | |
aiida_bigdft: "0.2.1a2" | |
# aiida_gudhi: "0.1.0a3" | |
# aiida_phtools: "0.1.0a1" | |
aiida_quantumespresso: "3.1.0" | |
# aiida_raspa: "1.0.0a2" | |
aiida_siesta: "1.1.0" | |
aiida_yambo: "1.1.1" | |
aiida_wannier90: "2.0.1" | |
aiida_wannier90_workflows: "1.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so you need a combined lockfile, I guess... Just dump that to a file and use a few requirements sources to produce transitive pins? FWIW I think what confused me is the definition substitution (constraints vs requirements).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh exactly, I'm not completely sold on the current solution here, but at least now it is properly tested and produces a valid environment, which is a step forward 😬
So I am going to merge this as this, but anyway we have an open issue marvel-nccr/quantum-mobile#137 to consider this further, at which point I will definitely take into account your recommendation (thanks 🙏) and may well switch to some form of lock file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @webknjaz you might be interested to see I now set up a full ~2 hour vagrant+ansible build running in GH Actions: https://github.com/marvel-nccr/quantum-mobile/runs/1286287172?check_suite_focus=true 😄
@@ -0,0 +1,37 @@ | |||
#!/usr/bin/env python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to keep it this parser here for the moment - eventually this should probably go to into https://github.com/aiidateam/aiida-core/tree/develop/utils
@@ -20,6 +20,16 @@ | |||
- item.name in aiida_pps.stdout | |||
with_items: "{{ aiida_pseudopotentials }}" | |||
|
|||
- name: print aiida-core version | |||
shell: "{{ aiida_venv }}/bin/pip show aiida-core" | |||
changed_when: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't even need this in verify.yml
(of course fine to keep)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought just in case a plugin tries to install a different version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant the changed_when
is not needed (it's fine to change things in verify.yml
)
- wheel | ||
- numpy==1.17.4 | ||
- numpy # required by pymatgen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no pinning, are you sure? ;-)
I'd feel safer with pinning it to some recent minor version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only needed for the pymatgen install, it will be updated, if necessary, by the pip install of aiida-core. If you pin it, then you have to ensure it is compatible with aiidalab and aiida-core (a current issue in the full quantum mobile build)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks a lot @chrisjsewell
Just a few minor comments left, then we can merge this!
import sys | ||
|
||
def remove_extra(req): | ||
"""Extras are not allowed in constraints files, e.g. dep[extra]>0.1 -> dep>0.1 """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, fair enough. Using pip-tools would fix that too.
@@ -0,0 +1,37 @@ | |||
#!/usr/bin/env python | |||
"""Script to convert aiida setup.json to pip constraints file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not constraints but rather requirements. You'd usually use https://github.com/jazzband/pip-tools to generate the pinned env deps aka constraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, pip-tools can generate pins from setup.py
natively so you could just replace this script with an existing tool: https://github.com/jazzband/pip-tools#requirements-from-setuppy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no that creates a lock file, with strict version pinning. we just want a constraints file, for when you run subsequent pip installs, i.e. these installs can change the version of packages if necessary, but only within the ranges specified by setup.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisjsewell true but the purpose of constraints file in pip is exactly that it should be a lock file. So that the usage would be pip install -r requirements.txt -c constraints.txt
. The former should usually contain open-ended direct dependencies while the latter would pinpoint what exactly is allowed (it's best when there's also --require-hashes
too), including the transitive deps too, making the virtualenv setup reproducible.
@chrisjsewell If it simplifies the constraints issue, the installation of the plugins could probably be done in one go (it would be good to use a mechanism that allows specifying a commit/tag from a github repo as a source of a package instead of a pypi version; at least historically that was often needed). The per-plugin yaml files could then be reduced to just setting up the corresponding aiida code. |
Yeh as mentioned above I think I will merge this as is now, since it is definitely a step in the right direction. Then consider this further in marvel-nccr/quantum-mobile#137 (including how we integrate with aiidalab) |
Also drop separate numpy install, since this should no longer be needed, in accordance with: aiidateam/aiida-core#4378