<p>Thanks for reporting this. From looking around, it looks like this was the consequence of a bug-fix in NumPy 1.16:</p>
<pre><code>Arrays based off readonly buffers cannot be set writeable
-------------------------------------------------------------
We now disallow setting the writeable flag True on arrays created
from fromstring(readonly-buffer).
</code></pre>
<p>PR in Numpy here: <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="350543079" data-permission-text="Issue title is private" data-url="https://github.com/numpy/numpy/issues/11739" data-hovercard-type="pull_request" data-hovercard-url="/numpy/numpy/pull/11739/hovercard" href="https://github.com/numpy/numpy/pull/11739">numpy/numpy#11739</a></p>
<p>I am not familiar with the code in sequence.py but maybe <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=3976804" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ebolyen">@ebolyen</a> can have a look? From some tinkering in the console, it looks like copying the data into a byte array and then passing that to <code>np.frombuffer</code> should suffice. For example:</p>
<p>This is what we have in _sequence.py.</p>
<pre><code># this fails 👎
In [1]: import numpy as np
   ...: s = 'asdf'.encode('ascii')
   ...: x = np.frombuffer(s, dtype=np.uint8)
   ...:

In [2]: x.flags.writeable = True
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-95da424ff829> in <module>
----> 1 x.flags.writeable = True

ValueError: cannot set WRITEABLE flag to True of this array

</code></pre>
<p>This is as inspired from some comments in the NumPy PR:</p>
<pre><code># this works 👍
In [3]: q = bytearray(4)

In [4]: q[:] = 'asdf'.encode('ascii')

In [10]: x = np.frombuffer(q, dtype=np.uint8)

In [11]: x.flags.writeable = True
</code></pre>
<hr>
<p>This is the <a href="https://github.com/biocore/scikit-bio/blob/master/skbio/sequence/tests/test_grammared_sequence.py#L238">failing unit test</a>.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you authored the thread.<br />Reply to this email directly, <a href="https://github.com/biocore/scikit-bio/issues/1648#issuecomment-452862428">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJAqA1a0rGTM8AB3jyMjbxhIuyyMtAqCks5vBmEAgaJpZM4Z29dm">mute the thread</a>.<img src="https://github.com/notifications/beacon/AJAqAw9L5xQ-p6WzGh75__pcdWPLv8fnks5vBmEAgaJpZM4Z29dm.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/biocore/scikit-bio","title":"biocore/scikit-bio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/biocore/scikit-bio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ElDeveloper in #1648: Thanks for reporting this. From looking around, it looks like this was the consequence of a bug-fix in NumPy 1.16:\r\n\r\n```\r\nArrays based off readonly buffers cannot be set writeable\r\n-------------------------------------------------------------\r\nWe now disallow setting the writeable flag True on arrays created\r\nfrom fromstring(readonly-buffer).\r\n```\r\n\r\nPR in Numpy here: https://github.com/numpy/numpy/pull/11739\r\n\r\nI am not familiar with the code in sequence.py but maybe @ebolyen can have a look? From some tinkering in the console, it looks like copying the data into a byte array and then passing that to `np.frombuffer` should suffice. For example:\r\n\r\n\r\nThis is what we have in _sequence.py.\r\n\r\n```\r\n# this fails 👎\r\nIn [1]: import numpy as np\r\n   ...: s = 'asdf'.encode('ascii')\r\n   ...: x = np.frombuffer(s, dtype=np.uint8)\r\n   ...:\r\n\r\nIn [2]: x.flags.writeable = True\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n\u003cipython-input-2-95da424ff829\u003e in \u003cmodule\u003e\r\n----\u003e 1 x.flags.writeable = True\r\n\r\nValueError: cannot set WRITEABLE flag to True of this array\r\n\r\n```\r\n\r\nThis is as inspired from some comments in the NumPy PR:\r\n\r\n```\r\n# this works 👍\r\nIn [3]: q = bytearray(4)\r\n\r\nIn [4]: q[:] = 'asdf'.encode('ascii')\r\n\r\nIn [10]: x = np.frombuffer(q, dtype=np.uint8)\r\n\r\nIn [11]: x.flags.writeable = True\r\n```\r\n\r\n\r\n\r\n--------------\r\n\r\nThis is the [failing unit test](https://github.com/biocore/scikit-bio/blob/master/skbio/sequence/tests/test_grammared_sequence.py#L238)."}],"action":{"name":"View Issue","url":"https://github.com/biocore/scikit-bio/issues/1648#issuecomment-452862428"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/biocore/scikit-bio/issues/1648#issuecomment-452862428",
"url": "https://github.com/biocore/scikit-bio/issues/1648#issuecomment-452862428",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>