cctbx / cctbx_project

Computational Crystallography Toolbox
https://cci.lbl.gov/docs/cctbx
Other
222 stars 117 forks source link

Add mechanism to auto-update base when new dependencies added (or warn that it will be borken) #274

Closed graeme-winter closed 5 years ago

graeme-winter commented 5 years ago

i.e. mrcfile recently became a new dependency so now

dials.python -c "from iotbx.reflection_file_reader import any_reflection_file"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "iotbx/reflection_file_reader.py", line 67, in <module>
    from iotbx.option_parser import option_parser
  File "iotbx/option_parser.py", line 2, in <module>
    from iotbx import crystal_symmetry_from_any
  File "iotbx/crystal_symmetry_from_any.py", line 17, in <module>
    from iotbx.mrcfile import crystal_symmetry_from_ccp4_map as from_ccp4_map
  File "iotbx/mrcfile/__init__.py", line 6, in <module>
    import mrcfile
ImportError: No module named mrcfile

wouldn't it be nice if the libtbx.refresh warned me that a new dependency was added?

benjaminhwilliams commented 5 years ago

Ooh, just back for the new year and immediately tripped over the missing mrcfile dependency. I like Graeme's suggestion. Happy to do the leg-work if it's considered desirable but too low a priority for your immediate to-do lists.

rjgildea commented 5 years ago

Running the following will fix the immediate issue without requiring a full bootstrap build: $ libtbx.pip install mrcfile

However, wouldn't it be better to make use of the libtbx.pkg_utils dependency feature to ensure dependency updates are handled transparently?

https://github.com/cctbx/cctbx_project/blob/master/libtbx/pkg_utils.py

E.g.: https://github.com/dials/dials/blob/master/libtbx_refresh.py#L25

Adding something like the following to iotbx/libtbx_refresh.py would ensure the correct version of mrcfile is installed:

import libtbx.pkg_utils
libtbx.pkg_utils.require('mrcfile', '>=1.1.0')
graeme-winter commented 5 years ago

This could be helped with the pull request from @ndevenish https://github.com/cctbx/cctbx_project/pull/290

Anthchirp commented 5 years ago

This should be solved now. Thanks to @ndevenish we have libtbx.show_python_dependencies to check if everything is fine and make reconf updates theses things automagically.

Anthchirp commented 5 years ago

assuming the dependencies are correctly declared in iotbx/libtbx_config, which they are not. Different issue though.