Opened 2 years ago

Last modified 2 years ago

#10027 assigned task

Installing a python module at plugin start/load

Reported by: barry.dezonia@… Owned by: Zach Pearson
Priority: normal Milestone:
Component: Third Party Version:
Keywords: Cc: Greg Couch, Tom Goddard, Eric Pettersen
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description (last modified by Tom Goddard)

This might not be a bug but it is definitely an email for the developers.

I am trying to build a plugin with a nice user experience. One aspect of that is that it will look for a plugin (traj2nmr) and if it is not installed it will install it. This was siggested by one of the developers some onths ago.

My process is kind of working. I am using a daily build (from June that I am loathe to update since all other aspects of our project works with it and I am the sole developer).

Anyhow my code installs the plugin and it ends up in /home/bdezonia/.local/share/ChimeraX/1.7/lib/python/traj2nmr-0.0.1-py3.9.egg.

Now when I start my app it can't import traj2nmr even after it just successfully installed. Python must not be looking in that directory above.

Someone told me to install tra2nmr in the chimerax.apps.user_dir. Maybe that is /home/bdezonia/.local/share/ChimeraX/1.7/site-packages/? Anyhow traj2nmr is not in there. And I'm not sure I am accurate about the value of chimerax.apps.user_dir I just mentioned.

It is not here either: /lib/ucsf-chimerax-daily/lib/python3.9. (Yes, I know 3.11 is the version expected but it was not back in June I think). We can't install here because the app installs traj2nmr at plugin startup and needs a directory the current user has permissions to write to.

Can you tell me where my traj2nmr package should get installed to so that it can be found by ChimeraX (e.g. its python I think)? The traj2nmr module is old and uses easyinstall and a "python setup.py install" approach. I don't have a lot of control where traj2nmr gets installed once it is running.

Any pointers appreciated. Let me know what other info you might need to help come up with a solution. Thanks.

Change History (11)

comment:1 by Tom Goddard, 2 years ago

Cc: Greg Couch Tom Goddard Eric Pettersen added
Component: UnassignedThird Party
Description: modified (diff)
Owner: set to Zach Pearson
Platform: all
Project: ChimeraX
Status: newassigned
Type: defecttask

Hi Barry,

Could you tell us the command you used to install traj2nmr. If you used the ChimeraX "pip install" there have been changes to make that install in the correct location after June. While you may not want to update your ChimeraX, if you are trying for "good user experience" that probably means it needs to work in current ChimeraX versions and the soon to be released ChimeraX 1.7, not just one old version from June. So I would suggest trying your plugin with the current daily build.

To debug why you cannot import traj2nmr how about starting the ChimeraX Python shell, menu Tools / General / Shell and see what the Python search path is

import sys
sys.path

Zach can give more advice.

Tom

comment:2 by Zach Pearson, 2 years ago

I would clear out /home/bdezonia/.local/share/ChimeraX/1.7 and get a more recent daily build. Greg and I have been working out how ChimeraX installs and finds its packages for the upcoming release, so the behavior will be closer to the actual behavior in 1.7 and if it _still_ doesn't work we need to know so we can fix it.

comment:3 by Eric Pettersen, 2 years ago

I believe this in reference to this thread: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/thread/2JK2LPAWFZSP2WM6IQEARE62GFS5KQV4/#2JK2LPAWFZSP2WM6IQEARE62GFS5KQV4 where I suggested various ways to install traj2nmr into ChimeraX's user plugin directory.

comment:4 by Eric Pettersen, 2 years ago

Well, not really "user plugin directory" but rather where ChimeraX's Python looks for user-installed modules.

comment:5 by barry.dezonia@…, 2 years ago

OK. Thanks for all the feedback. I will start working on the issues a piece at a time.

It took me a while to be able to produce the install program string. It is a script I run and it is doing this:

cd /home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-packages/chimerax/tut_tool_qt/Installable/traj2nmr; /usr/bin/chimerax-daily --nogui --script 'setup.py install --home="/home/bdezonia/.local/share/ChimeraX/1.7"' --exit

