#15489 closed defect (fixed)

Editable installs broken on latest revision

Reported by: Zach Pearson Owned by: Zach Pearson
Priority: major Milestone: 1.9
Component: Build System Version:
Keywords: Cc: Greg Couch
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

I'm getting this error when I try to install a package in editable mode now:

Executing: toolshed install /Users/zjp/git/rbvi/ChimeraX/src/bundles/blastprotein/dist/ChimeraX_BlastProtein-2.4.6-0.editable-py3-none-any.whl userOnly false reinstall true
Traceback (most recent call last):
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/devel.py", line 185, in _run
    unbound_method(bb, *args, **kw)
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/bundle_builder/bundle_builder_toml.py", line 530, in make_install
    run(session, cmd)
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/run.py", line 49, in run
    results = command.run(text, log=log, return_json=return_json)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/cli.py", line 3213, in run
    result = ci.function(session, **kw_args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/toolshed.py", line 314, in toolshed_install
    ts.install_bundle(bundles, logger, **kw)
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/__init__.py", line 929, in install_bundle
    _install_bundle(self, bundle, logger, per_user=per_user, reinstall=reinstall, session=session, no_deps=no_deps)
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/toolshed_utils/__init__.py", line 275, in _install_bundle
    changes = toolshed.reload(logger, rebuild_cache=True, report=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/__init__.py", line 433, in reload
    self._installed_bundle_info.load(logger, cache_file=cache_file,
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/installed.py", line 63, in load
    bi = _make_bundle_info(d, True, logger)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/installed.py", line 398, in _make_bundle_info
    kw['packages'] = _get_installed_packages(d, logger)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/zjp/git/rbvi/ChimeraX/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/installed.py", line 637, in _get_installed_packages
    with open(os.path.join(d.location, path_file)) as f:
                           ^^^^^^^^^^
AttributeError: 'PathDistribution' object has no attribute 'location'

Change History (4)

comment:1 by Zach Pearson, 16 months ago

For some reason, loose editable installs were not having their finder.py files found. The condition if path.parts[-1] == 'finder.py' needed to be changed to if path.parts[-1].endswith('finder.py') because the rest of the filename was being included. Haven't fixed the original error yet, it's still a landmine waiting for a strict editable user to walk on it.

comment:3 by Greg Couch, 16 months ago

"path.parts[-1].endswith('finder.py')" is the wrong fix.  If it is 
needed, there is a serious bug somewhere else.  path.parts[-1] should be 
same as path.name, which is the last component of the path.  If not, the 
path is not a pathlib.Path object.

comment:4 by Zach Pearson, 15 months ago

Resolution: fixed
Status: assignedclosed

I forgot to note in this ticket that there was a change to this code. This is the current code here, if I you are still unsatisfied with that resolution then please reopen this ticket.

Note: See TracTickets for help on using tickets.