pydantic / logfire

Uncomplicated Observability for Python and beyond! 🪵🔥
https://logfire.pydantic.dev/docs/
MIT License
1.98k stars 59 forks source link

No module named opentelemetry #96

Closed PhE closed 4 months ago

PhE commented 5 months ago

Description

Got the No module named 'opentelemetry' after install and logfire auth :

❯ poetry add logfire                                                                                                                       
Using version ^0.28.3 for logfire                                                                                                          

Updating dependencies                                                                                                                      
Resolving dependencies... (1.0s)                                                                                                           

Package operations: 1 install, 0 updates, 0 removals                                                                                       

  • Installing logfire (0.28.3)                                                                                                            

Writing lock file                                                                                                                          

❯ poetry shell                                                                                                                             
Spawning shell within /home/philippe/src/paxpar/.venv                                                                                      
[..]
❯ logfire auth                                                                                                                             
Traceback (most recent call last):                                                                                                         
  File "/home/philippe/src/paxpar/.venv/bin/logfire", line 5, in <module>                                                                  
    from logfire.cli import main                                                                                                           
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/__init__.py", line 7, in <module>                             
    from ._internal.auto_trace import AutoTraceModule                                                                                      
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/_internal/auto_trace/__init__.py", line 8, in <module>        
    from ..constants import ONE_SECOND_IN_NANOSECONDS                                                                                      
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/_internal/constants.py", line 6, in <module>                  
    from opentelemetry.context import create_key                                                                                           
ModuleNotFoundError: No module named 'opentelemetry'                                                                                       

Python, Logfire & OS Versions, related packages (not required)

Traceback (most recent call last):                                                                                                   
  File "/home/philippe/src/paxpar/.venv/bin/logfire", line 5, in <module>                                                            
    from logfire.cli import main                                                                                                     
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/__init__.py", line 7, in <module>                       
    from ._internal.auto_trace import AutoTraceModule                                                                                
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/_internal/auto_trace/__init__.py", line 8, in <module>  
    from ..constants import ONE_SECOND_IN_NANOSECONDS                                                                                
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/_internal/constants.py", line 6, in <module>            
    from opentelemetry.context import create_key                                                                                     
ModuleNotFoundError: No module named 'opentelemetry'                                                                                 
alexmojaki commented 5 months ago

Looks like something went wrong with your installation there, there's several dependencies it should've installed. Maybe some poetry config?

PhE commented 5 months ago

Looks like something went wrong with your installation there, there's several dependencies it should've installed. Maybe some poetry config?

Yes, It works on a new project !

I remove the .venv folder and did a fresh poetry install but the logfire auth still fails.

alexmojaki commented 5 months ago

It sounds like it somehow decided not to include the dependencies in the poetry.lock in the first place.

PhE commented 5 months ago

We don't have any poetry special config. here is the .poetry.toml:

[virtualenvs]
in-project = true

We have a lot of deps ... we also had some conflicts months ago but it's fixed now. The CI/CD successfully build everything several times daily.

Here is the pyproject.toml :

[build-system]
build-backend = "poetry.masonry.api"
requires = [ "poetry>=0.12",]

[tool.poetry]
description = "paxpar.code"
name = "paxpar.core"
authors = [ "Philippe ENTZMANN <philippe@arundo.tech>",]
version = "3.12.35"
[[tool.poetry.source]]
name = "gitlab-pp-schemas"
url = "https://gitlab.com/api/v4/projects/32901859/packages/pypi/simple"
priority = "primary"

[[tool.poetry.source]]
name = "PyPI"
priority = "primary"

[tool.ruff]
select = [ "E", "F",]
ignore = [ "E501", "F405", "F403",]

[tool.poetry.dependencies]
aiofiles = "^23.2.1"
aiomysql = "^0.1.1"
aiosqlite = "^0.17.0"
asn1crypto = "^1.2"
async_lru = "^1.0.2"
async-stripe = "^4.0.2"
bbcode = "^1.1.0"
beautifulsoup4 = "^4.9.3"
cachetools = "^5.2.0"
databases = "^0.6.0"
factur-x = "^2.3"
faker = "^15.3.1"
fastapi-mail = "^1.4.1"
fs = "^2.4.11"
gpxpy = "^1.4.2"
graphviz = "^0.20"
itsdangerous = "^2.1.2"
jinja2 = "^3.1.2"
jpype1 = "^1.4.0"
jupyterlab = "^4.0.1"
jupyterlab-widgets = "^3.0.3"
matplotlib = "^3.3.2"
openpyxl = "^3.0.3"
orjson = "^3.7.11"
passlib = "^1.7.4"
pdf-annotate = "^0.12.0"
prometheus-client = "^0.16.0"
prometheus-fastapi-instrumentator = "^6.0.0"
pygments = "^2.5.2"
pyjwt = "^2.6.0"
pypdf2 = "^2.9.0"
PyPDF4 = "^1.27"
pytest = "^8.0.0"
pytest-asyncio = "^0.20.1"
pytest-html = "^3.1.1"
pytest-mock = "^3.8.2"
pytest-playwright = "^0.4.4"
pytest-trio = "^0.8.0"
pytest-watch = "^4.2"
python = "^3.12"
python-dotenv = "^1.0.1"
python-gitlab = "^3.7.0"
pyvis = "^0.3.1"
pyyaml = "^6.0"
rdflib = "^6.1.1"
requests = "^2.23.0"
scalpl = "^0.4.0"
sse-starlette = "^1.3.3"
starlette-exporter = "^0.14.0"
stripe = "^4.0.2"
tabulate = "^0.9.0"
tenacity = "^8.0.1"
toml = "^0.10.0"
tortoise-orm = "^0.19.2"
typer = "^0.7.0"
ujson = "^5.4.0"
xmlschema = "^2.0.1"
xmltodict = "^0.13.0"
watchfiles = "^0.20.0"
pydantic = "^2.4.2"
pydantic-settings = "^2.0.3"
paxpar-schemas = "^1.0.8"
aioboto3 = "^12.0.0"
diskcache = "^5.6.3"
supabase = "^2.3.5"
psycopg2-binary = "^2.9.9"
s3fs = "^2023.12.2"
minio = "^7.2.4"
ruff = "^0.2.1"
pikepdf = "^8.13.0"
pyarrow = "^15.0.0"
pandas = "^2.2.0"
duckdb = "^0.10.0"
kink = "^0.7.0"
pypdf = "^4.1.0"
jupyterlite-core = "^0.2.3"
jupyterlite-pyodide-kernel = "^0.2.3"
tqdm = "^4.66.2"
python-multipart = "^0.0.9"
logfire = "^0.28.3"