tut_tool_qt is my app and installable is a directory in it where I keep the traj2nmr source to be able to install from at runtime.

I did install yesterday's daily build. When I install my plugin it says "No bundles were installed" but it also says "Installed ChimeraX-BphonTool (0.4)" which is my plugin. The command is present in the Tools :: General  menu. When I run the plugin it is trying to load and in my code where it tries to import traj2nmr it says it can't find it. But just a line or two earlier it is getting installed and I can see that code is being run because I can instrument the call. That is the "cd /home/bdezonia-blah-blah-blah ..." I mentioned above. Trying to uninstall then says "No change in list of installed bundles". And the plugin is still in Tools::General.

Note that if I install my plugin and then exit and then run it again it can't find traj2nmr. So it is not the case that some internal tracking variable has not been updated by the at-runtime plugin install.

Maybe the plugin is still in the Tools menu because it might have cruft from an earlier installation? When I installed the daily build I had to do some hand uninstallation. Before reinstall I had cleared /home/bdezonia/.local/share/ChimeraX/1.7 though.

Note that traj2nmr's egg file looks to be at:
 /home/bdezonia/.local/share/ChimeraX/1.7/lib/python/traj2nmr-0.0.1-py3.11.egg

That's a lot of information for you to take in. I am going to continue doing some of your suggestions but please critique any issues you see. Thanks.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Friday, October 20, 2023 11:55 AM
To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA <barry.dezonia@wisc.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #10027: Installing a python module at plugin start/load

#10027: Installing a python module at plugin start/load
--------------------------------------+--------------------------
          Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
              Type:  task             |     Status:  assigned
          Priority:  normal           |  Milestone:
         Component:  Third Party      |    Version:
        Resolution:                   |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+--------------------------
Comment (by pett):

 Well, not really "user plugin directory" but rather where ChimeraX's
 Python looks for user-installed modules.
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:4>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:6 by barry.dezonia@…, 2 years ago

In response to the system paths chimerax is seeing here is the output from a python shell in chimerax:

import sys

sys.path
Out[2]:
['/home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-packages',
 '/usr/lib/ucsf-chimerax-daily/lib/python311.zip',
 '/usr/lib/ucsf-chimerax-daily/lib/python3.11',
 '/usr/lib/ucsf-chimerax-daily/lib/python3.11/lib-dynload',
 '/usr/lib/ucsf-chimerax-daily/lib/python3.11/site-packages']

________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Friday, October 20, 2023 1:17 PM
To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA <barry.dezonia@wisc.edu>
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #10027: Installing a python module at plugin start/load

#10027: Installing a python module at plugin start/load
--------------------------------------+--------------------------
          Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
              Type:  task             |     Status:  assigned
          Priority:  normal           |  Milestone:
         Component:  Third Party      |    Version:
        Resolution:                   |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+--------------------------
Comment (by barry.dezonia@…):

 {{{
 OK. Thanks for all the feedback. I will start working on the issues a
 piece at a time.

 It took me a while to be able to produce the install program string. It is
 a script I run and it is doing this:

 cd /home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-
 packages/chimerax/tut_tool_qt/Installable/traj2nmr; /usr/bin/chimerax-
 daily --nogui --script 'setup.py install
 --home="/home/bdezonia/.local/share/ChimeraX/1.7"' --exit

 tut_tool_qt is my app and installable is a directory in it where I keep
 the traj2nmr source to be able to install from at runtime.

 I did install yesterday's daily build. When I install my plugin it says
 "No bundles were installed" but it also says "Installed ChimeraX-BphonTool
 (0.4)" which is my plugin. The command is present in the Tools :: General
 menu. When I run the plugin it is trying to load and in my code where it
 tries to import traj2nmr it says it can't find it. But just a line or two
 earlier it is getting installed and I can see that code is being run
 because I can instrument the call. That is the "cd /home/bdezonia-blah-
 blah-blah ..." I mentioned above. Trying to uninstall then says "No change
 in list of installed bundles". And the plugin is still in Tools::General.

 Note that if I install my plugin and then exit and then run it again it
 can't find traj2nmr. So it is not the case that some internal tracking
 variable has not been updated by the at-runtime plugin install.

 Maybe the plugin is still in the Tools menu because it might have cruft
 from an earlier installation? When I installed the daily build I had to do
 some hand uninstallation. Before reinstall I had cleared
 /home/bdezonia/.local/share/ChimeraX/1.7 though.

 Note that traj2nmr's egg file looks to be at:
 /home/bdezonia/.local/share/ChimeraX/1.7/lib/python/traj2nmr-0.0.1-py3.11.egg

 That's a lot of information for you to take in. I am going to continue
 doing some of your suggestions but please critique any issues you see.
 Thanks.
 ________________________________
 From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
 Sent: Friday, October 20, 2023 11:55 AM
 To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA
 <barry.dezonia@wisc.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
 Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu
 <gregc@cgl.ucsf.edu>
 Subject: Re: [ChimeraX] #10027: Installing a python module at plugin
 start/load

 #10027: Installing a python module at plugin start/load
 --------------------------------------+--------------------------
           Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
               Type:  task             |     Status:  assigned
           Priority:  normal           |  Milestone:
          Component:  Third Party      |    Version:
         Resolution:                   |   Keywords:
         Blocked By:                   |   Blocking:
 Notify when closed:                   |   Platform:  all
            Project:  ChimeraX         |
 --------------------------------------+--------------------------
 Comment (by pett):

  Well, not really "user plugin directory" but rather where ChimeraX's
  Python looks for user-installed modules.
 --
 Ticket URL:
 <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:4>
 ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
 ChimeraX Issue Tracker
 }}}
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:5>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:7 by barry.dezonia@…, 2 years ago

Using setuptools flags (--user --prefix=) the setup.py program the setuptools output is saying:

"Copying traj2nmr-0.0.1-py3.11.egg to /home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-packages"

This looks perfect.

If I run once it cannot import traj2nmr. But if I exit and run a second time it does find it. I think this part of the mystery is fixed.

The remaining issues are why does my plugin say no bundles added and my uninstall result say my plugin was not installed. All the while I can run my plugin.


________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Friday, October 20, 2023 1:41 PM
To: BARRY E DEZONIA <barry.dezonia@wisc.edu>; zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #10027: Installing a python module at plugin start/load

#10027: Installing a python module at plugin start/load
--------------------------------------+--------------------------
          Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
              Type:  task             |     Status:  assigned
          Priority:  normal           |  Milestone:
         Component:  Third Party      |    Version:
        Resolution:                   |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+--------------------------
