Opened 7 years ago

Closed 6 years ago

#1631 closed defect (fixed)

UnicodeDecodeError during ISOLDE install

Reported by: dilipk@… Owned by: Conrad Huang
Priority: normal Milestone:
Component: Tool Shed Version:
Keywords: Cc: Tristan Croll
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Windows-10-10.0.16299
ChimeraX Version: 0.8 (2018-12-17)
Description
Downloading bundle ChimeraX_ISOLDE-1.0b2-cp36-cp36m-win_amd64.whl Traceback (most recent call last):   File "C:\Program Files\ChimeraX\bin\lib\site-packages\chimerax\ui\widgets\htmlview.py", line 386, in download_finished     session=self.session)   File "C:\Program Files\ChimeraX\bin\lib\site-packages\chimerax\core\toolshed\__init__.py", line 548, in install_bundle     results = self._pip_install(bundle, per_user=per_user, reinstall=reinstall)   File "C:\Program Files\ChimeraX\bin\lib\site-packages\chimerax\core\toolshed\__init__.py", line 845, in _pip_install     results = self._run_pip(command)   File "C:\Program Files\ChimeraX\bin\lib\site-packages\chimerax\core\toolshed\__init__.py", line 873, in _run_pip     result = cp.stdout.decode("utf-8") UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 46: invalid start byte UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 46: invalid start byte File "C:\Program Files\ChimeraX\bin\lib\site-packages\chimerax\core\toolshed\__init__.py", line 873, in _run_pip result = cp.stdout.decode("utf-8") See log for complete Python traceback

Log:
Startup Messages  
---  
note | Traceback (most recent call last):  
File "C:\Program Files\ChimeraX\bin\lib\site-  
packages\chimerax\core\toolshed\\\\__init__.py", line 338, in __init__  
self.init_available_from_cache(logger)  
File "C:\Program Files\ChimeraX\bin\lib\site-  
packages\chimerax\core\toolshed\\\\__init__.py", line 445, in  
init_available_from_cache  
abc.load_from_cache()  
File "C:\Program Files\ChimeraX\bin\lib\site-  
packages\chimerax\core\toolshed\available.py", line 61, in load_from_cache  
b = _build_bundle(d)  
File "C:\Program Files\ChimeraX\bin\lib\site-  
packages\chimerax\core\toolshed\available.py", line 98, in _build_bundle  
bundle_d = d["bundle"][bundle_name]  
KeyError: 'ChimeraX_ISOLDE'  
  
UCSF ChimeraX version: 0.8 (2018-12-17)  
How to cite UCSF ChimeraX  
Downloading bundle ChimeraX_ISOLDE-1.0b2-cp36-cp36m-win_amd64.whl  
Traceback (most recent call last):  
File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\ui\widgets\htmlview.py", line 386, in download_finished  
session=self.session)  
File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\core\toolshed\\__init__.py", line 548, in install_bundle  
results = self._pip_install(bundle, per_user=per_user, reinstall=reinstall)  
File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\core\toolshed\\__init__.py", line 845, in _pip_install  
results = self._run_pip(command)  
File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\core\toolshed\\__init__.py", line 873, in _run_pip  
result = cp.stdout.decode("utf-8")  
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 46:
invalid start byte  
  
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 46:
invalid start byte  
  
File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\core\toolshed\\__init__.py", line 873, in _run_pip  
result = cp.stdout.decode("utf-8")  
  
See log for complete Python traceback.  
  




OpenGL version: 3.3.13399 Core Profile Forward-Compatible Context 15.201.1151.1008
OpenGL renderer: AMD Radeon HD 6700 Series
OpenGL vendor: ATI Technologies Inc.

Change History (10)

comment:1 by pett, 7 years ago

Cc: Tristan Croll added
Component: UnassignedTool Shed
Owner: set to Conrad Huang
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionUnicodeDecodeError during ISOLDE install

Reported by Dilip Kumar

comment:2 by Conrad Huang, 7 years ago

Status: assignedaccepted

The decoding error is fixed in 0.9 by fd27a417a.

Unfortunately, since 0.9 uses Python 3.7 and ISOLDE is only compatible with 0.8, this fix does not help right now with ISOLDE installation. Would it be possible for you to edit a ChimeraX Python file so that we can get a look at the error? The file is in ChimeraX.app/bin/Lib/site-packages/chimerax/core/toolshed/__init__.py and the change is to replace lines 923-924:

output = cp.stdout.decode("utf-8")
error = cp.stderr.decode("utf-8")

with:

output = cp.stdout.decode("utf-8", "backslashreplace")
error = cp.stderr.decode("utf-8", "backslashreplace")

If you prefer, I can supply a replacement file that you can drop in place.

in reply to:  3 ; comment:3 by Dilip.Kumar@…, 7 years ago

Dear Sir/Madam


I have modified the int.py file as per your instruction. However, when I open ChimeraX, it gives following error in command line tab:


Traceback (most recent call last):
  File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\core\toolshed\\__init__.py", line 338, in __init__
    self.init_available_from_cache(logger)
  File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\core\toolshed\\__init__.py", line 445, in
init_available_from_cache
    abc.load_from_cache()
  File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\core\toolshed\available.py", line 61, in load_from_cache
    b = _build_bundle(d)
  File "C:\Program Files\ChimeraX\bin\lib\site-
packages\chimerax\core\toolshed\available.py", line 98, in _build_bundle
    bundle_d = d["bundle"][bundle_name]
KeyError: 'ChimeraX_ISOLDE'


Let me know how I should I resolve this error.


Thank you.


Best

Dilip

________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Wednesday, January 23, 2019 1:12:09 PM
Cc: conrad@cgl.ucsf.edu; Kumar, Dilip; tic20@cgl.ucsf.edu
Subject: Re: [ChimeraX] #1631: UnicodeDecodeError during ISOLDE install

#1631: UnicodeDecodeError during ISOLDE install
--------------------------------+----------------------
          Reporter:  dilipk@…   |      Owner:  conrad
              Type:  defect     |     Status:  accepted
          Priority:  normal     |  Milestone:
         Component:  Tool Shed  |    Version:
        Resolution:             |   Keywords:
        Blocked By:             |   Blocking:
Notify when closed:             |   Platform:  all
           Project:  ChimeraX   |
--------------------------------+----------------------
Changes (by conrad):

 * status:  assigned => accepted


Comment:

 The decoding error is fixed in 0.9 by [changeset:fd27a417a].

 Unfortunately, since 0.9 uses Python 3.7 and ISOLDE is only compatible
 with 0.8, this fix does not help right now with ISOLDE installation.
 Would it be possible for you to edit a ChimeraX Python file so that we can
 get a look at the error?  The file is in {{{ChimeraX.app/bin/Lib/site-
 packages/chimerax/core/toolshed/__init__.py}}} and the change is to
 replace lines 923-924:

     output = cp.stdout.decode("utf-8")
     error = cp.stderr.decode("utf-8")

 with:

     output = cp.stdout.decode("utf-8", "backslashreplace")
     error = cp.stderr.decode("utf-8", "backslashreplace")

 If you prefer, I can supply a replacement file that you can drop in place.

--
Ticket URL: <https://urldefense.proofpoint.com/v2/url?u=https-3A__plato.cgl.ucsf.edu_trac_ChimeraX_ticket_1631-23comment-3A2&d=DwIGaQ&c=ZQs-KZ8oxEw0p81sqgiaRA&r=1QfD93K7Ljd_5fgk3QJKFg&m=1QnbkZ-NCqOOuYLGUrdPIbD4pRHLn0mV7T191V0GiF4&s=oHp_FlAFXZWyYUIw6pnH0qoiACHIrS4cplzM-3VlG2o&e=>
ChimeraX <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.rbvi.ucsf.edu_chimerax_&d=DwIGaQ&c=ZQs-KZ8oxEw0p81sqgiaRA&r=1QfD93K7Ljd_5fgk3QJKFg&m=1QnbkZ-NCqOOuYLGUrdPIbD4pRHLn0mV7T191V0GiF4&s=xrDbIwaOQctEnDPwJFMkQWGP96NnKTsuiGRLLefsF5E&e=>
ChimeraX Issue Tracker

comment:4 by Conrad Huang, 7 years ago

There are a couple things to try to clear out the cache:

  • Run the ChimeraX command toolshed reload, which should rebuild the cache.
  • If that doesn't work (e.g., throws traceback), try removing the cache directory which can be found with the ChimeraX command info path user versioned cache.

Let me know if it works (and, if it worked, which option).

comment:5 by Tristan Croll, 7 years ago

I was able to get on to a naïve Windows 10 machine to play with this.

