pygobject / pycairo

Python bindings for cairo
https://pycairo.readthedocs.io
Other
613 stars 83 forks source link

NEED Clarification and Help #303

Closed AvinandanPal25 closed 1 year ago

AvinandanPal25 commented 1 year ago

Hello all,

I am working on a python project to analyze WhatsApp chat. So when I tried to deploy it, I came across this quite bothering term "pycairo". It made my life difficult for the last couple of days. NEED HELP !!


WHAT IS THE SOLUTION TO THIS ISSUE? Kindly guide. I am on Windows, so it will be more beneficial for me if you answer in that PROSPECTIVE.

In advance, many thanks for considering my request. I really need the solution at the earliest.

stuaxo commented 1 year ago

Hi @AvinandanPal25 What version of python are you using ? Can when you try and install PyCairo from pip and paste the output here ?

Cheers

AvinandanPal25 commented 1 year ago

Hi @stuaxo, thanks for reaching out to help.

I am using python 3.9.5. And I had already installed PyCairo, both by using the pip command, and later on by downloading the actual wheel file and then installing it.

Here's a snap of it. Screenshot 2022-12-02 163130

The warning here might have something to do with my virtual env.

stuaxo commented 1 year ago

I found this info about your warning https://www.pythonpool.com/solving-python-ignoring-invalid-distribution/#:~:text=Warning%3A%20Ignoring%20invalid%20distribution%20This%20happens%20because%20when,own%20package%20%28pip%20-%3E%20~ip%29%20without%20restoring%20it.

It looks like pycairo is installed (of course this doesn't mean it's working).

How exactly are you triggering the error you are getting, and what is the it ?

I don't think there's enough information here to reproduce it yet.

AvinandanPal25 commented 1 year ago

The warning (in brown color text) in the above photo is not the actual problem. I mentioned it there itself. pycairo is installed.

The error at first was 'pkg-config' not found. Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10'] and later, after I installed pycairo, the error was pycairo-1.21.0-cp37-cp37m-win32.whl is not a supported wheel on this platform. while I was deploying the app over Streamlit

stuaxo commented 1 year ago

I'm not familiar with Streamlit, so would need more information on how to reproduce this issue, since it's sounds like something different to standard python.

AvinandanPal25 commented 1 year ago

Sure @stuaxo Streamlit Community is a platform to deploy Streamlit Dashboards. Find Here

And streamlit in itself is an Open Source framework in Python, somewhat similar to Flask. It has its own functions to create the app and add functionality. So we just need to install and import, and we are good to go. It has built-in functions for making buttons, text areas, number inputs, select-box, and sliders. Documentation It's a Quicker Fix. Also, we need not to know HTML/CSS/JS to build dashboards.

I do hope that this will be sufficient.

sonomirco commented 1 year ago

Hi @stuaxo and @AvinandanPal25 it seems I have the same issue here. https://discuss.streamlit.io/t/problem-deploying-with-pycairo/42285 Did you find any solution for the problem?

stuaxo commented 1 year ago

Sorry, I'm not familiar with streamlit, what platform it's on or if it's a platform itself.

The errors here mention a python whl for the windows platform but that thread mentions apt-get which would usually be a debian based Linux, so I don't think I have enough information to help.

sonomirco commented 1 year ago

Streamlit is an open-source Python library that makes it easy to create and share beautiful, custom web apps for machine learning and data science. In just a few minutes you can build and deploy powerful data apps.

And this is the GitHub action used to deploy the Streamlit app to the Azure static web app, which fails on creating the wheels, the environment used is Ubuntu as you can see in the action.

Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy

name: Build and deploy Python app to Azure Web App - mep-configurator

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Set up Python version
        uses: actions/setup-python@v1
        with:
          python-version: '3.10'

      - name: Create and start virtual environment
        run: |
          python -m venv venv
          source venv/bin/activate

      - name: Install dependencies
        run: |
          sudo apt-get install libcairo2-dev pkg-config python3-dev
          sudo apt install libgirepository1.0-dev
          pip install -r requirements.txt

      # Optional: Add step to run tests here (PyTest, Django test suites, etc.)

      - name: Upload artifact for deployment jobs
        uses: actions/upload-artifact@v2
        with:
          name: python-app
          path: |
            . 
            !venv/

  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v2
        with:
          name: python-app
          path: .

      - name: 'Deploy to Azure Web App'
        uses: azure/webapps-deploy@v2
        id: deploy-to-webapp
        with:
          app-name: 'mep-configurator'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_D66086F2554D4C2F9BE23A1323FCFE87 }}
stuaxo commented 1 year ago

Cheers, that makes things clearer I didn't know Azure webapp is a thing.

This is different issue to the one @AvinandanPal25 is having as I can see Azure webapp is running Ubuntu and the original error is for windows so I'll move your query to its own ticket.

stuaxo commented 1 year ago

I'm going to close this for now, can reopen if @AvinandanPal25 comes back with more info, but the issue there is trying to use the whl for the wrong OS.

I've started another ticket for the error @sonomirco is getting from pycairo, trying to use streamlit on Azure webapp.