MolecularAI / aizynthfinder

A tool for retrosynthetic planning
https://molecularai.github.io/aizynthfinder/
MIT License
562 stars 128 forks source link

Recurring Issue with Jupyter interface #128

Closed aa0929 closed 1 year ago

aa0929 commented 1 year ago

This is the hint given by jupyter

ValueError Traceback (most recent call last) Cell In[1], line 3 1 from aizynthfinder.interfaces import AiZynthApp 2 configfile=r"C:\Users\bo jin\config.yml" ----> 3 app = AiZynthApp(configfile) File ~.conda\envs\aizynth-env\lib\site-packages\aizynthfinder\interfaces\aizynthapp.py:60, in AiZynthApp.init(self, configfile, setup) 57 def init(self, configfile: str, setup: bool = True) -> None: 58 # pylint: disable=used-before-assignment 59 setup_logger(logging.INFO) ---> 60 self.finder = AiZynthFinder(configfile=configfile) 61 self._input: StrDict = dict() 62 self._output: StrDict = dict()

File ~.conda\envs\aizynth-env\lib\site-packages\aizynthfinder\aizynthfinder.py:67, in AiZynthFinder.init(self, configfile, configdict) 64 self._logger = logger() 66 if configfile: ---> 67 self.config = Configuration.from_file(configfile) 68 elif configdict: 69 self.config = Configuration.from_dict(configdict)

File ~.conda\envs\aizynth-env\lib\site-packages\aizynthfinder\context\config.py:129, in Configuration.from_file(cls, filename) 127 txt = txt.replace(item, os.environ[item[2:-1]]) 128 _config = yaml.load(txt, Loader=yaml.SafeLoader) --> 129 return Configuration.from_dict(_config)

File ~.conda\envs\aizynth-env\lib\site-packages\aizynthfinder\context\config.py:98, in Configuration.from_dict(cls, source) 95 src_copy = dict(source) # Make a copy so we can pop items 96 config_obj._update_from_config(src_copy) ---> 98 config_obj.expansion_policy.load_from_config(src_copy.get("policy", {})) 99 config_obj.filter_policy.load_from_config(src_copy.get("filter", {})) 100 config_obj.stock.load_from_config(**src_copy.get("stock", {}))

File ~.conda\envs\aizynth-env\lib\site-packages\aizynthfinder\context\policy\policies.py:113, in ExpansionPolicy.load_from_config(self, **config) 111 for key, policy_spec in files_spec.items(): 112 modelfile, templatefile = policy_spec --> 113 strategy = TemplateBasedExpansionStrategy( 114 key, self._config, source=modelfile, templatefile=templatefile 115 )

SGenheden commented 1 year ago

Hello, Please use a more informative title/description in the future. Also: please provide some details on what you are trying to do with the GUI: what expansion policy are you trying to use? How is your config file looks like?

aa0929 commented 1 year ago

Hello,thankyou for your reply!

Here is my config in Win 11:

policy: files: full_uspto:

SGenheden commented 1 year ago

Thanks for the details. The config looks ok with the expansion policy specification (although the stock path appears to be incorrect).

It appears that there is something else at the end of the error trace, because I have a hard time imagining what is causing a type error at line 113 of policies.py. Could you be so kind and show the full error trace?

aa0929 commented 1 year ago

Of course, I corrected the config file, but the error is unchanged

image

image

SGenheden commented 1 year ago

Aha. This is the issue. In the latest release we dropped support for Tensorflow by defaults. If you now, re-run the "download_public_data" script you should get ONNX files that can be use with the latest version. (Alternatively, you can do something like pip install aizynthfinder[tf] to install the Tensorflow dependencies, but that is much more work).

aa0929 commented 1 year ago

我非常激动的尝试了,之前的错误不在了,但出现新的错误

image image image image

aa0929 commented 1 year ago

(last Chinese comment mean:)

I was very excited to try it and the previous error is gone, but a new one appears

SGenheden commented 1 year ago

The two files you should use for the config are uspto_model.onnx and uspto_templates.csv.gz. The config file should be something like this

policy:
  files:
    uspto:
      - uspto_model.onnx
      - uspto_templates.csv.gz
    ringbreaker:
      - uspto_ringbreaker_model.onnx
      - uspto_ringbreaker_templates.csv.gz
filter:
  files:
    uspto: uspto_filter_model.onnx
stock:
  files:
    zinc: zinc_stock.hdf5
aa0929 commented 1 year ago

Thank you for your guidance, the problem has been solved, after doing what you said, I also encountered a component loading problem, the following when the solution, will be helpful to those who will follow 【jupyter notebook中ipywidgets插件不显示】https://blog.csdn.net/qxqxqzzz/article/details/93810518 【PermissionError: [Errno 13] Permission denied】https://blog.csdn.net/weixin_62888476/article/details/127768242?ops_request_misc=&request_id=&biz_id=102&utm_term=PermissionError:%20%5BErrno%2013%5D%20Pe&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-127768242.142^v91^insert_down1,239^v3^insert_chatgpt&spm=1018.2226.3001.4187 【Loading widget...】https://github.com/jupyter-widgets/ipywidgets/issues/2623

aa0929 commented 1 year ago

thanks!!!