question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No module named 'elasticapm.contrib.aiohttp'

See original GitHub issue

When I install the package using pip install elastic-apm, the aiohttp module is not found in the library. I tried installing via cloning the repository and using pip install . on the project’s root directory and the aiohttp module was there. My best guess is that the PyPi of the project is not up-to-date. But then again I may be wrong and I may have to do something that I’m not aware of. By the way I read the docs as well but no luck there too.

To Reproduce

  1. install the package using pip install elastic-apm
  2. try importing like this from elasticapm.contrib.aiohttp import ElasticAPM
  3. you would encounter something like this: No module named 'elasticapm.contrib.aiohttp'
  4. try cloning the repository and installing via pip install . in the project’s root directory and then from elasticapm.contrib.aiohttp import ElasticAPM would work just find.

Expected behavior: … I was expecting that it would work just find using the simple installation of pip install elastic-apm

Environment (please complete the following information)

  • OS: Linux
  • Python version: 3.8.1
  • Framework and version [e.g. Django 2.1]: Aiohttp 3.6.2
  • APM Server version: 5.3.3
  • Agent version: doesn’t matter but 7.5.0

Additional context

  • setup.py:
from setuptools import setup, find_packages
...
REQUIRES = [
...
    'elastic-apm==5.3.3',
...
]
...
setup(
...
    install_requires=REQUIRES,
    python_requires='>=3.8.1',
...
)

  • elasticapm library
/app # tail -2 /usr/local/lib/python3.8/site-packages/elasticapm/version.py 
__version__ = (5, 3, 3)
VERSION = ".".join(map(str, __version__))
/app # ls -l /usr/local/lib/python3.8/site-packages/elasticapm/contrib/
total 52
-rw-r--r--    1 root     root          1591 Feb  1 07:54 __init__.py
drwxr-xr-x    2 root     root          4096 Feb  1 07:54 __pycache__
-rw-r--r--    1 root     root          5982 Feb  1 07:54 async_worker.py
drwxr-xr-x    3 root     root          4096 Feb  1 07:54 celery
drwxr-xr-x    6 root     root          4096 Feb  1 07:54 django
drwxr-xr-x    3 root     root          4096 Feb  1 07:54 flask
drwxr-xr-x    3 root     root          4096 Feb  1 07:54 opentracing
-rw-r--r--    1 root     root          1788 Feb  1 07:54 paste.py
drwxr-xr-x    3 root     root          4096 Feb  1 07:54 pylons
drwxr-xr-x    3 root     root          4096 Feb  1 07:54 rq
drwxr-xr-x    3 root     root          4096 Feb  1 07:54 twisted
drwxr-xr-x    3 root     root          4096 Feb  1 07:54 zerorpc

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
beniwohlicommented, Feb 3, 2020

Hi @meysam81

support for aiohttp hasn’t been quite released yet. You can try it out by installing the agent from the master branch

pip install https://github.com/elastic/apm-agent-python/archive/master.zip\#egg\=elastic-apm\=\=100

I would love to hear your feedback how it works for you!

1reaction
beniwohlicommented, Feb 5, 2020

Can you try this instead, then?

pip uninstall elastic-apm
pip install https://github.com/elastic/apm-agent-python/archive/master.zip\#egg\=elastic-apm

It’ll still say the version is 5.3.3, as that’s what current master is set to:

https://github.com/elastic/apm-agent-python/blob/f007f22b44d051d197aa7b54de8fc9e6deec3e4b/elasticapm/version.py#L31-L32

We probably should consider adding a post1 component to the version on master to make things like this clearer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleNotFoundError: No module named 'elastic-apm'
Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'elastic-apm' How to remove the Module.
Read more >
Elastic Apm python agent connection problem - Stack Overflow
On my APM server, I'm not receiving any requests from my agent. I checked the APM server log files. django · elasticsearch ·...
Read more >
Starlette/FastAPI Support | APM Python Agent ... - Elastic
Incorporating Elastic APM into your Starlette project only requires a few easy steps. Installationedit. Install the Elastic APM agent using pip: $ pip...
Read more >
ModuleNotFoundError: No module named 'aiohttp' in Python
The Python ModuleNotFoundError: No module named 'aiohttp' occurs when we forget to install the `aiohttp` module before importing it or install it in...
Read more >
Python Examples of aiohttp.web.HTTPException
HTTPUnauthorized(reason="That snowflake is not valid!") formdata = await request.post() async with self.pool.acquire() as connection: name = await connection.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found