[tool.ruff.per-file-ignores]
"scripts/make2.py" = [ "B008",]
"paxpar/services/forge/lib/gen.py" = [ "E402",]

[tool.poetry.dependencies.fastapi]
extras = [ "all",]
version = "^0.109.2"

[tool.poetry.dependencies.uvicorn]
extras = [ "standard",]
version = "^0.27.1"

[tool.poetry.dependencies.pyhanko]
extras = [ "image-support", "opentype", "pkcs11", "xmp",]
version = "^0.20.0"

[tool.poetry.dependencies.python-box]
extras = [ "all",]
version = "^6.1.0"

[tool.poetry.dependencies.secretary]
git = "https://github.com/PhE/secretary.git"
rev = "master"

[tool.poetry.dependencies.devtools]
extras = [ "pygments",]
version = "^0.9.0"

[tool.poetry.dependencies.python-jose]
extras = [ "cryptography",]
version = "^3.3.0"

[tool.poetry.dev-dependencies.black]
version = "^22.6.0"
allow-prereleases = true

[tool.poetry.group.dev.dependencies]
ipywidgets = "^8.0.2"
notebook = "^6.0.3"
pydeps = "^1.10.12"
pylint = "^2.14.5"
pytest-cov = "^4.0.0"
selenium = "^4.0.0"
pre-commit = "^2.20.0"

here's the poetry install output:

❯ rm -Rf .venv/ poetry.lock
❯ poetry install
The currently activated Python version 3.11.6 is not supported by the project (^3.12).
Trying to find and use a compatible version. 
Using python3 (3.12.2)
Creating virtualenv paxpar-core in /home/philippe/src/paxpar/.venv
Updating dependencies
Resolving dependencies... Downloading https://files.pythonhosted.org/packages/56/81/75e659b02ed9b8e8675fd9e3d6e9e3b37860788f65829c2d521034f8b259/pyzmq-26.0.3-cp310-cp310-macosx_10_15_universal2.whl#sha256=44dd6fc3034f1eaa72ece33588867df9e006a7303725a12d64c3dff92330f625  48% (80Resolving dependencies... (86.8s)

Package operations: 258 installs, 0 updates, 0 removals

  • Installing six (1.16.0)
  • Installing jmespath (1.0.1)
  • Installing pycparser (2.22)
  • Installing python-dateutil (2.9.0.post0)
  • Installing urllib3 (2.2.1)
  • Installing attrs (23.2.0)
  • Installing botocore (1.34.69)
  • Installing cffi (1.16.0)
  • Installing frozenlist (1.4.1)
  • Installing idna (3.7)
  • Installing multidict (6.0.5)
  • Installing platformdirs (4.2.1)
  • Installing sniffio (1.3.1)
  • Installing traitlets (5.14.3)
  • Installing zipp (3.18.1)
  • Installing aiosignal (1.3.1)
  • Installing anyio (4.3.0)
  • Installing argon2-cffi-bindings (21.2.0)
  • Installing asn1crypto (1.5.1)
  • Installing asttokens (2.4.1)
  • Installing certifi (2024.2.2)
  • Installing charset-normalizer (3.3.2)
  • Installing cloudpickle (3.0.0)
  • Installing entrypoints (0.4)
  • Installing executing (0.10.0)
  • Installing h11 (0.14.0)
  • Installing httpcore (1.0.5)
  • Installing importlib-metadata (7.1.0)
  • Installing iniconfig (2.0.0)
  • Installing jupyter-core (5.7.2)
  • Installing jupyter-server (2.14.0)
  • Installing markupsafe (2.1.5)
  • Installing nest-asyncio (1.6.0)
  • Installing outcome (1.3.0.post0)
  • Installing packaging (24.0)
  • Installing parso (0.8.4)
  • Installing pluggy (1.5.0)
  • Installing ptyprocess (0.7.0)
  • Installing pure-eval (0.2.2)
  • Installing s3transfer (0.10.1)
  • Installing sortedcontainers (2.4.0)
  • Installing pyzmq (26.0.3)
  • Installing tornado (6.4)
  • Installing typing-extensions (4.11.0)
  • Installing wcwidth (0.2.13)
  • Installing yarl (1.9.4)
  • Installing aiohttp (3.9.5)
  • Installing aioitertools (0.11.0)
  • Installing argon2-cffi (23.1.0)
  • Installing boto3 (1.34.69)
  • Installing cached-property (1.5.2)
  • Installing click (8.1.7)
  • Installing cryptography (42.0.5)
  • Installing decorator (5.1.1)
  • Installing deprecation (2.1.0)
  • Installing dnspython (2.6.1)
  • Installing doit (0.36.0)
  • Installing greenlet (3.0.3)
  • Installing httptools (0.6.1)
  • Installing httpx (0.27.0)
  • Installing ipykernel (6.29.4)
  • Installing ipython-genutils (0.2.0)
  • Installing jedi (0.19.1)
  • Installing jinja2 (3.1.3)
  • Installing jupyter-client (7.4.9)
  • Installing lazy-object-proxy (1.10.0)
  • Installing matplotlib-inline (0.1.7)
  • Installing nbconvert (7.16.4)
  • Installing nbformat (5.10.4)
  • Installing notebook-shim (0.2.4)
  • Installing numpy (1.26.4)
  • Installing pexpect (4.9.0)
  • Installing oscrypto (1.3.0)
  • Installing prometheus-client (0.16.0)
  • Installing prompt-toolkit (3.0.43)
  • Installing pyasn1 (0.6.0)
  • Installing pydantic (2.7.1)
  • Installing pyee (11.1.0)
  • Installing pygments (2.17.2)
  • Installing pypng (0.20220715.0)
  • Installing pysocks (1.7.1)
  • Installing pytest (8.2.0)
  • Installing python-dotenv (1.0.1)
  • Installing pyyaml (6.0.1)
  • Installing requests (2.31.0)
  • Installing ruamel-yaml-clib (0.2.8)
  • Installing send2trash (1.8.3)
  • Installing setuptools (69.5.1)
  • Installing stack-data (0.5.1)
  • Installing starlette (0.36.3)
  • Installing strenum (0.4.15)
  • Installing terminado (0.18.1)
  • Installing text-unidecode (1.3)
  • Installing trio (0.25.0)
  • Installing uritools (4.0.2)
  • Installing uvloop (0.19.0)
  • Installing watchfiles (0.20.0)
  • Installing websockets (12.0)
  • Installing wrapt (1.16.0)
  • Installing wsproto (1.2.0)
  • Installing aiobotocore (2.12.3)
  • Installing aiosmtplib (2.0.2)
  • Installing aiosqlite (0.17.0)
  • Installing appdirs (1.4.4)
  • Installing astroid (2.15.8)
  • Installing blinker (1.8.1)
  • Installing cfgv (3.4.0)
  • Installing colorama (0.4.6)
  • Installing comm (0.2.2)
  • Installing contourpy (1.2.1)
  • Installing coverage (7.5.0)
  • Installing cycler (0.12.1)
  • Installing defusedxml (0.7.1)
  • Installing deprecated (1.2.14)
  • Installing dill (0.3.8)
  • Installing docopt (0.6.2)
  • Installing ecdsa (0.19.0)
  • Installing elementpath (4.4.0)
  • Installing email-validator (2.1.1)
  • Installing et-xmlfile (1.1.0)
  • Installing fastapi (0.109.2)
  • Installing fonttools (4.51.0)
  • Installing fsspec (2023.12.2)
  • Installing gotrue (2.4.2)
  • Installing identify (2.5.36)
  • Installing ipython (8.24.0)
  • Installing iso8601 (1.1.0)
  • Installing isodate (0.6.1)
  • Installing isort (5.13.2)
  • Installing itsdangerous (2.2.0)
  • Installing jsonpickle (3.0.4)
  • Installing jupyterlab-widgets (3.0.10)
  • Installing jupyterlite-core (0.2.3)
  • Installing kiwisolver (1.4.5)
  • Installing lxml (5.2.1)
  • Installing markdown2 (2.4.13)
  • Installing mccabe (0.7.0)
  • Installing msgpack (1.0.8)
  • Installing mypy-extensions (1.0.0)
  • Installing nbclassic (1.0.0)
  • Installing networkx (3.3)
  • Installing nodeenv (1.8.0)
  • Installing orjson (3.10.2)
  • Installing pathspec (0.12.1)
  • Installing pdfrw (0.4)
  • Installing pillow (10.3.0)
  • Installing pkginfo (1.10.0)
  • Installing playwright (1.43.0)
  • Installing postgrest (0.16.4)
  • Installing py (1.11.0)
  • Installing pycryptodome (3.20.0)
  • Installing pydantic-extra-types (2.7.0)
  • Installing pydantic-settings (2.2.1)
  • Installing pyhanko-certvalidator (0.24.1)
  • Installing pymysql (1.1.0)
  • Installing pyparsing (3.1.2)
  • Installing pypdf4 (1.27.0)
  • Installing pypika-tortoise (0.1.6)
  • Installing pytest-base-url (2.1.0)
  • Installing pytest-metadata (3.1.1)
  • Installing python-barcode (0.15.1)
  • Installing python-multipart (0.0.9)
  • Installing python-pkcs11 (0.7.0)
  • Installing python-slugify (8.0.4)
  • Installing pytz (2024.1)
  • Installing qrcode (7.4.2)
  • Installing realtime (1.0.4)
  • Installing requests-toolbelt (1.0.0)
  • Installing rsa (4.9)
  • Installing ruamel-yaml (0.18.6)
  • Installing soupsieve (2.5)
  • Installing sqlalchemy (1.4.41)
  • Installing stdlib-list (0.10.0)
  • Installing storage3 (0.7.4)
  • Installing stripe (4.2.0)
  • Installing supafunc (0.4.5)
  • Installing toml (0.10.2)
  • Installing tomlkit (0.12.4)
  • Installing trio-websocket (0.11.1)
  • Installing tzdata (2024.1)
  • Installing tzlocal (5.2)
  • Installing uharfbuzz (0.37.3)
  • Installing ujson (5.9.0)
  • Installing uvicorn (0.27.1)
  • Installing virtualenv (20.26.1)
  • Installing watchdog (4.0.0)
  • Installing widgetsnbextension (4.0.10)
  • Installing aioboto3 (12.4.0)
  • Installing aiofiles (23.2.1)
  • Installing aiomysql (0.1.1)
  • Installing async-lru (1.0.3)
  • Installing async-stripe (4.2.0)
  • Installing bbcode (1.1.0)
  • Installing beautifulsoup4 (4.12.3)
  • Installing black (22.12.0)
  • Installing cachetools (5.3.3)
  • Installing databases (0.6.2)
  • Installing devtools (0.9.0)
  • Installing diskcache (5.6.3)
  • Installing duckdb (0.10.2)
  • Installing factur-x (2.5)
  • Installing faker (15.3.4)
  • Installing fastapi-mail (1.4.1)
  • Installing fs (2.4.16)
  • Installing gpxpy (1.6.2)
  • Installing graphviz (0.20.3)
  • Installing ipywidgets (8.1.2)
  • Installing jpype1 (1.5.0)
  • Installing jupyterlab (4.1.8)
  • Installing jupyterlite-pyodide-kernel (0.2.3)
  • Installing kink (0.7.0)
  • Installing logfire (0.28.3)
  • Installing matplotlib (3.8.4)
  • Installing minio (7.2.7)
  • Installing notebook (6.5.7)
  • Installing openpyxl (3.1.2)
  • Installing pandas (2.2.2)
  • Installing passlib (1.7.4)
  • Installing paxpar-schemas (1.0.10)
  • Installing pdf-annotate (0.12.0)
  • Installing pikepdf (8.15.1)
  • Installing pre-commit (2.21.0)
  • Installing prometheus-fastapi-instrumentator (6.1.0)
  • Installing psycopg2-binary (2.9.9)
  • Installing pyarrow (15.0.2)
  • Installing pydeps (1.12.20)
  • Installing pyhanko (0.20.1)
  • Installing pyjwt (2.8.0)
  • Installing pylint (2.17.7)
  • Installing pypdf (4.2.0)
  • Installing pypdf2 (2.12.1)
  • Installing pytest-asyncio (0.20.3)
  • Installing pytest-cov (4.1.0)
  • Installing pytest-html (3.2.0)
  • Installing pytest-mock (3.14.0)
  • Installing pytest-playwright (0.4.4)
  • Installing pytest-trio (0.8.0)
  • Installing pytest-watch (4.2.0)
  • Installing python-box (6.1.0)
  • Installing python-gitlab (3.15.0)
  • Installing python-jose (3.3.0)
  • Installing pyvis (0.3.2)
  • Installing rdflib (6.3.2)
  • Installing ruff (0.2.2)
  • Installing s3fs (2023.12.2)
  • Installing scalpl (0.4.2)
  • Installing secretary (0.2.19 0fcebb3)
  • Installing selenium (4.20.0)
  • Installing sse-starlette (1.8.2)
  • Installing starlette-exporter (0.14.0)
  • Installing supabase (2.4.5)
  • Installing tabulate (0.9.0)
  • Installing tenacity (8.2.3)
  • Installing tortoise-orm (0.19.3)
  • Installing tqdm (4.66.2)
  • Installing typer (0.7.0)
  • Installing xmlschema (2.5.1)
  • Installing xmltodict (0.13.0)

