[chimerax-users] ChimeraX tool installationg

Eric Pettersen pett at cgl.ucsf.edu
Thu Feb 4 16:48:29 PST 2021


Hi Yongcheng,
	Looking at your bundle_info.xml, I would recommend naming your command something other than "CL_Tensorflow".  That will be awfully hard to type (even given that you can shorten the name when actually typing it).  I would recommend something that doesn't require using the Shift key to type.  Also, I would declare the Core dependency to be on 1.0 rather than 1.0rc.
	As for the __init__.py, it looks like you are registering the command twice.  Depending on how register_command is declared in cmd.py, that could be causing the error.  Try removing the "cmd.register_command(CL_Tensorflow, logger)" line.  Then the only registration will be the one at the end ("register(CL_Tensorflow, desc, cmd.CL_Tensorflow)").

--Eric


> On Feb 4, 2021, at 2:51 PM, Yongcheng MU <ymu004 at odu.edu> wrote:
> 
> Hi Eric,
> 
> 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.
> 
> Thank you for your time and help.
> 
> Best regards,
> Yongcheng
> 
> On Thu, Feb 4, 2021 at 4:09 PM Eric Pettersen <pett at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>> wrote:
> Hi Yongcheng,
> 	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.
> 	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?:
> 
> from chimerax.core.toolshed import BundleAPI
> 
> class CL_TensorFlowAPI(BundleAPI):
> 
>     @staticmethod
>     def register_command(command_name, logger):
>         from . import cmd
>         cmd.register_command(command_name, logger)
> 
> If it does, then the problem is that you have no cmd.py file in your bundle, producing the error:
> 
> cannot import name 'cmd' from 'chimerax.CL_Tensorflow' (/Users/jackmu/Library/Application Support/ChimeraX/1.1/site-packages/chimerax/CL_Tensorflow/__init__.py))
> 
> Let me know if you need further clarification.
> 
> --Eric
> 
> 	Eric Pettersen
> 	UCSF Computer Graphics Lab
> 
>> On Feb 4, 2021, at 10:45 AM, Yongcheng MU <ymu004 at odu.edu <mailto:ymu004 at odu.edu>> wrote:
>> 
>> Hello,
>> 
>> 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.
>> 
>> 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:
>> 
>> "RuntimeError: delayed command registration for 'CL_Tensorflow' failed (register_command() failed for command CL_Tensorflow in bundle ChimeraX-CL-Tensorflow:
>> cannot import name 'cmd' from 'chimerax.CL_Tensorflow' (/Users/jackmu/Library/Application Support/ChimeraX/1.1/site-packages/chimerax/CL_Tensorflow/__init__.py))
>> 
>> 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
>> raise RuntimeError("delayed command registration for %r failed (%s)" % (cmd_name, e))"
>> 
>> "During handling of the above exception, another exception occurred:
>> 
>> Traceback (most recent call last):
>>   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
>>     cmd.run(cmd_text)
>>   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
>>     self._find_command_name(final, used_aliases=_used_aliases)
>>   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
>>     what.lazy_register(cmd_name)
>>   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
>>     raise RuntimeError("delayed command registration for %r failed (%s)" % (cmd_name, e))
>> RuntimeError: delayed command registration for 'CL_Tensorflow' failed (register_command() failed for command CL_Tensorflow in bundle ChimeraX-CL-Tensorflow:
>> cannot import name 'cmd' from 'chimerax.CL_Tensorflow' (/Users/jackmu/Library/Application Support/ChimeraX/1.1/site-packages/chimerax/CL_Tensorflow/__init__.py))
>> 
>> RuntimeError: delayed command registration for 'CL_Tensorflow' failed (register_command() failed for command CL_Tensorflow in bundle ChimeraX-CL-Tensorflow:
>> cannot import name 'cmd' from 'chimerax.CL_Tensorflow' (/Users/jackmu/Library/Application Support/ChimeraX/1.1/site-packages/chimerax/CL_Tensorflow/__init__.py))
>> 
>> 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
>> raise RuntimeError("delayed command registration for %r failed (%s)" % (cmd_name, e))"
>> 
>> I wonder if you know what's going on here, and how to fix it. Thank you so much for your time. 
>> 
>> Best regards,
>> Yongcheng
>> _______________________________________________
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
>> Manage subscription:
>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users <https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users>
> 
> <bundle_info.xml><__init__.py><Screen Shot 2021-02-04 at 5.41.25 PM.png><Screen Shot 2021-02-04 at 5.42.02 PM.png>_______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20210204/39caeef1/attachment.html>


More information about the ChimeraX-users mailing list