Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson-python: The poppler package is split between purelib and platlib #74

Closed
bzamecnik opened this issue Apr 19, 2023 · 5 comments
Closed

Comments

@bzamecnik
Copy link
Contributor

bzamecnik commented Apr 19, 2023

pip install python_poppler==0.4.0 on python 3.10 (Ubuntu 22.04) using meson 1.1.0 fails with:

#30 28.35       + meson install --no-rebuild --destdir /tmp/pip-install-d59qdq37/python-poppler_8100653bafcf4616b4f77887e540edc4/.mesonpy-zrqhtx8x/install
#30 28.35       
#30 28.35       meson-python: error: The poppler package is split between purelib and platlib: 'purelib/poppler/__init__.py' and 'platlib/poppler/cpp/global_.cpython-310-x86_64-linux-gnu.so', a "pure: false" argument may be missing in meson.build
#30 28.35       [end of output]

-> "pure: false" argument may be missing in meson.build

Caused by meson-python-0.13.0 release:

  • Raise an error when a package is split between platlib and purelib.

More info: #74

I'd guess that we need to pass pure: false in the meson.build file here (similar to test code of meson, release notes, docs):

python3 = python_mod.find_installation('python3', pure: false)
bzamecnik added a commit to bzamecnik/python-poppler that referenced this issue Apr 19, 2023
Since meson-python-0.13.0 it's required for non-pure builds.
@frivas-at-navteca
Copy link

I am having the same issue, it is really awesome there is a fix already. I am wondering when it will be released so the package installed via pip will work.

Thanks for fixing it so fast!

@bzamecnik
Copy link
Contributor Author

Yeah, it broke a build and needed to be fixed ASAP.

cbrunet pushed a commit that referenced this issue Apr 21, 2023
Since meson-python-0.13.0 it's required for non-pure builds.
@eRuaro
Copy link

eRuaro commented Apr 21, 2023

Hi @bzamecnik, any idea how to circumvent this issue when trying to install poppler on docker? Here's my dockerfile, and my requirements.txt

FROM python:3.10-slim-buster

# Update package lists
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 gcc g++ git build-essential libpoppler-cpp-dev pkg-config poppler-utils tesseract-ocr libtesseract-dev -y

# Make working directories
RUN  mkdir -p  /app
WORKDIR  /app

# Copy the requirements.txt file to the container
COPY requirements.txt .

# Install dependencies
RUN pip install --upgrade pip

RUN pip install torch torchvision torchaudio

RUN pip install -r requirements.txt

RUN pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.4#egg=detectron2'

# Copy the .env file to the container
COPY .env .

# Copy every file in the source folder to the created working directory
COPY  . .

# Expose the port that the application will run on
EXPOSE 8000

# Start the application
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
fastapi
uvicorn
langchain
python-poppler
pytesseract
unstructured[local-inference]
psycopg2-binary
pgvector
openai
tiktoken
python-dotenv

@frivas-at-navteca
Copy link

frivas-at-navteca commented Apr 21, 2023

Hello @eRuaro

Great question. I hope this answer helps you somehow.

In my specific case I did the following:

FROM public.ecr.aws/lambda/python:3.9
...
RUN pip3 install 'git+https://github.com/facebookresearch/detectron2.git'
...
RUN yum install tesseract tesseract-langpack* poppler poppler-cpp poppler-utils -y
RUN pip3 install --no-cache-dir --upgrade deepdoctection[pt]
RUN pip3 install 'git+https://github.com/mindee/doctr.git'

My suggestion would be trying installing from the source, something like this:

RUN pip3 install 'git+https://github.com/cbrunet/python-poppler.git'

I can see that the main already includes the fix so I would think the new package will be ready in short.

@cbrunet
Copy link
Owner

cbrunet commented Apr 21, 2023

Fixed by #75

@cbrunet cbrunet closed this as completed Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants