-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
JSONDecodeError on Python 3.10 #4210
Comments
I've tried removing the entire pypoetry cache directory and still having the same issue |
Just tried the 1.2.0a1 release and it's working fine. |
The 1.1.7 update pushed out today still has the same problem on Python 3.10 |
Reproducible with 3.10 on Linux & Windows as well. |
python-poetry/poetry#3706 python-poetry/poetry#3870 python-poetry/poetry#4056 Poetry has a new install script, added in python-poetry/poetry#3706. The old get-poetry.py install script is not compatible with Python 3.10. This commit will update the GitHub Actions workflow to use the new install-poetry.py script, with `POETRY_HOME=/opt/poetry` for consistent installs independent of user account, and will also update the workflow to use a virtualenv and run commands with `poetry run` to avoid issues with `POETRY_VIRTUALENVS_CREATE=false`. As of Poetry 1.1.7, there may be complications with install-poetry.py run without venvs (`POETRY_VIRTUALENVS_CREATE=false`). An error is seen: ```text OSError Could not find a suitable TLS CA certificate bundle, invalid path: /opt/poetry/venv/lib/python3.9/site-packages/certifi/cacert.pem at /opt/poetry/venv/lib/python3.9/site-packages/requests/adapters.py:227 in cert_verify ``` Poetry may be incorrectly attempting to read from its virtualenv if it's not respecting `POETRY_VIRTUALENVS_CREATE` (python-poetry/poetry#3870). Downstream steps also do not respect `POETRY_VIRTUALENVS_CREATE`, so the application does not run. To avoid these issues, `poetry run` can be prepended to commands to prompt Poetry to use its virtualenv. Additionally, Poetry errors out with a `JSONDecodeError` when attempting to install packages with Python 3.10 (python-poetry/poetry#4210). Python 3.10 support will be postponed until Poetry is compatible.
BTW disabling $ poetry config experimental.new-installer false |
I can confirm that the issue is resolved by @hoefling's suggestion.
|
I can confirm I can reproduce with version 1.1.8 here. Poke @python-poetry/triage |
And this is fixed in 1.2.0a2. I guess we can close this ? |
I am glad I found this issue. I wouldn't have known how to even debug this, since Poetry eats the whole traceback I only shows this JSONDecodeError. Is there a way to print the traceback? |
Anyone got this on 3.9.7? I get
|
Same here, with a project with both 3.9 and 3.10 env. Removing the 3.10 env solve the problem. However, 3.10 will be released in 2 days, so I don't think we should be surprise there are still things that don't work yet. |
Reproduced with Poetry 1.1.10 installed on Python 3.9.5 (Ubuntu 21.04 system Python) using pipx.
Works: pyenv local 3.9.7
poetry env use $(pyenv which python)
poetry install Fails: pyenv local 3.10.0rc2
poetry env use $(pyenv which python)
poetry install Poetry eats most of the stack trace. I see the following repeated once for each dependency: • Installing urllib3 (1.26.7): Failed
JSONDecodeError
Expecting value: line 1 column 1 (char 0)
at /usr/lib/python3.9/json/decoder.py:355 in raw_decode
351│ """
352│ try:
353│ obj, end = self.scan_once(s, idx)
354│ except StopIteration as err:
→ 355│ raise JSONDecodeError("Expecting value", s, err.value) from None
356│ return obj, end
357│ Removing the Poetry cache with Disabling the experimental installer with |
same issue with python 3.10-rc2 while 3.10 is supposed to be released today. python 3.9 worked well. with 3.10-rc2, |
Hi all, Wanted to update you that given error should gone with latest With given release you don’t need to disable experimental new installer to install your dependencies with poetry at 3.10.0rc2 or 3.10.0. |
Confirmed for me, fresh stable 3.10 works with latest poetry. Be careful when upgrading, there are packages that don't have a wheel yet, and you'll need to compile them while in 3.9, you didn't need to. For me, you can close the ticket. |
I use |
Hello everyone, as others already mention this issue is solved by a new version of If you install poetry by the If you use the deprecated TL;DR;: Install poetry with the fin swimmer |
fresh install with install-poetry.py, deleting poetry.lock, and latest version of cachecontrol did not fix the issue for me, FYI |
The problem for me is that something was spewing "Cannot find the file specified" when launching python. Poetry initializes by running python and printing "sys.path" and then attempts to decode this using the json parser. The JSON parser fails (loads) because the json string starts with "Cannot find the file specified", and of course that's not valid json. Still a total mystery what is spewing that string though |
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
Installed poetry using pip on Windows on 3.9.6, cannot get poetry install to work :( Tried all suggesitons in this post, with no luck |
This bug is closed. If you have a new bug, please create a new bug report, with all the details requested (inputs, outputs, errors, exactly what commands you ran). |
is this bug fixed ? im running a fresh conda install on Windows WSL Ubuntu with Conda and Python 3.10 just now. I had the exact same issue. Only thing that worked was |
If anyone else gets here: my issue was not solved by changing config, nor by a complete reinstall of poetry. Solution: Simply delete and recreate my currently activated virtual environment. Explanation: as @jcowles suggests above, my currently activated virtual environment python was semi-borked. It was, unbeknownst to me, dishing out a nice error message (but still actually functioning fine somehow): % python
Error processing line 1 of /Users/james/miniconda/envs/mamod/lib/python3.7/site-packages/distutils-precedence.pth:
Traceback (most recent call last):
File "/Users/james/miniconda/envs/mamod/lib/python3.7/site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named '_distutils_hack'
Remainder of file ignored
Python 3.7.13 (default, Mar 28 2022, 07:24:34)
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> This looks to be related to pypa/setuptools#2957. Presumably I had broken my venv via various installations. So my advice if you get a @clintonroy - we could raise a feature request for poetry to handle the JSON parsing more gracefully? I believe this is done within this file: https://github.com/python-poetry/poetry/blob/ae03bdcdecbb00f2691dbd0f78c08fc010e87779/src/poetry/utils/env.py |
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
* don't run the ci twice per each pull request Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com> * try out running ci with pypy 3.9 Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com> * remove workaround for python-poetry/poetry#4210 Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com> * skip win + pypy3 builds due to python-poetry/poetry#4626 Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com> * drop 3.6 jobs Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com> Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
I just had the same issue. I tried first deleting the virtual environment (as per @jamesowers-roo), but that didn't fix it. What worked was the solution from @hoefling:
|
The JSONDecodeError discussed here is very specifically related to cache-control. Other JSONDecodeErrors are likely caused by broken systems/virtual environments and are more general (not Windows) versions of #6664. |
* feat(semantic-release): add semantic release to the project * Add test release to workflow * fix typo * Fix HEAD branch name * Force node version to 18 on release.yaml * fix poetry on ci according to python-poetry/poetry#4210 * Adding back dbf to fix tests * Skipping sids dbc test
This was required to make the new poetry release work on Python 3.10, but not anymore. See python-poetry/poetry#4210 for detail.
This was required to make the new poetry release work on Python 3.10, but not anymore. See python-poetry/poetry#4210 for details.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate.
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: macOS 11.4
Poetry version: 1.1.6
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/robd003/9147c6ec95678bd578b6da828f1b3840
Issue
Poetry crashes whenever it evaluates a package for installation. Running
poetry install
will return JSONDecodeError 100% of the time.The text was updated successfully, but these errors were encountered: