Open Casper321 opened 1 year ago
Related with https://github.com/ekalinin/nodeenv/pull/329, in case of network glitch, nodeenv may receive a partial tar file when downloading node from official source. When it does so, it doesn't fail immediatly but propagate the partial archive (which turns out to be bytes instead of str) later on in the code, resulting in this error.
Related using https://github.com/RobertCraigie/prisma-client-py
Installing Prisma CLI
/usr/local/lib/python3.11/site-packages/nodeenv.py:26: DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
import pipes
* Install prebuilt node (20.0.0) .Incomplete read while readingfrom https://nodejs.org/download/release/v20.0.0/node-v20.0.0-linux-x64.tar.gz
.
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/local/lib/python3.11/site-packages/nodeenv.py", line 1519, in <module>
main()
File "/usr/local/lib/python3.11/site-packages/nodeenv.py", line 1104, in main
create_environment(env_dir, args)
File "/usr/local/lib/python3.11/site-packages/nodeenv.py", line 980, in create_environment
install_node(env_dir, src_dir, args)
File "/usr/local/lib/python3.11/site-packages/nodeenv.py", line 739, in install_node
install_node_wrapped(env_dir, src_dir, args)
File "/usr/local/lib/python3.11/site-packages/nodeenv.py", line 762, in install_node_wrapped
download_node_src(node_url, src_dir, args)
File "/usr/local/lib/python3.11/site-packages/nodeenv.py", line 602, in download_node_src
with ctx as archive:
File "/usr/local/lib/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/nodeenv.py", line 573, in tarfile_open
tf = tarfile.open(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/tarfile.py", line 1630, in open
saved_pos = fileobj.tell()
^^^^^^^^^^^^
AttributeError: 'bytes' object has no attribute 'tell'
Did you came to a mitigation meanwhile @bagerard ?
not really, we're using this library through pre-commit hooks so once it is installed, it gets cached and we are good for a while but I'm still hoping #329 will get merged soon
Also getting the same error as @c3b5aw. Feels like a separate issue to the original one posted though.
Same thing for us. Any hotfix available?
I'm getting the same error for:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
I tried the latest code from master
(https://github.com/ekalinin/nodeenv/commit/22d4cd9994e0a47b1f5d501cc674b5f48d7cc145) and the failure changed from AttributeError: 'bytes' object has no attribute 'tell'
to http.client.IncompleteRead: IncompleteRead(42023557 bytes read, 4089771 more expected)
. This is consistent with what's described in https://github.com/ekalinin/nodeenv/pull/329.
The issue indeed seems to be network related. On my home network, it happens 100% of the times. On other I tried, it doesn't happen at all. Strangely, this issue appeared out of nowhere about at about the time of this GitHub issue being created. So I don't think this is an issue with my network in particular.
I have a temporary workaround by setting the Python version in the GitHub workflow to 3.10 or lower. This may be useful to people who find this issue.
I was wrong.
Hi, I am using
Sometimes, pre-commit fails with the following error.
It looks like
nodeenv-1.7.0
is used.