Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
michaellatham77 opened this issue Jun 7, 2022 · 11 comments
Open

Comments

@michaellatham77
Copy link

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.

@arronsullivan
Copy link

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

@sokrypton
Copy link
Owner

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.

@tomgoddard
Copy link
Contributor

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.

@milot-mirdita
Copy link
Collaborator

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

@sokrypton
Copy link
Owner

one of the errors was coming from the citations.py. I fixed it in the beta branch:
80aef12

@tomgoddard
Copy link
Contributor

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.

@vaalessi
Copy link

vaalessi commented May 30, 2023

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

@milot-mirdita
Copy link
Collaborator

Which notebook are you running with what settings?

@vaalessi
Copy link

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
Copy link

I appears to be file size related...

@sokrypton
Copy link
Owner

sokrypton commented May 30, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants