ColabFold icon indicating copy to clipboard operation
ColabFold copied to clipboard

NotImplementedError: A UTF-8 locale is required. Got ANSI_X3.4-1968

Open michaellatham77 opened this issue 2 years ago • 11 comments

Expected Behavior

I am trying to predict structures and include Amber refinement for more accurate side chain positioning.

Current Behavior

When running Alphafold2_advanced.ipynb with Amber enabled (step 6) downloading results fails.

Steps to Reproduce (for bugs)

Notebook run normally using standard setting, or altering any other setting (i.e., no problem downloading structures). I get this error whenever Amber is enabled from new or existing connections to Colab servers.

ColabFold Output (for bugs)


NotImplementedError Traceback (most recent call last) in () 51 52 # --- Download the predictions --- ---> 53 get_ipython().magic('shell zip -FSr {I["output_dir"]}.zip {I["output_dir"]}') 54 if IN_COLAB: 55 files.download(f'{I["output_dir"]}.zip')

3 frames /usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py in magic(self, arg_s) 2158 magic_name, _, magic_arg_s = arg_s.partition(' ') 2159 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC) -> 2160 return self.run_line_magic(magic_name, magic_arg_s) 2161 2162 #-------------------------------------------------------------------------

/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line) 2079 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals 2080 with self.builtin_trap: -> 2081 result = fn(*args,**kwargs) 2082 return result 2083

/usr/local/lib/python3.7/dist-packages/google/colab/_system_commands.py in _shell_line_magic(line) 68 exit code. 69 """ ---> 70 result = _run_command(line, clear_streamed_output=False) 71 result.check_returncode() 72 return result

/usr/local/lib/python3.7/dist-packages/google/colab/_system_commands.py in _run_command(cmd, clear_streamed_output) 166 if locale_encoding != _ENCODING: 167 raise NotImplementedError( --> 168 'A UTF-8 locale is required. Got {}'.format(locale_encoding)) 169 170 parent_pty, child_pty = pty.openpty()

NotImplementedError: A UTF-8 locale is required. Got ANSI_X3.4-1968

Your Environment

I am using AlphaFold2_advanced.ipynb on Google Colab website.

michaellatham77 avatar Jun 07 '22 22:06 michaellatham77

Just commenting that I have the same issue and have not found a workaround yet besides manual download.

arronsullivan avatar Jun 16 '22 17:06 arronsullivan

This issue should be resolved now. It seems conda installation break google-colab %shell magic functions. Replacing this function with just os.system() seems to do the trick.

sokrypton avatar Jun 17 '22 17:06 sokrypton

While the solution in the June 17, 2022 comment of replacing the the !zip shell magic with an os.system() call will work on the first ColabFold prediction, if you run another prediction in the same Google Colab session it will fail because all shell magic is broken, and their are other uses of shell magic in ColabFold. The real problem is that all shell magic is broken because somehow OpenMM changed the default text encoding from UTF-8 to ANSI_X3.4-1968 (ie ASCII). This same problem was encountered with the Google AlphaFold notebook described in this ticket

https://github.com/deepmind/alphafold/issues/483

and also in the ColabFold predictions run via ChimeraX in this ticket

https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/8313

I debugged the ChimeraX case and wasn't able to find the underlying problem in several hours of testing.

tomgoddard avatar Jan 19 '23 00:01 tomgoddard

I thought I replaced all shell magic. I also tried to find the root cause but gave up when iI had to cross into openmms native code. I’ll take a look when I have time

milot-mirdita avatar Jan 19 '23 05:01 milot-mirdita

one of the errors was coming from the citations.py. I fixed it in the beta branch: https://github.com/sokrypton/ColabFold/commit/80aef123bc0bb7c73468d478a35693459ba3506e

sokrypton avatar Jan 19 '23 18:01 sokrypton

The purpose of my comment yesterday was that changing multiple places in the code to try to work around the fact that the default text encoding is mistakenly switched from UTF-8 to ASCII is not a great solution. The ideal solution would of course be to make OpenMM not switch to ASCII or to switch it back to UTF-8 after OpenMM does its damage. Unfortunately I was not able to figure out how. So yesterday's comment and this one is just to add information rather than solve the problem. Making default text encoding ASCII is a disaster and I would not be surprised to see more obscure errors caused by it.

tomgoddard avatar Jan 19 '23 21:01 tomgoddard

I am running into these errors as previously described still. I have attempted manual file download, connecting to my googledrive, and sending to github. I seem to get hung up with the following error message:

Error encountered: NotImplementedError: A UTF-8 locale is required. Got ANSI_X3.4-1968

vaalessi avatar May 30 '23 11:05 vaalessi

Which notebook are you running with what settings?

milot-mirdita avatar May 30 '23 11:05 milot-mirdita

ColabFold v1.5.2-patch: AlphaFold2 using MMseqs2 , using alphafold2_multiverv3. The test sequence seems to download just fine. The protein i am running is a complex of 4 individual subunits, and is ~960aa long, so seems like a potentially large file. I thought the settings were pretty vanilla e.g. num_relax = 0 , pair_mode = unpaired_paired, no template, msa_mode = MMseqs2_uniref_env . Let me know if there is any other info you'd like.

vaalessi avatar May 30 '23 11:05 vaalessi

I appears to be file size related...

vaalessi avatar May 30 '23 12:05 vaalessi

Can you share the exact error you are getting.

Also, are you using Google Chrome?

sokrypton avatar May 30 '23 13:05 sokrypton