autometrics-dev / autometrics-py

Easily add metrics to your code that actually help you spot and debug issues in production. Built on Prometheus and OpenTelemetry.
https://autometrics.dev
Apache License 2.0
217 stars 7 forks source link

Installation issues with Python3.7 #63

Open ankit95050 opened 1 year ago

ankit95050 commented 1 year ago

I am trying to follow the readme but consistently running into multiple issues.

Installation details: $ pip3 install autometrics Collecting autometrics Downloading autometrics-0.6-py3-none-any.whl (21 kB) Collecting prometheus-client==0.16.0 Downloading prometheus_client-0.16.0-py3-none-any.whl (122 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 122.5/122.5 kB 2.1 MB/s eta 0:00:00 Collecting opentelemetry-sdk<2.0.0,>=1.17.0 Downloading opentelemetry_sdk-1.18.0-py3-none-any.whl (101 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 101.6/101.6 kB 4.3 MB/s eta 0:00:00 Collecting python-dotenv==1.0.0 Downloading python_dotenv-1.0.0-py3-none-any.whl (19 kB) Collecting opentelemetry-api<2.0.0,>=1.17.0 Downloading opentelemetry_api-1.18.0-py3-none-any.whl (57 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.3/57.3 kB 3.2 MB/s eta 0:00:00 Collecting typing-extensions<5.0.0,>=4.5.0 Downloading typing_extensions-4.7.1-py3-none-any.whl (33 kB) Collecting opentelemetry-exporter-prometheus<2.0.0,>=1.12.0rc1 Downloading opentelemetry_exporter_prometheus-1.12.0rc1-py3-none-any.whl (10 kB) Collecting importlib-metadata~=6.0.0 Downloading importlib_metadata-6.0.1-py3-none-any.whl (21 kB) Requirement already satisfied: setuptools>=16.0 in /usr/local/lib/python3.10/site-packages (from opentelemetry-api<2.0.0,>=1.17.0->autometrics) (63.4.3) Collecting deprecated>=1.2.6 Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB) Collecting opentelemetry-semantic-conventions==0.39b0 Downloading opentelemetry_semantic_conventions-0.39b0-py3-none-any.whl (26 kB) Collecting wrapt<2,>=1.10 Downloading wrapt-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl (35 kB) Collecting zipp>=0.5 Downloading zipp-3.16.0-py3-none-any.whl (6.7 kB) Installing collected packages: zipp, wrapt, typing-extensions, python-dotenv, prometheus-client, opentelemetry-semantic-conventions, importlib-metadata, deprecated, opentelemetry-api, opentelemetry-sdk, opentelemetry-exporter-prometheus, autometrics Successfully installed autometrics-0.6 deprecated-1.2.14 importlib-metadata-6.0.1 opentelemetry-api-1.18.0 opentelemetry-exporter-prometheus-1.12.0rc1 opentelemetry-sdk-1.18.0 opentelemetry-semantic-conventions-0.39b0 prometheus-client-0.16.0 python-dotenv-1.0.0 typing-extensions-4.7.1 wrapt-1.15.0 zipp-3.16.0

`$ python3 Python 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information.

from autometrics.objectives import Objective, ObjectiveLatency, ObjectivePercentile Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'autometrics.objectives' `

I have tried it on multiple computers but the same issue. Is there something more I need to do when it comes to installation?

actualwitch commented 1 year ago

Hello @ankit95050, thank you for giving autometrics a try! As for the issue at hand, it seems that at some point we marked the autometrics package as having a requirement of min python3.8 (that's a bug, we should support 3.7), so in your case pip is downloading an earlier version of autometrics (0.3 it seems) which doesn't have objectives yet. We will fix this in the next release, in the meantime you can try using autometrics with a newer version of python, 3.8+ should get the correct version of the package.

actualwitch commented 1 year ago

Sorry, I checked just now and we depend on a feature from python3.8 (protocols) and some of the packages we use dropped support for 3.6-3.7 so it seems adding python3.7 support would be more challenging than I thought.

brettimus commented 1 year ago

hey @ankit95050

since it appears you're on a mac, you can use homebrew to install a newer version of python, and work with autometrics in a virtual environment.

# this installs python 3.10
brew install python@3.10

then in your project root create a virutal env

cd my-project
python3.10 -m venv venv

activate the virtual env and try installing autometrics

source venv/bin/activate
pip install autometrics

let us know if that works for you! or if you want any help trying it out with an app