Writing lock file

> poetry shell
> logfire auth
Traceback (most recent call last):                                                                                                   
  File "/home/philippe/src/paxpar/.venv/bin/logfire", line 5, in <module>                                                            
    from logfire.cli import main                                                                                                     
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/__init__.py", line 7, in <module>                       
    from ._internal.auto_trace import AutoTraceModule                                                                                
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/_internal/auto_trace/__init__.py", line 8, in <module>  
    from ..constants import ONE_SECOND_IN_NANOSECONDS                                                                                
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/_internal/constants.py", line 6, in <module>            
    from opentelemetry.context import create_key                                                                                     
ModuleNotFoundError: No module named 'opentelemetry'  
alexmojaki commented 5 months ago

When I put those two .toml files in an empty folder and run poetry install, I get 306 installs rather than 258, and there are several opentelemetry packages installed. Also:

$ poetry remove logfire
Updating dependencies
Resolving dependencies... (1.0s)

Package operations: 0 installs, 0 updates, 13 removals

  - Removing googleapis-common-protos (1.63.0)
  - Removing logfire (0.28.3)
  - Removing markdown-it-py (3.0.0)
  - Removing mdurl (0.1.2)
  - Removing opentelemetry-api (1.24.0)
  - Removing opentelemetry-exporter-otlp-proto-common (1.24.0)
  - Removing opentelemetry-exporter-otlp-proto-http (1.24.0)
  - Removing opentelemetry-instrumentation (0.45b0)
  - Removing opentelemetry-proto (1.24.0)
  - Removing opentelemetry-sdk (1.24.0)
  - Removing opentelemetry-semantic-conventions (0.45b0)
  - Removing protobuf (4.25.3)
  - Removing rich (13.7.1)

Writing lock file
$ poetry add logfire
Using version ^0.28.3 for logfire

Updating dependencies
Resolving dependencies... (7.9s)

Package operations: 13 installs, 0 updates, 0 removals

  - Installing protobuf (4.25.3)
  - Installing mdurl (0.1.2)
  - Installing opentelemetry-api (1.24.0)
  - Installing opentelemetry-proto (1.24.0)
  - Installing opentelemetry-semantic-conventions (0.45b0)
  - Installing googleapis-common-protos (1.63.0)
  - Installing markdown-it-py (3.0.0)
  - Installing opentelemetry-exporter-otlp-proto-common (1.24.0)
  - Installing opentelemetry-sdk (1.24.0)
  - Installing opentelemetry-exporter-otlp-proto-http (1.24.0)
  - Installing opentelemetry-instrumentation (0.45b0)
  - Installing rich (13.7.1)
  - Installing logfire (0.28.3)

