Hello,
We followed the official tutorial (create an environment and run pip install "syntheseus[all]" to install synthesus on Mac M1. The first problem was that the environment_full.yaml was given only for the GPUs cases, so we adapted it the following way:
channels:
- defaults
- conda-forge
- pytorch
- dglteam # LocalRetro, RetroKNN
- pyg # RetroKNN
dependencies:
- python==3.8.20 # MHNreact
Installing the needed packages additionally when needed to run the models:
torch 2.1.2
rdkit 2024.3.5
pytorch-lightning 1.9.4
dgl 0.9.1
...
When the problems with package dependencies were solved, there was the following error when we tried to run the tutorial code:
Traceback (most recent call last):
File "test.py", line 39, in <module>
evaluate_with_syntheseus("C1CCCCC1")
File "test.py", line 31, in evaluate_with_syntheseus
model = LocalRetroModel()
File "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/local_retro.py", line 32, in __init__
super().__init__(*args, **kwargs)
File "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/base.py", line 23, in __init__
self.model_dir = Path(model_dir or self.get_default_model_dir())
File "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/base.py", line 27, in get_default_model_dir
model_dir = get_default_model_dir_from_cache(self.name, is_forward=self.is_forward())
File "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/base.py", line 39, in name
return self.__class__.__name__.removesuffix("Model")
AttributeError: 'str' object has no attribute 'removesuffix'
To solve this in "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/base.py" the lines
@property
def name(self) -> str:
return self.__class__.__name__.removesuffix("Model")
were changed to
@property
def name(self) -> str:
def remove_suffix(src, suffix):
if suffix and src.endswith(suffix):
return src[:-len(suffix)]
return src[:]
return remove_suffix(self.__class__.__name__, "Model")
Also, a few errors emerged when running the models:
- RootAlignedModel
"""
Traceback (most recent call last):
File "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/root_aligned/score.py", line 23, in canonicalize_smiles_clear_map
mol = Chem.MolFromSmiles(smiles,sanitize=not opt.synthon)
NameError: name 'opt' is not defined
"""
The above exception was the direct cause of the following exception:
NameError Traceback (most recent call last)
Cell In[17], [line 13](vscode-notebook-cell:?execution_count=17&line=13)
[11](vscode-notebook-cell:?execution_count=17&line=11) test_mol = Molecule("Cc1ccc(-c2ccc(C)cc2)cc1")
[12](vscode-notebook-cell:?execution_count=17&line=12) model = RootAlignedModel()
---> [13](vscode-notebook-cell:?execution_count=17&line=13) [results] = model([test_mol], num_results=5)
[14](vscode-notebook-cell:?execution_count=17&line=14) print_results(results)
File ~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/interface/models.py:110, in ReactionModel.__call__(self, inputs, num_results)
[108](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/interface/models.py:108) inputs_not_in_cache = list({inp for inp in inputs if (inp, num_results) not in self._cache})
...
[769](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/multiprocessing/pool.py:769) return self._value
[770](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/multiprocessing/pool.py:770) else:
--> [771](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/multiprocessing/pool.py:771) raise self._value
NameError: name 'opt' is not defined
- ChemformerModel
TypeError Traceback (most recent call last)
Cell In[19], [line 13](vscode-notebook-cell:?execution_count=19&line=13)
[11](vscode-notebook-cell:?execution_count=19&line=11) test_mol = Molecule("Cc1ccc(-c2ccc(C)cc2)cc1")
[12](vscode-notebook-cell:?execution_count=19&line=12) model = ChemformerModel()
---> [13](vscode-notebook-cell:?execution_count=19&line=13) [results] = model([test_mol], num_results=5)
[14](vscode-notebook-cell:?execution_count=19&line=14) print_results(results)
File ~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/interface/models.py:110, in ReactionModel.__call__(self, inputs, num_results)
[108](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/interface/models.py:108) inputs_not_in_cache = list({inp for inp in inputs if (inp, num_results) not in self._cache})
[109](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/interface/models.py:109) if len(inputs_not_in_cache) > 0:
--> [110](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/interface/models.py:110) new_rxns = self._get_reactions(inputs=inputs_not_in_cache, num_results=num_results)
[111](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/interface/models.py:111) assert len(new_rxns) == len(inputs_not_in_cache)
[112](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/interface/models.py:112) for inp, rxns in zip(inputs_not_in_cache, new_rxns):
File ~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:130, in ChemformerModel._get_reactions(self, inputs, num_results)
[127](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:127) with torch.no_grad(), warnings.catch_warnings():
[128](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:128) warnings.filterwarnings("ignore", message="__floordiv__ is deprecated")
--> [130](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:130) smiles_batch, batch_log_likelihoods = self.model.sample_molecules(
[131](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:131) device_batch, sampling_alg="beam"
[132](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:132) )
[134](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:134) # Choose processing function (controls reaction types).
[135](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:135) # `type: ignore[assignment]` statements are because link between is_forward/is_backward
[136](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:136) # and [InputType, ReactionType] is not visible to mypy.
[137](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/chemformer.py:137) if self.is_forward():
...
-> [1527](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/torch/nn/modules/module.py:1527) return forward_call(*args, **kwargs)
[1529](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/torch/nn/modules/module.py:1529) try:
[1530](https://file+.vscode-resource.vscode-cdn.net/Users/Ulia/Desktop/aalto_summer_2025/code/retrosynthesis-dataset/~/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/torch/nn/modules/module.py:1530) result = None
TypeError: forward() got an unexpected keyword argument 'is_causal'
I didn't check all models for now. But an additional environment.yaml file for the CPU environments would be helpful.
Hello,
We followed the official tutorial (create an environment and run
pip install "syntheseus[all]"to install synthesus on Mac M1. The first problem was that the environment_full.yaml was given only for the GPUs cases, so we adapted it the following way:Installing the needed packages additionally when needed to run the models:
When the problems with package dependencies were solved, there was the following error when we tried to run the tutorial code:
To solve this in "/Users/Ulia/miniconda3/envs/syntheseus_ver_2/lib/python3.8/site-packages/syntheseus/reaction_prediction/inference/base.py" the lines
were changed to
Also, a few errors emerged when running the models:
I didn't check all models for now. But an additional environment.yaml file for the CPU environments would be helpful.