There's another line in __init__.py that needs to be fixed, in the same function. In total, _run_pip() needs to look like:

    def _run_pip(self, command):
        import sys, subprocess
        _debug("_run_pip command:", command)
        cp = subprocess.run([sys.executable, "-m", "pip"] + command,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE)
        if cp.returncode != 0:
            output = cp.stdout.decode("utf-8", "backslashreplace")
            error = cp.stderr.decode("utf-8", "backslashreplace")
            _debug("_run_pip return code:", cp.returncode, file=sys.__stderr__)
            _debug("_run_pip output:", output, file=sys.__stderr__)
            _debug("_run_pip error:", error, file=sys.__stderr__)
            s = output + error
            if "PermissionError" in s:
                raise PermissionError(s)
            else:
                raise RuntimeError(s)
        result = cp.stdout.decode("utf-8", "backslashreplace")
        _debug("_run_pip result:", result)
        return result

After that, ISOLDE installs successfully for me. The KeyError on startup doesn't go away, but appears to be harmless?

in reply to:  6 ; comment:6 by tic20@…, 7 years ago

I can also confirm that clearing the cache makes the KeyError go away.

 
 
Tristan Croll
Research Fellow
Cambridge Institute for Medical Research
University of Cambridge CB2 0XY
 

 


comment:7 by Conrad Huang, 7 years ago

As far as I can tell, the currently committed _run_pip looks exactly like the code above (except the two imports are on separate lines). Which other line needs a change? Thanks.

in reply to:  8 ; comment:8 by tic20@…, 7 years ago

Sorry, I should have clarified. This is in the 0.8 release, and the line starting “result =“ also needs the “backslashreplace” argument.

 
 
Tristan Croll
Research Fellow
Cambridge Institute for Medical Research
University of Cambridge CB2 0XY
 

 


in reply to:  9 ; comment:9 by Dilip.Kumar@…, 7 years ago

Dear Conrad



Removing the cahe file did work. Currently I do not see error message in tab.


Thank you.


Best

Dilip

________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Thursday, January 24, 2019 10:33:06 AM
Cc: conrad@cgl.ucsf.edu; Kumar, Dilip; tic20@cgl.ucsf.edu
Subject: Re: [ChimeraX] #1631: UnicodeDecodeError during ISOLDE install

#1631: UnicodeDecodeError during ISOLDE install
--------------------------------+----------------------
          Reporter:  dilipk@…   |      Owner:  conrad
              Type:  defect     |     Status:  accepted
          Priority:  normal     |  Milestone:
         Component:  Tool Shed  |    Version:
        Resolution:             |   Keywords:
        Blocked By:             |   Blocking:
Notify when closed:             |   Platform:  all
           Project:  ChimeraX   |
--------------------------------+----------------------

Comment (by conrad):

 There are a couple things to try to clear out the cache:

 - Run the ChimeraX command {{{toolshed reload}}}, which should rebuild the
 cache.
 - If that doesn't work (e.g., throws traceback), try removing the cache
 directory which can be found with the ChimeraX command {{{info path user
 versioned cache}}}.

 Let me know if it works (and, if it worked, which option).

--
Ticket URL: <https://urldefense.proofpoint.com/v2/url?u=https-3A__plato.cgl.ucsf.edu_trac_ChimeraX_ticket_1631-23comment-3A4&d=DwIGaQ&c=ZQs-KZ8oxEw0p81sqgiaRA&r=1QfD93K7Ljd_5fgk3QJKFg&m=atTlFTZoUiuYBoxlrErboBXoMD0pmLEXpmBOfHmG6NM&s=FQD4GGcWSdjGGV2APNY0F7Hlkeo41EP4w83_uI_tTY8&e=>
ChimeraX <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.rbvi.ucsf.edu_chimerax_&d=DwIGaQ&c=ZQs-KZ8oxEw0p81sqgiaRA&r=1QfD93K7Ljd_5fgk3QJKFg&m=atTlFTZoUiuYBoxlrErboBXoMD0pmLEXpmBOfHmG6NM&s=NoAtXYEUJIVk-3GAvdHm5x25NIOGVgdRvOMloCHYWxQ&e=>
ChimeraX Issue Tracker

comment:10 by Conrad Huang, 6 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in fd27a41.

Escape illegal utf-8 characters.

Note: See TracTickets for help on using tickets.