Writing lock file
Kludex commented 5 months ago

@PhE Were you able to solve the issue? Is there anything else we can do to help here?

Cheater121 commented 4 months ago

Oh, I have the same problem. I have tested it in a ready-made application (fastapi), and in a new one (fastapi). I checked for fastapi v0.103, and use on v0.111. And Pycharm 2024.1.1, and VS Code latest versions. I don't use Poetry (still pip with venv), tried to test it on python 3.11.7 and 3.12.2. Error looks the same everywhere, it looks like some kind of bug. I'll throw the friezes just in case.

annotated-types==0.6.0
anyio==4.3.0
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
Deprecated==1.2.14
dnspython==2.6.1
email_validator==2.1.1
fastapi==0.111.0
fastapi-cli==0.0.2
googleapis-common-protos==1.63.0
h11==0.14.0
httpcore==1.0.5
httptools==0.6.1
httpx==0.27.0
idna==3.7
importlib-metadata==7.0.0
Jinja2==3.1.3
logfire==0.29.0
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
opentelemetry-api==1.24.0
opentelemetry-exporter-otlp-proto-common==1.24.0
opentelemetry-exporter-otlp-proto-http==1.24.0
opentelemetry-instrumentation==0.45b0
opentelemetry-proto==1.24.0
opentelemetry-sdk==1.24.0
opentelemetry-semantic-conventions==0.45b0
orjson==3.10.3
protobuf==4.25.3
pydantic==2.7.1
pydantic_core==2.18.2
Pygments==2.18.0
python-dotenv==1.0.1
python-multipart==0.0.9
PyYAML==6.0.1
requests==2.31.0
rich==13.7.1
shellingham==1.5.4
sniffio==1.3.1
starlette==0.37.2
typer==0.12.3
typing_extensions==4.11.0
ujson==5.9.0
urllib3==2.2.1
uvicorn==0.29.0
watchfiles==0.21.0
websockets==12.0
wrapt==1.16.0
zipp==3.18.1

And traceback of exception:

Traceback (most recent call last):
  File "c:\Users\cheat\PycharmProjects\test\main.py", line 7, in <module>
    logfire.instrument_fastapi(app, use_opentelemetry_instrumentation=False)
  File "C:\Users\cheat\PycharmProjects\test\.venv\Lib\site-packages\logfire\_internal\main.py", line 777, in instrument_fastapi
    from .integrations.fastapi import instrument_fastapi
  File "C:\Users\cheat\PycharmProjects\test\.venv\Lib\site-packages\logfire\_internal\integrations\fastapi.py", line 13, in <module>
    from opentelemetry.instrumentation.asgi import get_host_port_url_tuple  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'opentelemetry.instrumentation.asgi'

The code is easy for test:

from fastapi import FastAPI
import uvicorn
import logfire

app = FastAPI()
logfire.configure()
logfire.instrument_fastapi(app)

@app.get("/")
def read_root():
    return {"Hello": "World"}

if __name__ == "__main__":
    uvicorn.run("main:app", host="0.0.0.0", port=8000)
alexmojaki commented 4 months ago

@Cheater121 this is not the same problem. For library instrumentation, extra dependencies are required. In this case you can use pip install 'logfire[fastapi]'.

Cheater121 commented 4 months ago

@Cheater121 this is not the same problem. For library instrumentation, extra dependencies are required. In this case you can use pip install 'logfire[fastapi]'.

Yeah, thanks, it works lol, my fault:)

Tangerino commented 4 months ago

I would expect the pip install do to all work. I just wish to send a simple log message and got this

(<class 'ImportError'>, ImportError("cannot import name 'assert_never' from 'typing_extensions' 

From file ..... /venv2/lib/python3.9/site-packages/logfire/_internal/exporters/file.py

from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
from typing_extensions import assert_never

from ..constants import DEFAULT_FALLBACK_FILE_NAME
from ..utils import ensure_data_dir_exists
Kludex commented 4 months ago

from typing_extensions import assert_never

We were settings the wrong minimum version. I've updated it on #129. Thanks!

Kludex commented 4 months ago

We don't have any poetry special config. here is the .poetry.toml:

[virtualenvs]
in-project = true

We have a lot of deps ... we also had some conflicts months ago but it's fixed now. The CI/CD successfully build everything several times daily.

Here is the pyproject.toml :

[build-system]
build-backend = "poetry.masonry.api"
requires = [ "poetry>=0.12",]

[tool.poetry]
description = "paxpar.code"
name = "paxpar.core"
authors = [ "Philippe ENTZMANN <philippe@arundo.tech>",]
version = "3.12.35"
[[tool.poetry.source]]
name = "gitlab-pp-schemas"
url = "https://gitlab.com/api/v4/projects/32901859/packages/pypi/simple"
priority = "primary"

[[tool.poetry.source]]
name = "PyPI"
priority = "primary"

[tool.ruff]
select = [ "E", "F",]
ignore = [ "E501", "F405", "F403",]

[tool.poetry.dependencies]
aiofiles = "^23.2.1"
aiomysql = "^0.1.1"
aiosqlite = "^0.17.0"
asn1crypto = "^1.2"
async_lru = "^1.0.2"
async-stripe = "^4.0.2"
bbcode = "^1.1.0"
beautifulsoup4 = "^4.9.3"
cachetools = "^5.2.0"
databases = "^0.6.0"
factur-x = "^2.3"
faker = "^15.3.1"
fastapi-mail = "^1.4.1"
fs = "^2.4.11"
gpxpy = "^1.4.2"
graphviz = "^0.20"
itsdangerous = "^2.1.2"
jinja2 = "^3.1.2"
jpype1 = "^1.4.0"
jupyterlab = "^4.0.1"
jupyterlab-widgets = "^3.0.3"
matplotlib = "^3.3.2"
openpyxl = "^3.0.3"
orjson = "^3.7.11"
passlib = "^1.7.4"
pdf-annotate = "^0.12.0"
prometheus-client = "^0.16.0"
prometheus-fastapi-instrumentator = "^6.0.0"
pygments = "^2.5.2"
pyjwt = "^2.6.0"
pypdf2 = "^2.9.0"
PyPDF4 = "^1.27"
pytest = "^8.0.0"
pytest-asyncio = "^0.20.1"
pytest-html = "^3.1.1"
pytest-mock = "^3.8.2"
pytest-playwright = "^0.4.4"
pytest-trio = "^0.8.0"
pytest-watch = "^4.2"
python = "^3.12"
python-dotenv = "^1.0.1"
python-gitlab = "^3.7.0"
pyvis = "^0.3.1"
pyyaml = "^6.0"
rdflib = "^6.1.1"
requests = "^2.23.0"
scalpl = "^0.4.0"
sse-starlette = "^1.3.3"
starlette-exporter = "^0.14.0"
stripe = "^4.0.2"
tabulate = "^0.9.0"
tenacity = "^8.0.1"
toml = "^0.10.0"
tortoise-orm = "^0.19.2"
typer = "^0.7.0"
ujson = "^5.4.0"
xmlschema = "^2.0.1"
xmltodict = "^0.13.0"
watchfiles = "^0.20.0"
pydantic = "^2.4.2"
pydantic-settings = "^2.0.3"
paxpar-schemas = "^1.0.8"
aioboto3 = "^12.0.0"
diskcache = "^5.6.3"
supabase = "^2.3.5"
psycopg2-binary = "^2.9.9"
s3fs = "^2023.12.2"
minio = "^7.2.4"
ruff = "^0.2.1"
pikepdf = "^8.13.0"
pyarrow = "^15.0.0"
pandas = "^2.2.0"
duckdb = "^0.10.0"
kink = "^0.7.0"
pypdf = "^4.1.0"
jupyterlite-core = "^0.2.3"
jupyterlite-pyodide-kernel = "^0.2.3"
tqdm = "^4.66.2"
python-multipart = "^0.0.9"
logfire = "^0.28.3"

[tool.ruff.per-file-ignores]
"scripts/make2.py" = [ "B008",]
"paxpar/services/forge/lib/gen.py" = [ "E402",]

[tool.poetry.dependencies.fastapi]
extras = [ "all",]
version = "^0.109.2"

[tool.poetry.dependencies.uvicorn]
extras = [ "standard",]
version = "^0.27.1"

[tool.poetry.dependencies.pyhanko]
extras = [ "image-support", "opentype", "pkcs11", "xmp",]
version = "^0.20.0"

[tool.poetry.dependencies.python-box]
extras = [ "all",]
version = "^6.1.0"

[tool.poetry.dependencies.secretary]
git = "https://github.com/PhE/secretary.git"
rev = "master"

[tool.poetry.dependencies.devtools]
extras = [ "pygments",]
version = "^0.9.0"

[tool.poetry.dependencies.python-jose]
extras = [ "cryptography",]
version = "^3.3.0"

[tool.poetry.dev-dependencies.black]
version = "^22.6.0"
allow-prereleases = true

[tool.poetry.group.dev.dependencies]
ipywidgets = "^8.0.2"
notebook = "^6.0.3"
pydeps = "^1.10.12"
pylint = "^2.14.5"
pytest-cov = "^4.0.0"
selenium = "^4.0.0"
pre-commit = "^2.20.0"

here's the poetry install output:

❯ rm -Rf .venv/ poetry.lock
❯ poetry install
The currently activated Python version 3.11.6 is not supported by the project (^3.12).
Trying to find and use a compatible version. 
Using python3 (3.12.2)
Creating virtualenv paxpar-core in /home/philippe/src/paxpar/.venv
Updating dependencies
Resolving dependencies... Downloading https://files.pythonhosted.org/packages/56/81/75e659b02ed9b8e8675fd9e3d6e9e3b37860788f65829c2d521034f8b259/pyzmq-26.0.3-cp310-cp310-macosx_10_15_universal2.whl#sha256=44dd6fc3034f1eaa72ece33588867df9e006a7303725a12d64c3dff92330f625  48% (80Resolving dependencies... (86.8s)

Package operations: 258 installs, 0 updates, 0 removals

  • Installing six (1.16.0)
  • Installing jmespath (1.0.1)
  • Installing pycparser (2.22)
  • Installing python-dateutil (2.9.0.post0)
  • Installing urllib3 (2.2.1)
  • Installing attrs (23.2.0)
  • Installing botocore (1.34.69)
  • Installing cffi (1.16.0)
  • Installing frozenlist (1.4.1)
  • Installing idna (3.7)
  • Installing multidict (6.0.5)
  • Installing platformdirs (4.2.1)
  • Installing sniffio (1.3.1)
  • Installing traitlets (5.14.3)
  • Installing zipp (3.18.1)
  • Installing aiosignal (1.3.1)
  • Installing anyio (4.3.0)
  • Installing argon2-cffi-bindings (21.2.0)
  • Installing asn1crypto (1.5.1)
  • Installing asttokens (2.4.1)
  • Installing certifi (2024.2.2)
  • Installing charset-normalizer (3.3.2)
  • Installing cloudpickle (3.0.0)
  • Installing entrypoints (0.4)
  • Installing executing (0.10.0)
  • Installing h11 (0.14.0)
  • Installing httpcore (1.0.5)
  • Installing importlib-metadata (7.1.0)
  • Installing iniconfig (2.0.0)
  • Installing jupyter-core (5.7.2)
  • Installing jupyter-server (2.14.0)
  • Installing markupsafe (2.1.5)
  • Installing nest-asyncio (1.6.0)
  • Installing outcome (1.3.0.post0)
  • Installing packaging (24.0)
  • Installing parso (0.8.4)
  • Installing pluggy (1.5.0)
  • Installing ptyprocess (0.7.0)
  • Installing pure-eval (0.2.2)
  • Installing s3transfer (0.10.1)
  • Installing sortedcontainers (2.4.0)
  • Installing pyzmq (26.0.3)
  • Installing tornado (6.4)
  • Installing typing-extensions (4.11.0)
  • Installing wcwidth (0.2.13)
  • Installing yarl (1.9.4)
  • Installing aiohttp (3.9.5)
  • Installing aioitertools (0.11.0)
  • Installing argon2-cffi (23.1.0)
  • Installing boto3 (1.34.69)
  • Installing cached-property (1.5.2)
  • Installing click (8.1.7)
  • Installing cryptography (42.0.5)
  • Installing decorator (5.1.1)
  • Installing deprecation (2.1.0)
  • Installing dnspython (2.6.1)
  • Installing doit (0.36.0)
  • Installing greenlet (3.0.3)
  • Installing httptools (0.6.1)
  • Installing httpx (0.27.0)
  • Installing ipykernel (6.29.4)
  • Installing ipython-genutils (0.2.0)
  • Installing jedi (0.19.1)
  • Installing jinja2 (3.1.3)
  • Installing jupyter-client (7.4.9)
  • Installing lazy-object-proxy (1.10.0)
  • Installing matplotlib-inline (0.1.7)
  • Installing nbconvert (7.16.4)
  • Installing nbformat (5.10.4)
  • Installing notebook-shim (0.2.4)
  • Installing numpy (1.26.4)
  • Installing pexpect (4.9.0)
  • Installing oscrypto (1.3.0)
  • Installing prometheus-client (0.16.0)
  • Installing prompt-toolkit (3.0.43)
  • Installing pyasn1 (0.6.0)
  • Installing pydantic (2.7.1)
  • Installing pyee (11.1.0)
  • Installing pygments (2.17.2)
  • Installing pypng (0.20220715.0)
  • Installing pysocks (1.7.1)
  • Installing pytest (8.2.0)
  • Installing python-dotenv (1.0.1)
  • Installing pyyaml (6.0.1)
  • Installing requests (2.31.0)
  • Installing ruamel-yaml-clib (0.2.8)
  • Installing send2trash (1.8.3)
  • Installing setuptools (69.5.1)
  • Installing stack-data (0.5.1)
  • Installing starlette (0.36.3)
  • Installing strenum (0.4.15)
  • Installing terminado (0.18.1)
  • Installing text-unidecode (1.3)
  • Installing trio (0.25.0)
  • Installing uritools (4.0.2)
  • Installing uvloop (0.19.0)
  • Installing watchfiles (0.20.0)
  • Installing websockets (12.0)
  • Installing wrapt (1.16.0)
  • Installing wsproto (1.2.0)
  • Installing aiobotocore (2.12.3)
  • Installing aiosmtplib (2.0.2)
  • Installing aiosqlite (0.17.0)
  • Installing appdirs (1.4.4)
  • Installing astroid (2.15.8)
  • Installing blinker (1.8.1)
  • Installing cfgv (3.4.0)
  • Installing colorama (0.4.6)
  • Installing comm (0.2.2)
  • Installing contourpy (1.2.1)
  • Installing coverage (7.5.0)
  • Installing cycler (0.12.1)
  • Installing defusedxml (0.7.1)
  • Installing deprecated (1.2.14)
  • Installing dill (0.3.8)
  • Installing docopt (0.6.2)
  • Installing ecdsa (0.19.0)
  • Installing elementpath (4.4.0)
  • Installing email-validator (2.1.1)
  • Installing et-xmlfile (1.1.0)
  • Installing fastapi (0.109.2)
  • Installing fonttools (4.51.0)
  • Installing fsspec (2023.12.2)
  • Installing gotrue (2.4.2)
  • Installing identify (2.5.36)
  • Installing ipython (8.24.0)
  • Installing iso8601 (1.1.0)
  • Installing isodate (0.6.1)
  • Installing isort (5.13.2)
  • Installing itsdangerous (2.2.0)
  • Installing jsonpickle (3.0.4)
  • Installing jupyterlab-widgets (3.0.10)
  • Installing jupyterlite-core (0.2.3)
  • Installing kiwisolver (1.4.5)
  • Installing lxml (5.2.1)
  • Installing markdown2 (2.4.13)
  • Installing mccabe (0.7.0)
  • Installing msgpack (1.0.8)
  • Installing mypy-extensions (1.0.0)
  • Installing nbclassic (1.0.0)
  • Installing networkx (3.3)
  • Installing nodeenv (1.8.0)
  • Installing orjson (3.10.2)
  • Installing pathspec (0.12.1)
  • Installing pdfrw (0.4)
  • Installing pillow (10.3.0)
  • Installing pkginfo (1.10.0)
  • Installing playwright (1.43.0)
  • Installing postgrest (0.16.4)
  • Installing py (1.11.0)
  • Installing pycryptodome (3.20.0)
  • Installing pydantic-extra-types (2.7.0)
  • Installing pydantic-settings (2.2.1)
  • Installing pyhanko-certvalidator (0.24.1)
  • Installing pymysql (1.1.0)
  • Installing pyparsing (3.1.2)
  • Installing pypdf4 (1.27.0)
  • Installing pypika-tortoise (0.1.6)
  • Installing pytest-base-url (2.1.0)
  • Installing pytest-metadata (3.1.1)
  • Installing python-barcode (0.15.1)
  • Installing python-multipart (0.0.9)
  • Installing python-pkcs11 (0.7.0)
  • Installing python-slugify (8.0.4)
  • Installing pytz (2024.1)
  • Installing qrcode (7.4.2)
  • Installing realtime (1.0.4)
  • Installing requests-toolbelt (1.0.0)
  • Installing rsa (4.9)
  • Installing ruamel-yaml (0.18.6)
  • Installing soupsieve (2.5)
  • Installing sqlalchemy (1.4.41)
  • Installing stdlib-list (0.10.0)
  • Installing storage3 (0.7.4)
  • Installing stripe (4.2.0)
  • Installing supafunc (0.4.5)
  • Installing toml (0.10.2)
  • Installing tomlkit (0.12.4)
  • Installing trio-websocket (0.11.1)
  • Installing tzdata (2024.1)
  • Installing tzlocal (5.2)
  • Installing uharfbuzz (0.37.3)
  • Installing ujson (5.9.0)
  • Installing uvicorn (0.27.1)
  • Installing virtualenv (20.26.1)
  • Installing watchdog (4.0.0)
  • Installing widgetsnbextension (4.0.10)
  • Installing aioboto3 (12.4.0)
  • Installing aiofiles (23.2.1)
  • Installing aiomysql (0.1.1)
  • Installing async-lru (1.0.3)
  • Installing async-stripe (4.2.0)
  • Installing bbcode (1.1.0)
  • Installing beautifulsoup4 (4.12.3)
  • Installing black (22.12.0)
  • Installing cachetools (5.3.3)
  • Installing databases (0.6.2)
  • Installing devtools (0.9.0)
  • Installing diskcache (5.6.3)
  • Installing duckdb (0.10.2)
  • Installing factur-x (2.5)
  • Installing faker (15.3.4)
  • Installing fastapi-mail (1.4.1)
  • Installing fs (2.4.16)
  • Installing gpxpy (1.6.2)
  • Installing graphviz (0.20.3)
  • Installing ipywidgets (8.1.2)
  • Installing jpype1 (1.5.0)
  • Installing jupyterlab (4.1.8)
  • Installing jupyterlite-pyodide-kernel (0.2.3)
  • Installing kink (0.7.0)
  • Installing logfire (0.28.3)
  • Installing matplotlib (3.8.4)
  • Installing minio (7.2.7)
  • Installing notebook (6.5.7)
  • Installing openpyxl (3.1.2)
  • Installing pandas (2.2.2)
  • Installing passlib (1.7.4)
  • Installing paxpar-schemas (1.0.10)
  • Installing pdf-annotate (0.12.0)
  • Installing pikepdf (8.15.1)
  • Installing pre-commit (2.21.0)
  • Installing prometheus-fastapi-instrumentator (6.1.0)
  • Installing psycopg2-binary (2.9.9)
  • Installing pyarrow (15.0.2)
  • Installing pydeps (1.12.20)
  • Installing pyhanko (0.20.1)
  • Installing pyjwt (2.8.0)
  • Installing pylint (2.17.7)
  • Installing pypdf (4.2.0)
  • Installing pypdf2 (2.12.1)
  • Installing pytest-asyncio (0.20.3)
  • Installing pytest-cov (4.1.0)
  • Installing pytest-html (3.2.0)
  • Installing pytest-mock (3.14.0)
  • Installing pytest-playwright (0.4.4)
  • Installing pytest-trio (0.8.0)
  • Installing pytest-watch (4.2.0)
  • Installing python-box (6.1.0)
  • Installing python-gitlab (3.15.0)
  • Installing python-jose (3.3.0)
  • Installing pyvis (0.3.2)
  • Installing rdflib (6.3.2)
  • Installing ruff (0.2.2)
  • Installing s3fs (2023.12.2)
  • Installing scalpl (0.4.2)
  • Installing secretary (0.2.19 0fcebb3)
  • Installing selenium (4.20.0)
  • Installing sse-starlette (1.8.2)
  • Installing starlette-exporter (0.14.0)
  • Installing supabase (2.4.5)
  • Installing tabulate (0.9.0)
  • Installing tenacity (8.2.3)
  • Installing tortoise-orm (0.19.3)
  • Installing tqdm (4.66.2)
  • Installing typer (0.7.0)
  • Installing xmlschema (2.5.1)
  • Installing xmltodict (0.13.0)

Writing lock file

> poetry shell
> logfire auth
Traceback (most recent call last):                                                                                                   
  File "/home/philippe/src/paxpar/.venv/bin/logfire", line 5, in <module>                                                            
    from logfire.cli import main                                                                                                     
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/__init__.py", line 7, in <module>                       
    from ._internal.auto_trace import AutoTraceModule                                                                                
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/_internal/auto_trace/__init__.py", line 8, in <module>  
    from ..constants import ONE_SECOND_IN_NANOSECONDS                                                                                
  File "/home/philippe/src/paxpar/.venv/lib/python3.12/site-packages/logfire/_internal/constants.py", line 6, in <module>            
    from opentelemetry.context import create_key                                                                                     
ModuleNotFoundError: No module named 'opentelemetry'  

Would you be able to create a GH repository for us to reproduce it? We are still unable to reproduce it.

Kludex commented 4 months ago

@PhE I'll be closing this for now, since we can't reproduce it. I'd be happy to reopen if you can provide a GH repository for us to reproduce it. Thanks! :)

PhE commented 4 months ago

Tried again with a clean git checkout and it works now.