microsoft / syntheseus

Package for Retrosynthetic Planning
https://microsoft.github.io/syntheseus/
MIT License
116 stars 15 forks source link

pytest failures (most likely my environment) #106

Open DocMinus opened 3 days ago

DocMinus commented 3 days ago

When running the pytest I get a number of Fs. Most likely due to the install? Had to do some manual hands-on, the out-of-box pip install didn't work. I am running on WSL2 Unbuntu 22 (with Nvidia GPU). What I did differently after the first pip install due to errors after bailing out due to torch_scatter:

mamba install -c pyg -c conda-forge torch-scatter pip install "syntheseus[all]" pip install typing-extensions==4.6.0 (since 4.5.0 not combatible)

the first run of tests conked out due to graphviz? Thus I manually installed that via sudo apt install graphviz and rerun pip install "syntheseus[all]" which reinstalled typing_extenstions 4.5.0. Running pytests then led to this

syntheseus/tests/cli/test_cli.py ..F...F..F...F..F...F..F...F.                                                                                                                                                                                                                                                        [  5%]
syntheseus/tests/cli/test_eval_single_step.py .............................                                                                                                                                                                                                                                           [ 11%]
syntheseus/tests/cli/test_search.py .                                                                                                                                                                                                                                                                                 [ 11%]
syntheseus/tests/interface/test_bag.py .                                                                                                                                                                                                                                                                              [ 11%]
syntheseus/tests/interface/test_models.py ......                                                                                                                                                                                                                                                                      [ 12%]
syntheseus/tests/interface/test_molecule.py .........                                                                                                                                                                                                                                                                 [ 14%]
syntheseus/tests/interface/test_reaction.py .....                                                                                                                                                                                                                                                                     [ 15%]
syntheseus/tests/interface/test_toy_models.py ..                                                                                                                                                                                                                                                                      [ 15%]
syntheseus/tests/reaction_prediction/chem/test_utils.py ...                                                                                                                                                                                                                                                           [ 16%]
syntheseus/tests/reaction_prediction/data/test_dataset.py ..............                                                                                                                                                                                                                                              [ 19%]
syntheseus/tests/reaction_prediction/inference/test_models.py ..F.......F.....F.......F...                                                                                                                                                                                                                            [ 24%]
syntheseus/tests/reaction_prediction/utils/test_misc.py ....                                                                                                                                                                                                                                                          [ 25%]
syntheseus/tests/reaction_prediction/utils/test_parallel.py ..                                                                                                                                                                                                                                                        [ 25%]
syntheseus/tests/search/algorithms/test_best_first.py .............................F.......                                                                                                                                                                                                                           [ 32%]
syntheseus/tests/search/algorithms/test_breadth_first.py ............................................................................                                                                                                                                                                                 [ 47%]
syntheseus/tests/search/algorithms/test_mcts.py .............................................                                                                                                                                                                                                                         [ 55%]
syntheseus/tests/search/algorithms/test_pdvn.py .......................................                                                                                                                                                                                                                               [ 63%]
syntheseus/tests/search/algorithms/test_random.py ..........................ss..............................ss....                                                                                                                                                                                                    [ 75%]
syntheseus/tests/search/analysis/test_diversity.py ..................                                                                                                                                                                                                                                                 [ 79%]
syntheseus/tests/search/analysis/test_route_extraction.py .......................                                                                                                                                                                                                                                     [ 83%]
syntheseus/tests/search/graph/test_andor.py ...............                                                                                                                                                                                                                                                           [ 86%]
syntheseus/tests/search/graph/test_message_passing.py .......                                                                                                                                                                                                                                                         [ 87%]
syntheseus/tests/search/graph/test_molset.py ...........                                                                                                                                                                                                                                                              [ 90%]
syntheseus/tests/search/graph/test_route.py .                                                                                                                                                                                                                                                                         [ 90%]
syntheseus/tests/search/graph/test_standardization.py ..                                                                                                                                                                                                                                                              [ 90%]
syntheseus/tests/search/node_evaluation/test_common.py .....................................                                                                                                                                                                                                                          [ 97%]
syntheseus/tests/search/test_mol_inventory.py ...                                                                                                                                                                                                                                                                     [ 98%]
syntheseus/tests/search/test_visualization.py ........./home/a/mambaforge/envs/syntheseus-full/lib/python3.9/site-packages/coverage/control.py:892: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")

WARNING: Failed to generate report: No data to report.

/home/a/mambaforge/envs/syntheseus-full/lib/python3.9/site-packages/pytest_cov/plugin.py:329: CovReportWarning: Failed to generate report: No data to report.

and way too much text to copy/paste here. many, not all, seem to refere to torch_scatter where errors like are shown:

OSError: /home/a/mambaforge/envs/syntheseus-full/lib/python3.9/site-packages/torch_scatter/_version_cuda.so: undefined symbol: _ZN3c106detail14torchCheckFailEPKcS2_jRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

another recurring error:

    def _call_impl(self, *args, **kwargs):
        forward_call = (self._slow_forward if torch._C._get_tracing_state() else self.forward)
        # If we don't have any hooks, we want to skip the rest of the logic in
        # this function, and just call forward.
        if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
                or _global_backward_pre_hooks or _global_backward_hooks
                or _global_forward_hooks or _global_forward_pre_hooks):
>           return forward_call(*args, **kwargs)
E           TypeError: forward() got an unexpected keyword argument 'is_causal'

../mambaforge/envs/syntheseus-full/lib/python3.9/site-packages/torch/nn/modules/module.py:1527: TypeError

any ideas?

AustinT commented 2 days ago

Hello @DocMinus, it looks like your issues are related to the installation of torch_scatter. This package seems to always cause problems (I've had it fail before myself). I just tried a fresh re-install with python 3.10 and the install of torch scatter failed for me.

I'm not sure there is an easy solution to this. However, torch scatter is only required by a small subset of the single-step models (retro-knn, maybe some other indirectly). Unless you want to use that specific model you don't actually need to install torch scatter. For example, I ran

pip install "syntheseus[chemformer,graph2edits,local-retro,megan,mhn-react]"

on a linux system (not WSL though) and all the tests passed for me (admittedly, the CLI tests are skipped if not all the single-step models are installed). Could that help get things working for you?

AustinT commented 2 days ago

Separate to above, @kmaziarz does "pip install syntheseus[all]" work for you on WSL (I no longer have a windows computer to test it on). If torch-scatter is causing problems, should we change the dependencies in any way to make most tests run without it?

DocMinus commented 1 day ago

thanks. I will try some of the above suggestions. I am guessing I don't have to bother testing this on Mac Silicone?