DeepGraphLearning / torchdrug

A powerful and flexible machine learning platform for drug discovery
https://torchdrug.ai/
Apache License 2.0
1.44k stars 200 forks source link

subprocess.CalledProcessError: Command '['c++', '-v']' returned non-zero exit status 1. #245

Open Filco306 opened 8 months ago

Filco306 commented 8 months ago

Hi,

I am trying to run A*Net which uses your package. I am running into the following error when trying to compile functional.generalized_rspmm.

(astarnet) [AStarNet]$ python3 script/run.py -c config/transductive/fb15k237_astarnet.yaml --gpus [0]
12:22:42   Config file: config/transductive/fb15k237_astarnet.yaml
12:22:42   {'output_dir': '~/experiments/', 'dataset': {'class': 'FB15k237', 'path': '~/datasets/knowledge_graphs/'}, 'task': {'class': 'KnowledgeGraphCompletion', 'model': {'class': 'AStarNet', 'base_layer': {'class': 'NBFNetConv', 'input_dim': 32, 'output_dim': 32, 'query_input_dim': 32, 'message_func': 'distmult', 'aggregate_func': 'pna', 'layer_norm': True, 'dependent': True}, 'num_layer': 6, 'short_cut': True, 'remove_one_hop': True, 'node_ratio': 0.1}, 'criterion': 'bce', 'num_negative': 32, 'strict_negative': True, 'adversarial_temperature': 0.5, 'sample_weight': False, 'full_batch_eval': True}, 'optimizer': {'class': 'Adam', 'lr': 0.005}, 'engine': {'gpus': [0], 'batch_size': 64}, 'train': {'num_epoch': 20}, 'metric': 'mrr'}
Loading ~/datasets/knowledge_graphs/fb15k237_train.txt: 100%|███████████████| 272115/272115 [00:00<00:00, 650901.52it/s]
Loading ~/datasets/knowledge_graphs/fb15k237_valid.txt: 100%|█████████████████| 17535/17535 [00:00<00:00, 638147.35it/s]
Loading ~/datasets/knowledge_graphs/fb15k237_test.txt: 100%|██████████████████| 20466/20466 [00:00<00:00, 645622.12it/s]
12:22:43   FB15k237(
  #entity: 14541
  #relation: 237
  #triplet: 310116
)
12:22:43   #train: 272115, #valid: 17535, #test: 20466
Traceback (most recent call last):
  File "script/run.py", line 62, in <module>
    solver = util.build_solver(cfg, dataset)
  File "~/KGCBaselines/AStarNet/reasoning/util.py", line 107, in build_solver
    task = core.Configurable.load_config_dict(cfg.task)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/core/core.py", line 269, in load_config_dict
    v = _Configurable.load_config_dict(v)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/core/core.py", line 269, in load_config_dict
    v = _Configurable.load_config_dict(v)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/core/core.py", line 277, in load_config_dict
    return cls(**new_config)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/core/core.py", line 296, in wrapper
    return init(self, *args, **kwargs)
  File "~/KGCBaselines/AStarNet/reasoning/layer.py", line 55, in __init__
    functional.generalized_rspmm(adjacency, relation_input, input, sum="add", mul="mul")
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/layers/functional/spmm.py", line 378, in generalized_rspmm
    return Function.apply(sparse.coalesce(), relation, input)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/layers/functional/spmm.py", line 174, in forward
    forward = spmm.rspmm_add_mul_forward_cpu
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/utils/torch.py", line 26, in __getattr__
    return getattr(self.module, key)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/utils/decorator.py", line 102, in __get__
    result = self.func(obj)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torchdrug/utils/torch.py", line 32, in module
    self.verbose, **self.kwargs)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1214, in load
    keep_intermediates=keep_intermediates)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1435, in _jit_compile
    is_standalone=is_standalone)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1511, in _write_ninja_file_and_build_library
    get_compiler_abi_compatibility_and_version(compiler)
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 324, in get_compiler_abi_compatibility_and_version
    if not check_compiler_ok_for_platform(compiler):
  File "~/.conda/envs/astarnet/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 287, in check_compiler_ok_for_platform
    version_string = subprocess.check_output([compiler, '-v'], stderr=subprocess.STDOUT).decode(*SUBPROCESS_DECODE_ARGS)
  File "~/.conda/envs/astarnet/lib/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "~/.conda/envs/astarnet/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['c++', '-v']' returned non-zero exit status 1.

Package versions:

Python 3.7.16
torchdrug 0.2.1
torch 1.2.1

I am trying to find the error, but I can't seem to find it. Appreciate any help here. Thank you!

Best Filip

chrisvdwerf commented 7 months ago

Could you try to execute c++ --version and gcc --version in your terminal? Maybe upgrading / installing gcc drivers could do the trick.