lucasb-eyer / pydensecrf

Python wrapper to Philipp Krähenbühl's dense (fully connected) CRFs with gaussian edge potentials.
MIT License
1.94k stars 416 forks source link

compatibility issue with cython 3.0.0 #123

Closed tonyzzr closed 1 year ago

tonyzzr commented 1 year ago

seems like this pakage is not compatible with cython 3.0.0 but automatically uses it when running "pip install git+https://github.com/lucasb-eyer/pydensecrf.git"

my temporal fix is "!pip install --no-build-isolation git+https://github.com/lucasb-eyer/pydensecrf.git" but would like to see an official patch to this bug

solsteve commented 1 year ago

I am building a docker container based on tensorflow/tensorflow:2.11.0-gpu I tried your workaround in my Dockerfile using the line: RUN python -m pip install --no-build-isolation git+https://github.com/lucasb-eyer/pydensecrf.git It still fails, but the error is different now. Now it cannot find pydensecrf/eigen.cpp

pydensecrf/eigen appears to be an extension. Is there a way to turn that off? Or, is it something that must be added befor the build?

Host: Ubuntu 22.04.2 LTS 5.15.0-76-generic #83-Ubuntu SMP docker: Docker version 24.0.4, build 3713ee1 docker-compose: docker-compose version 1.29.2 docker base image: tensorflow/tensorflow:2.11.0-gpu from hub.docker.com

singular1ty94 commented 1 year ago

I ran into this exact same error. My solution was to downgrade my Cython to the version prior to 3.0.0

pip3 install --force-reinstall cython==0.29.36

After that, I used

pip3 install --no-build-isolation git+https://github.com/lucasb-eyer/pydensecrf.git

And it worked fine and I was able to get the main package to run.

dolev765 commented 1 year ago

@singular1ty94 works "thumbs up"

Esduard commented 1 year ago

I had This issue as well when trying to use an aws lambda image. However, in order to make this work i had to do two additional things:

RUN python3.9 -m pip install wheel==0.37.1

RUN pip3 install --force-reinstall cython==0.29.33 instead of 0.29.36

In summary, my Dockerfile looks like this:

FROM public.ecr.aws/lambda/python:3.9.2023.01.11.07

RUN python3.9 -m pip install --upgrade pip
RUN python3.9 -m pip install wheel==0.37.1
RUN pip3 install --force-reinstall cython==0.29.33
RUN pip3 install --no-build-isolation git+https://github.com/lucasb-eyer/pydensecrf.git
lucasb-eyer commented 1 year ago

I merged #124 but please, if someone has a proper fix, open a PR and I'll be happy to merge after a second person confirms it works. I unfortunately don't have the time to dig into this myself in at least the next month.