<div dir="ltr">Hi Eric,<div><br></div><div>I really appreciate your quick response. It really helps me a lot to understand it. But I have another question, following your instructions, I modified the _init_.py file but it still holds an error. I attached some related information below.</div><div><br></div><div>Thank you for your time and help.</div><div><br></div><div>Best regards,</div><div>Yongcheng</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 4, 2021 at 4:09 PM Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu">pett@cgl.ucsf.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Hi Yongcheng,<div><span style="white-space:pre-wrap"> </span>You probably know this, but in order to avoid registering all commands at startup, which would involve executing the code from dozens of bundles and make startup really slow, ChimeraX uses information from the Toolshed to know which bundles implement which commands and only when the time comes to actually execute a command does it invoke the bundle's code that fully registers the command, which then allows ChimeraX to know what arguments and keywords the command allows and what function the command executes so that it can parse the command text and call that function.</div><div><span style="white-space:pre-wrap"> </span>So all that error text you got is indicating that there is an error in your command-registration function. ChimeraX asks you to register your command by calling the register_command() method of your BundleAPI subclass. Does the implementation of register_command() in your __init__.py look something like this?:</div><div><br></div><div>from chimerax.core.toolshed import BundleAPI<br><br>class CL_TensorFlowAPI(BundleAPI):<br><br> @staticmethod<br> def register_command(command_name, logger):<br> from . import cmd<br> cmd.register_command(command_name, logger)<br><br>If it does, then the problem is that you have no cmd.py file in your bundle, producing the error:</div><div><br></div><div>cannot import name 'cmd' from 'chimerax.CL_Tensorflow' (/Users/jackmu/Library/Application Support/ChimeraX/1.1/site-packages/chimerax/CL_Tensorflow/__init__.py))</div><div><br></div><div>Let me know if you need further clarification.</div><div><br></div><div><div>--Eric</div><div><br></div><div><span style="white-space:pre-wrap"> </span>Eric Pettersen</div><div><span style="white-space:pre-wrap"> </span>UCSF Computer Graphics Lab</div></div><div><div><br><blockquote type="cite"><div>On Feb 4, 2021, at 10:45 AM, Yongcheng MU <<a href="mailto:ymu004@odu.edu" target="_blank">ymu004@odu.edu</a>> wrote:</div><br><div><div dir="ltr">Hello,<div><br></div><div>Hope you are doing well. This is Yongcheng. I am writing this email because I am trying to install a Deep learning tool in ChimeraX, but I have some issues about it.</div><div><br></div><div>I built and installed my code following the steps on the Chimera Guide website. I installed my code successfully, but when I run using command that I created, it hold some errors:</div><div><br></div><div><font face="times new roman, serif"><i>"<span style="white-space:pre-wrap">RuntimeError: delayed command registration for 'CL_Tensorflow' failed (register_command() failed for command CL_Tensorflow in bundle ChimeraX-CL-Tensorflow:</span></i></font></div><div style="margin:0px;white-space:pre-wrap"><font face="times new roman, serif"><i>cannot import name 'cmd' from 'chimerax.CL_Tensorflow' (/Users/jackmu/Library/Application Support/ChimeraX/1.1/site-packages/chimerax/CL_Tensorflow/__init__.py))<br><br>File "/Users/jackmu/Desktop/ChimeraX-1.1.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2142, in lazy_register<br></i></font></div><div><font face="times new roman, serif"><i><span style="white-space:pre-wrap">raise RuntimeError("delayed command registration for %r failed (%s)" % (cmd_name, e))</span>"</i></font></div><div><font face="times new roman, serif"><i><br></i></font></div><div><font face="times new roman, serif"><i>"During handling of the above exception, another exception occurred:</i></font></div><font face="times new roman, serif"><i><br>Traceback (most recent call last):<br> File "/Users/jackmu/Desktop/ChimeraX-1.1.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/cmd_line/tool.py", line 275, in execute<br> cmd.run(cmd_text)<br> File "/Users/jackmu/Desktop/ChimeraX-1.1.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2746, in run<br> self._find_command_name(final, used_aliases=_used_aliases)<br> File "/Users/jackmu/Desktop/ChimeraX-1.1.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2489, in _find_command_name<br> what.lazy_register(cmd_name)<br> File "/Users/jackmu/Desktop/ChimeraX-1.1.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2142, in lazy_register<br> raise RuntimeError("delayed command registration for %r failed (%s)" % (cmd_name, e))<br>RuntimeError: delayed command registration for 'CL_Tensorflow' failed (register_command() failed for command CL_Tensorflow in bundle ChimeraX-CL-Tensorflow:<br>cannot import name 'cmd' from 'chimerax.CL_Tensorflow' (/Users/jackmu/Library/Application Support/ChimeraX/1.1/site-packages/chimerax/CL_Tensorflow/__init__.py))<br><br>RuntimeError: delayed command registration for 'CL_Tensorflow' failed (register_command() failed for command CL_Tensorflow in bundle ChimeraX-CL-Tensorflow:<br>cannot import name 'cmd' from 'chimerax.CL_Tensorflow' (/Users/jackmu/Library/Application Support/ChimeraX/1.1/site-packages/chimerax/CL_Tensorflow/__init__.py))<br><br>File "/Users/jackmu/Desktop/ChimeraX-1.1.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2142, in lazy_register<br></i></font><div><font face="times new roman, serif"><i>raise RuntimeError("delayed command registration for %r failed (%s)" % (cmd_name, e))"</i></font></div><div><br></div><div>I wonder if you know what's going on here, and how to fix it. Thank you so much for your time. </div><div><br></div><div>Best regards,</div><div>Yongcheng</div></div>
_______________________________________________<br>ChimeraX-users mailing list<br><a href="mailto:ChimeraX-users@cgl.ucsf.edu" target="_blank">ChimeraX-users@cgl.ucsf.edu</a><br>Manage subscription:<br><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" target="_blank">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br></div></blockquote></div><br></div></div></blockquote></div>