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

sysconfig.get_path throws KeyError on pypy3.10-7.3.12 #3953

Closed
gitlab-importer opened this issue Jun 19, 2023 · 3 comments
Closed

sysconfig.get_path throws KeyError on pypy3.10-7.3.12 #3953

gitlab-importer opened this issue Jun 19, 2023 · 3 comments

Comments

@gitlab-importer
Copy link

In Heptapod by @mportesdev on Jun 19, 2023, 09:42

I installed pypy3.10-7.3.12 via pyenv and encountered the following issue.

To reproduce, install loguru in a virtual environment:

(venv) $ pip install loguru
Collecting loguru
...
Successfully installed loguru-0.7.0

and then try to import:

(venv) $ python
Python 3.10.12 (af44d0b8114cb82c40a07bb9ee9c1ca8a1b3688c, Jun 15 2023, 12:39:27)
[PyPy 7.3.12 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> from loguru import logger
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/michal/venv/lib/pypy3.10/site-packages/loguru/__init__.py", line 31, in <module>
    logger.add(_sys.stderr)
  File "/home/michal/venv/lib/pypy3.10/site-packages/loguru/_logger.py", line 952, in add
    exception_formatter = ExceptionFormatter(
  File "/home/michal/venv/lib/pypy3.10/site-packages/loguru/_better_exceptions.py", line 131, in __init__
    self._lib_dirs = self._get_lib_dirs()
  File "/home/michal/venv/lib/pypy3.10/site-packages/loguru/_better_exceptions.py", line 140, in _get_lib_dirs
    paths = {sysconfig.get_path(name, scheme) for scheme in schemes for name in names}
  File "/home/michal/venv/lib/pypy3.10/site-packages/loguru/_better_exceptions.py", line 140, in <setcomp>
    paths = {sysconfig.get_path(name, scheme) for scheme in schemes for name in names}
  File "/home/michal/.pyenv/versions/pypy3.10-7.3.12/lib/pypy3.10/sysconfig.py", line 596, in get_path
    return get_paths(scheme, vars, expand)[name]
KeyError: 'platstdlib'
@gitlab-importer
Copy link
Author

In Heptapod by @mattip on Jun 19, 2023, 09:55

Thanks!. See this line, which must have gotten messed up in one of the merges (py3.9 is OK). Note the spaces before the key:

        '    platstdlib': '{userbase}/lib/{implementation_lower}',

You can modify this in-place in /home/michal/.pyenv/versions/pypy3.10-7.3.12/lib/pypy3.10/sysconfig.py in order to get past this (line 111). I will need to think how to get a patched version out without doing a full 7.3.13 release.

@gitlab-importer
Copy link
Author

In Heptapod by @mportesdev on Jun 19, 2023, 10:02

Yes, that seems to be the problem.

>>>> import sysconfig
>>>> sysconfig.get_path('platstdlib', 'osx_framework_user')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/michal/.pyenv/versions/pypy3.10-7.3.12/lib/pypy3.10/sysconfig.py", line 596, in get_path
    return get_paths(scheme, vars, expand)[name]
KeyError: 'platstdlib'
>>>> sysconfig.get_path('    platstdlib', 'osx_framework_user')
'/home/michal/.local/lib/pypy'

Thanks for the quick response.

@gitlab-importer
Copy link
Author

In Heptapod by @mportesdev on Oct 14, 2023, 23:52

Closing as this is fixed in pypy3.10-7.3.13

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

1 participant