baking-bad / pytezos

🐍 Python SDK for Tezos | Michelson VM in Python
https://pytezos.org
MIT License
112 stars 38 forks source link

Cannot install pytezos on Python 3.12 - issue with dependency secp256k1 #370

Closed hoh closed 3 months ago

hoh commented 4 months ago

I am reopening #360 due to secp256k1 causing issues when using Python 3.12 on, at least, Ubuntu 24.04 and Debian 12.

I created an isolated test for this issue using containers with the relevant Dockerfile content below. These containers fail to build with the same error output I faced on plain Ubuntu 24.04 systems.

This prevents users from using any project that depends on pytezos on recent distributions, which is quite problematic.

It appears that the issue is due to the dependency on the secp256k1 library, which appears unmaintained (last update in 2021). I looked at the network of forks on GitHub and found no help there.

As mentioned in by @droserasprout in #360: "coincurve is nice and well-maintained; we should definitely make a switch. But this library not a drop-in replacement, so it's not an instant task.

docker build -t pytezos -f Dockerfile . 

Using Ubuntu 24.04:

FROM ubuntu:24.04

RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-venv \
    libsecp256k1-dev \
    git \
    && rm -rf /var/lib/apt/lists/*

# Use virtual environment to preserve system libraries
RUN python3 -m venv /opt/venv
RUN /opt/venv/bin/python -m pip install --upgrade "pytezos==3.13.1"

Using Debian 12 / Python 3.12:

FROM python:3.12-bookworm

RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-venv \
    libsecp256k1-dev \
    git \
    && rm -rf /var/lib/apt/lists/*

# Use virtual environment to preserve system libraries
RUN python3 -m venv /opt/venv
RUN /opt/venv/bin/python -m pip install --upgrade "pytezos==3.13.1"
droserasprout commented 3 months ago

Fixed by #373 in 3.13.3.