Comment (by barry.dezonia@…):

 {{{
 In response to the system paths chimerax is seeing here is the output from
 a python shell in chimerax:

 import sys

 sys.path
 Out[2]:
 ['/home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-packages',
  '/usr/lib/ucsf-chimerax-daily/lib/python311.zip',
  '/usr/lib/ucsf-chimerax-daily/lib/python3.11',
  '/usr/lib/ucsf-chimerax-daily/lib/python3.11/lib-dynload',
  '/usr/lib/ucsf-chimerax-daily/lib/python3.11/site-packages']

 ________________________________
 From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
 Sent: Friday, October 20, 2023 1:17 PM
 To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA
 <barry.dezonia@wisc.edu>
 Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu
 <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
 Subject: Re: [ChimeraX] #10027: Installing a python module at plugin
 start/load

 #10027: Installing a python module at plugin start/load
 --------------------------------------+--------------------------
           Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
               Type:  task             |     Status:  assigned
           Priority:  normal           |  Milestone:
          Component:  Third Party      |    Version:
         Resolution:                   |   Keywords:
         Blocked By:                   |   Blocking:
 Notify when closed:                   |   Platform:  all
            Project:  ChimeraX         |
 --------------------------------------+--------------------------
 Comment (by barry.dezonia@…):

  {{{
  OK. Thanks for all the feedback. I will start working on the issues a
  piece at a time.

  It took me a while to be able to produce the install program string. It
 is
  a script I run and it is doing this:

  cd /home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-
  packages/chimerax/tut_tool_qt/Installable/traj2nmr; /usr/bin/chimerax-
  daily --nogui --script 'setup.py install
  --home="/home/bdezonia/.local/share/ChimeraX/1.7"' --exit

  tut_tool_qt is my app and installable is a directory in it where I keep
  the traj2nmr source to be able to install from at runtime.

  I did install yesterday's daily build. When I install my plugin it says
  "No bundles were installed" but it also says "Installed ChimeraX-
 BphonTool
  (0.4)" which is my plugin. The command is present in the Tools :: General
  menu. When I run the plugin it is trying to load and in my code where it
  tries to import traj2nmr it says it can't find it. But just a line or two
  earlier it is getting installed and I can see that code is being run
  because I can instrument the call. That is the "cd /home/bdezonia-blah-
  blah-blah ..." I mentioned above. Trying to uninstall then says "No
 change
  in list of installed bundles". And the plugin is still in Tools::General.

  Note that if I install my plugin and then exit and then run it again it
  can't find traj2nmr. So it is not the case that some internal tracking
  variable has not been updated by the at-runtime plugin install.

  Maybe the plugin is still in the Tools menu because it might have cruft
  from an earlier installation? When I installed the daily build I had to
 do
  some hand uninstallation. Before reinstall I had cleared
  /home/bdezonia/.local/share/ChimeraX/1.7 though.

  Note that traj2nmr's egg file looks to be at:
 /home/bdezonia/.local/share/ChimeraX/1.7/lib/python/traj2nmr-0.0.1-py3.11.egg

  That's a lot of information for you to take in. I am going to continue
  doing some of your suggestions but please critique any issues you see.
  Thanks.
  ________________________________
  From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
  Sent: Friday, October 20, 2023 11:55 AM
  To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA
  <barry.dezonia@wisc.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
  Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu
  <gregc@cgl.ucsf.edu>
  Subject: Re: [ChimeraX] #10027: Installing a python module at plugin
  start/load

  #10027: Installing a python module at plugin start/load
  --------------------------------------+--------------------------
            Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
                Type:  task             |     Status:  assigned
            Priority:  normal           |  Milestone:
           Component:  Third Party      |    Version:
          Resolution:                   |   Keywords:
          Blocked By:                   |   Blocking:
  Notify when closed:                   |   Platform:  all
             Project:  ChimeraX         |
  --------------------------------------+--------------------------
  Comment (by pett):

   Well, not really "user plugin directory" but rather where ChimeraX's
   Python looks for user-installed modules.
  --
  Ticket URL:
  <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:4>
  ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
  ChimeraX Issue Tracker
  }}}
 --
 Ticket URL:
 <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:5>
 ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
 ChimeraX Issue Tracker
 }}}
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:6>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:8 by barry.dezonia@…, 2 years ago

We can open a new bug if you like.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Friday, October 20, 2023 2:42 PM
To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA <barry.dezonia@wisc.edu>
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #10027: Installing a python module at plugin start/load

#10027: Installing a python module at plugin start/load
--------------------------------------+--------------------------
          Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
              Type:  task             |     Status:  assigned
          Priority:  normal           |  Milestone:
         Component:  Third Party      |    Version:
        Resolution:                   |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+--------------------------
