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

Python 3.11 : cannot import name 'formatargspec' from 'inspect' #1682

Closed
chichi13 opened this issue Oct 26, 2022 · 3 comments
Closed

Python 3.11 : cannot import name 'formatargspec' from 'inspect' #1682

chichi13 opened this issue Oct 26, 2022 · 3 comments
Labels
agent-python community Issues opened by the community triage Issues awaiting triage

Comments

@chichi13
Copy link

Describe the bug: ...

To Reproduce

  1. Use elastic-apm[flask]==6.12.0 with python 3.11
  2. Initialize elastic-apm
  3. Run your app

Environment (please complete the following information)

  • OS: Ubuntu 20.04
  • Python version: 3.11
  • Framework and version [e.g. Django 2.1]: Flask 2.2.2
  • APM Server version: 8.3.0
  • Agent version: 6.12.0

Additional context

Traceback here :

Error: While importing 'app', an ImportError was raised:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/flask/cli.py", line 218, in locate_app
    __import__(module_name)
  File "/app/app.py", line 4, in <module>
    from portail import create_app
  File "/app/portail/__init__.py", line 12, in <module>
    from elasticapm.contrib.flask import ElasticAPM
  File "/usr/local/lib/python3.11/site-packages/elasticapm/contrib/flask/__init__.py", line 45, in <module>
    from elasticapm.handlers.logging import LoggingHandler
  File "/usr/local/lib/python3.11/site-packages/elasticapm/handlers/logging.py", line 42, in <module>
    from elasticapm.utils import wrapt
  File "/usr/local/lib/python3.11/site-packages/elasticapm/utils/wrapt/__init__.py", line 10, in <module>
    from .decorators import (adapter_factory, AdapterFactory, decorator,
  File "/usr/local/lib/python3.11/site-packages/elasticapm/utils/wrapt/decorators.py", line [34](https://gitlab.fr.probance-i1.com/portail/portail/-/jobs/54707#L34), in <module>
    from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/local/lib/python3.11/inspect.py)

The problem seems to be in wrapt package used by elasticapm (GrahamDumpleton/wrapt#196), fixed in wrapt 1.14.0.

@github-actions github-actions bot added agent-python community Issues opened by the community triage Issues awaiting triage labels Oct 26, 2022
@beniwohli
Copy link
Contributor

Hi @chichi13! We already merged a fix for this and will release a new version of the agent ASAP!

@basepi basepi closed this as completed Oct 26, 2022
@OrJaku
Copy link

OrJaku commented Oct 28, 2022

Hi,
I have similar problem with FastAPI. Do you have any solution?
Python 3.11.0b5
FastAPI: 0.85.1
wrapt: 1.14.1
Ubuntu 22.04

  File "/build/src/node_api.py", line 2, in <module>
    from web3 import Web3
  File "/usr/local/lib/python3.11/site-packages/web3/__init__.py", line 6, in <module>
    from eth_account import (
  File "/usr/local/lib/python3.11/site-packages/eth_account/__init__.py", line 1, in <module>
    from eth_account.account import (
  File "/usr/local/lib/python3.11/site-packages/eth_account/account.py", line 59, in <module>
    from eth_account.messages import (
  File "/usr/local/lib/python3.11/site-packages/eth_account/messages.py", line 26, in <module>
    from eth_account._utils.structured_data.hashing import (
  File "/usr/local/lib/python3.11/site-packages/eth_account/_utils/structured_data/hashing.py", line 9, in <module>
    from eth_abi import (
  File "/usr/local/lib/python3.11/site-packages/eth_abi/__init__.py", line 6, in <module>
    from eth_abi.abi import (  # NOQA
  File "/usr/local/lib/python3.11/site-packages/eth_abi/abi.py", line 1, in <module>
    from eth_abi.codec import (
  File "/usr/local/lib/python3.11/site-packages/eth_abi/codec.py", line 16, in <module>
    from eth_abi.decoding import (
  File "/usr/local/lib/python3.11/site-packages/eth_abi/decoding.py", line 14, in <module>
    from eth_abi.base import (
  File "/usr/local/lib/python3.11/site-packages/eth_abi/base.py", line 7, in <module>
    from .grammar import (
  File "/usr/local/lib/python3.11/site-packages/eth_abi/grammar.py", line 4, in <module>
    import parsimonious
  File "/usr/local/lib/python3.11/site-packages/parsimonious/__init__.py", line 9, in <module>
    from parsimonious.grammar import Grammar, TokenGrammar
  File "/usr/local/lib/python3.11/site-packages/parsimonious/grammar.py", line 14, in <module>
    from parsimonious.expressions import (Literal, Regex, Sequence, OneOf,
  File "/usr/local/lib/python3.11/site-packages/parsimonious/expressions.py", line 9, in <module>
    from inspect import getargspec
ImportError: cannot import name 'getargspec' from 'inspect' (/usr/local/lib/python3.11/inspect.py)

@basepi
Copy link
Contributor

basepi commented Oct 28, 2022

Hey @OrJaku! That doesn't appear to be in our code, so you may want to file an issue with https://github.com/erikrose/parsimonious or wait a little longer to upgrade to py3.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-python community Issues opened by the community triage Issues awaiting triage
Projects
None yet
Development

No branches or pull requests

4 participants