Comment (by barry.dezonia@…):

 {{{
 Using setuptools flags (--user --prefix=) the setup.py program the
 setuptools output is saying:

 "Copying traj2nmr-0.0.1-py3.11.egg to
 /home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-packages"

 This looks perfect.

 If I run once it cannot import traj2nmr. But if I exit and run a second
 time it does find it. I think this part of the mystery is fixed.

 The remaining issues are why does my plugin say no bundles added and my
 uninstall result say my plugin was not installed. All the while I can run
 my plugin.


 ________________________________
 From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
 Sent: Friday, October 20, 2023 1:41 PM
 To: BARRY E DEZONIA <barry.dezonia@wisc.edu>; zjp@cgl.ucsf.edu
 <zjp@cgl.ucsf.edu>
 Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu
 <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
 Subject: Re: [ChimeraX] #10027: Installing a python module at plugin
 start/load

 #10027: Installing a python module at plugin start/load
 --------------------------------------+--------------------------
           Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
               Type:  task             |     Status:  assigned
           Priority:  normal           |  Milestone:
          Component:  Third Party      |    Version:
         Resolution:                   |   Keywords:
         Blocked By:                   |   Blocking:
 Notify when closed:                   |   Platform:  all
            Project:  ChimeraX         |
 --------------------------------------+--------------------------
 Comment (by barry.dezonia@…):

  {{{
  In response to the system paths chimerax is seeing here is the output
 from
  a python shell in chimerax:

  import sys

  sys.path
  Out[2]:
  ['/home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-packages',
   '/usr/lib/ucsf-chimerax-daily/lib/python311.zip',
   '/usr/lib/ucsf-chimerax-daily/lib/python3.11',
   '/usr/lib/ucsf-chimerax-daily/lib/python3.11/lib-dynload',
   '/usr/lib/ucsf-chimerax-daily/lib/python3.11/site-packages']

  ________________________________
  From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
  Sent: Friday, October 20, 2023 1:17 PM
  To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA
  <barry.dezonia@wisc.edu>
  Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu
  <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
  Subject: Re: [ChimeraX] #10027: Installing a python module at plugin
  start/load

  #10027: Installing a python module at plugin start/load
  --------------------------------------+--------------------------
            Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
                Type:  task             |     Status:  assigned
            Priority:  normal           |  Milestone:
           Component:  Third Party      |    Version:
          Resolution:                   |   Keywords:
          Blocked By:                   |   Blocking:
  Notify when closed:                   |   Platform:  all
             Project:  ChimeraX         |
  --------------------------------------+--------------------------
  Comment (by barry.dezonia@…):

   {{{
   OK. Thanks for all the feedback. I will start working on the issues a
   piece at a time.

   It took me a while to be able to produce the install program string. It
  is
   a script I run and it is doing this:

   cd /home/bdezonia/.local/share/ChimeraX/1.7/lib/python3.11/site-
   packages/chimerax/tut_tool_qt/Installable/traj2nmr; /usr/bin/chimerax-
   daily --nogui --script 'setup.py install
   --home="/home/bdezonia/.local/share/ChimeraX/1.7"' --exit

   tut_tool_qt is my app and installable is a directory in it where I keep
   the traj2nmr source to be able to install from at runtime.

   I did install yesterday's daily build. When I install my plugin it says
   "No bundles were installed" but it also says "Installed ChimeraX-
  BphonTool
   (0.4)" which is my plugin. The command is present in the Tools ::
 General
   menu. When I run the plugin it is trying to load and in my code where it
   tries to import traj2nmr it says it can't find it. But just a line or
 two
   earlier it is getting installed and I can see that code is being run
   because I can instrument the call. That is the "cd /home/bdezonia-blah-
   blah-blah ..." I mentioned above. Trying to uninstall then says "No
  change
   in list of installed bundles". And the plugin is still in
 Tools::General.

   Note that if I install my plugin and then exit and then run it again it
   can't find traj2nmr. So it is not the case that some internal tracking
   variable has not been updated by the at-runtime plugin install.

   Maybe the plugin is still in the Tools menu because it might have cruft
   from an earlier installation? When I installed the daily build I had to
  do
   some hand uninstallation. Before reinstall I had cleared
   /home/bdezonia/.local/share/ChimeraX/1.7 though.

   Note that traj2nmr's egg file looks to be at:
 /home/bdezonia/.local/share/ChimeraX/1.7/lib/python/traj2nmr-0.0.1-py3.11.egg

   That's a lot of information for you to take in. I am going to continue
   doing some of your suggestions but please critique any issues you see.
   Thanks.
   ________________________________
   From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
   Sent: Friday, October 20, 2023 11:55 AM
   To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA
   <barry.dezonia@wisc.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
   Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu
   <gregc@cgl.ucsf.edu>
   Subject: Re: [ChimeraX] #10027: Installing a python module at plugin
   start/load

   #10027: Installing a python module at plugin start/load
   --------------------------------------+--------------------------
             Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
                 Type:  task             |     Status:  assigned
             Priority:  normal           |  Milestone:
            Component:  Third Party      |    Version:
           Resolution:                   |   Keywords:
           Blocked By:                   |   Blocking:
   Notify when closed:                   |   Platform:  all
              Project:  ChimeraX         |
   --------------------------------------+--------------------------
   Comment (by pett):

    Well, not really "user plugin directory" but rather where ChimeraX's
    Python looks for user-installed modules.
   --
   Ticket URL:
   <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:4>
   ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
   ChimeraX Issue Tracker
   }}}
  --
  Ticket URL:
  <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:5>
  ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
  ChimeraX Issue Tracker
  }}}
 --
 Ticket URL:
 <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:6>
 ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
 ChimeraX Issue Tracker
 }}}
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:7>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:9 by Eric Pettersen, 2 years ago

To get ChimeraX/Python to notice your newly installed bundle immediately, try this after the install:

import importlib
importlib.invalidate_caches()

comment:10 by barry.dezonia@…, 2 years ago

Regarding importlib.invalidate_cache() I was sure that would work when I read it but alas it does not. In the worst case I can throw up a dialog quitting my app and telling the user to restart chimerax. But it sounds like that should not be necessary. Any pointers?
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Friday, October 20, 2023 4:05 PM
To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA <barry.dezonia@wisc.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #10027: Installing a python module at plugin start/load

#10027: Installing a python module at plugin start/load
--------------------------------------+--------------------------
          Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
              Type:  task             |     Status:  assigned
          Priority:  normal           |  Milestone:
         Component:  Third Party      |    Version:
        Resolution:                   |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+--------------------------
Comment (by pett):

 To get ChimeraX/Python to notice your newly installed bundle immediately,
 try this after the install:

 import importlib
 importlib.invalidate_caches()
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:9>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

comment:11 by barry.dezonia@…, 2 years ago

Sorry for the noise. I think this cache invalidation problem is a python bug. I see a handful of posts from the python developers on similar topics and some hedging on how to solve things. I'll investigate a bit more.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Tuesday, October 24, 2023 11:15 AM
To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA <barry.dezonia@wisc.edu>
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #10027: Installing a python module at plugin start/load

#10027: Installing a python module at plugin start/load
--------------------------------------+--------------------------
          Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
              Type:  task             |     Status:  assigned
          Priority:  normal           |  Milestone:
         Component:  Third Party      |    Version:
        Resolution:                   |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |   Platform:  all
           Project:  ChimeraX         |
--------------------------------------+--------------------------
Comment (by barry.dezonia@…):

 {{{
 Regarding importlib.invalidate_cache() I was sure that would work when I
 read it but alas it does not. In the worst case I can throw up a dialog
 quitting my app and telling the user to restart chimerax. But it sounds
 like that should not be necessary. Any pointers?
 ________________________________
 From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
 Sent: Friday, October 20, 2023 4:05 PM
 To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>; BARRY E DEZONIA
 <barry.dezonia@wisc.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>
 Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu
 <gregc@cgl.ucsf.edu>
 Subject: Re: [ChimeraX] #10027: Installing a python module at plugin
 start/load

 #10027: Installing a python module at plugin start/load
 --------------------------------------+--------------------------
           Reporter:  barry.dezonia@…  |      Owner:  Zach Pearson
               Type:  task             |     Status:  assigned
           Priority:  normal           |  Milestone:
          Component:  Third Party      |    Version:
         Resolution:                   |   Keywords:
         Blocked By:                   |   Blocking:
 Notify when closed:                   |   Platform:  all
            Project:  ChimeraX         |
 --------------------------------------+--------------------------
 Comment (by pett):

  To get ChimeraX/Python to notice your newly installed bundle immediately,
  try this after the install:

  import importlib
  importlib.invalidate_caches()
 --
 Ticket URL:
 <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:9>
 ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
 ChimeraX Issue Tracker
 }}}
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/10027#comment:10>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker
Note: See TracTickets for help on using tickets.