Code Monkey home page Code Monkey logo

Comments (17)

AlbertShown avatar AlbertShown commented on September 24, 2024 1

Oh, sorry, I did not know that your project is targeting Windows and macOS as well. In this case, yes, importing local script only for Linux is the right thing to do. Glad that all works fine 👍

from webui.

halildgn avatar halildgn commented on September 24, 2024 1

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

Long term fix

  1. Creating a new PR where linux.yml change ubuntu-latest to ubuntu-18.04
  2. Wait until next stable release of WebUI comes, so Python-WebUI PyPi will be updated
  3. Upgrade your webui2 local Python package

Quick fix / Workaround

  1. Clone WebUI and run make to build it in your Ubuntu
  2. Clone Python WebUI
  3. Copy your local compiled webui-2.so and webui.py into your Python project
  4. Make your project use the local webui.py instead of the installed PyPi package

PR has been created: #357

from webui.

jinzhongjia avatar jinzhongjia commented on September 24, 2024

you can use zig to compile this, it should use glibc 2.31 correctly

just download zig 0.11 or nightly, then git clone webui, goto the directory, and run zig build -Dis_static=false -Denable_tls=true, this will compile webui wtch tls support(dynamic link library)

The build results can be found under zig-out/lib

from webui.

jinzhongjia avatar jinzhongjia commented on September 24, 2024

according to this issue: ziglang/zig#4459, zig should support glibc 2.31

from webui.

Zizaco avatar Zizaco commented on September 24, 2024

Thanks, I'll give it a try!

Having releases that are more widely compatible would be a plus. Do you find it reasonable to have .github/workflows/linux.yml use zig by default?

from webui.

jinzhongjia avatar jinzhongjia commented on September 24, 2024

I think it's a better choice to use zig as a toolchain build, but that's up to @hassandraga and @ttytm decide
However, if webui itself does not provide libraries compiled by zig, it may be possible to provide libraries compiled by zig in the downstream zig-webui.

from webui.

Zizaco avatar Zizaco commented on September 24, 2024

indeed, zig is well-known for allowing cross-compilation of popular projects. I found it a very reasonable approach. @hassandraga @ttytm I would love to hear your thoughts on this

from webui.

AlbertShown avatar AlbertShown commented on September 24, 2024

I think Zig is an excellent build system, but webui is very simple to build. It has one .c file. You can build webui by simply cloning and running make. So, asking all developers to install Zig is an overkill.

On the other hand, some developers want to integrate webui as a submodule in their repo, so some need Zig, others need Cmake, Ninja... that's why it is a good thing to have those build systems as well.

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

from webui.

halildgn avatar halildgn commented on September 24, 2024

I think Zig is an excellent build system, but webui is very simple to build. It has one .c file. You can build webui by simply cloning and running make. So, asking all developers to install Zig is an overkill.

On the other hand, some developers want to integrate webui as a submodule in their repo, so some need Zig, others need Cmake, Ninja... that's why it is a good thing to have those build systems as well.

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

@hassandraga @AlbertShown I really appreciate any help, do we have any updates on this? I use python version of webui2 and I really need this for my bachelor thesis. E.g. on newly installed ubuntu 20.04 even with installing the updates, you still get the glibc 2.31 and webui2 fails. I need users to be able to use my app out of the box just by installing the python packages and not the operating system dependencies. It currently works out of the box on Windows and MacOS but I also need to at least support Ubuntu and updating glibc is not the easiest thing for some casual user since it is one of the core libraries:(

from webui.

AlbertShown avatar AlbertShown commented on September 24, 2024

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

Long term fix

  1. Creating a new PR where linux.yml change ubuntu-latest to ubuntu-18.04
  2. Wait until next stable release of WebUI comes, so Python-WebUI PyPi will be updated
  3. Upgrade your webui2 local Python package

Quick fix / Workaround

  1. Clone WebUI and run make to build it in your Ubuntu
  2. Clone Python WebUI
  3. Copy your local compiled webui-2.so and webui.py into your Python project
  4. Make your project use the local webui.py instead of the installed PyPi package

from webui.

AlbertShown avatar AlbertShown commented on September 24, 2024

@halildgn Let me know if you need any assistance.

from webui.

halildgn avatar halildgn commented on September 24, 2024

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

Long term fix

  1. Creating a new PR where linux.yml change ubuntu-latest to ubuntu-18.04
  2. Wait until next stable release of WebUI comes, so Python-WebUI PyPi will be updated
  3. Upgrade your webui2 local Python package

Quick fix / Workaround

  1. Clone WebUI and run make to build it in your Ubuntu
  2. Clone Python WebUI
  3. Copy your local compiled webui-2.so and webui.py into your Python project
  4. Make your project use the local webui.py instead of the installed PyPi package

@AlbertShown
Thanks a ton, I am going to try these tomorrow, it is 1am here. Two more questions:
1-Do you think that this should work on all x86_x64 linux systems or would it only work on ubuntu? (I did some google research, most people say compiled files shouldn't work on all linux systems but I also researched for so file format, it looks like it is a common format for linux systems, so I wanted to ask maybe it is somehow possible)
2-If you don't mind, could you please share when would be your prediction for the approximate date when the next stable release to take place?

Thank you very very much for responding in such a short time, really appreciate your help.

from webui.

AlbertShown avatar AlbertShown commented on September 24, 2024

1 - The webui-2.so file is a dynamic library, it depend only on the standard GNU C library glibc that it is installed in all Linux systems by default, the only issue is the version, so if your Ubuntu has glibc v2.31, then your compiled webui-2.so will look for this version when used in other x86_x64 machines, normally Ubuntu has the new and some of old glibc to support new and old softwares.

2 - I don't know, this is a open source project managed by the community. When majority of open issues get fixed and all new features get tested then a new version should be released, so maybe in a couple of months. I suggest you do the quick around solution for now.

Your main Python script --> include webui.py which it will auto load webui-2.so in the same folder.

├── main.py
├── webui.py
└── webui-linux-gcc-x64
    └── webui-2.so

from webui.

halildgn avatar halildgn commented on September 24, 2024

1 - The webui-2.so file is a dynamic library, it depend only on the standard GNU C library glibc that it is installed in all Linux systems by default, the only issue is the version, so if your Ubuntu has glibc v2.31, then your compiled webui-2.so will look for this version when used in other x86_x64 machines, normally Ubuntu has the new and some of old glibc to support new and old softwares.

2 - I don't know, this is a open source project managed by the community. When majority of open issues get fixed and all new features get tested then a new version should be released, so maybe in a couple of months. I suggest you do the quick around solution for now.

Your main Python script --> include webui.py which it will auto load webui-2.so in the same folder.

├── main.py
├── webui.py
└── webui-linux-gcc-x64
    └── webui-2.so

Thank you again Albert, I tried the workaround and I had succcess but I am a little confused right now. From what I understand(Please forgive my ignorance) the linux.yml builds the app probably with CI pipeline after a new release comes around. My question is that even though this builds the files for the whole Linux ecosystem, it uses ubuntu-latest(or in the future possibly ubuntu 18.04), so if I write my code like the following, i.e. only for Ubuntu, does this make sense? Since it looks like that regardless of the linux OS, it uses the Ubuntu builds anyway(it is most likely that I am mistaken though). In short, should I use number one or number two(What I mean is that if linux.yml builds like it only builds for Ubuntu for all linux distributions anyway, wouldn't it be just redundant to only check for ubuntu since even the official remote webui2 builds all linux distros like it is building for ubuntu? ):
1.

import distro
if distro.id() == 'ubuntu' :
# I renamed the `webui.py` file as `webui_ubuntu.py`
    import webui_ubuntu as webui
else:
   # the remote package from pip 
    from webui import webui 
from sysimport platform
if platform == 'linux':
# I renamed the `webui.py` file as `webui_linux.py`
    import webui_linux as webui 
else:
    from webui import webui

from webui.

AlbertShown avatar AlbertShown commented on September 24, 2024

When linux.yml build for Ubuntu, it means it build for all Debian based Linux ditro, not only Ubuntu.

The issue we have with linux.yml it's not Ubuntu itself, but, the issue is it use ubuntu-latest which use also the latest glibc v2.33, that's means the compiled webui-2 will work in all Debian based distro but only if glibc v2.33 is installed. Old Ubuntu/Debian still have glibc v2.31.

Your project should simply be like:

# Import local `webui.py`
import webui
MyWindow = webui.window()
MyWindow.show('<html><head><script src=\"webui.js\"></script></head> Hello World ! </html>')
webui.wait()

Files:

├── main.py
├── webui.py
└── webui-linux-gcc-x64
    └── webui-2.so

How to get webui-2.so?

git clone https://github.com/webui-dev/webui.git
cd webui
make

Your webui-2.so will be in /webui/dist/webui-2.so

from webui.

AlbertShown avatar AlbertShown commented on September 24, 2024

If you do this, your manual compiled webui-2.so will work in all old and new Debian based Linux distro (including Ubuntu) where glibc +v2.31 is installed, including new versions of glibc due to the backward compatibility features of glibc. The glibc is designed to ensure that binaries compiled against an older version will continue to function on systems with newer versions.

from webui.

halildgn avatar halildgn commented on September 24, 2024

When linux.yml build for Ubuntu, it means it build for all Debian based Linux ditro, not only Ubuntu.

The issue we have with linux.yml it's not Ubuntu itself, but, the issue is it use ubuntu-latest which use also the latest glibc v2.33, that's means the compiled webui-2 will work in all Debian based distro but only if glibc v2.33 is installed. Old Ubuntu/Debian still have glibc v2.31.

Your project should simply be like:

# Import local `webui.py`
import webui
MyWindow = webui.window()
MyWindow.show('<html><head><script src=\"webui.js\"></script></head> Hello World ! </html>')
webui.wait()

Files:

├── main.py
├── webui.py
└── webui-linux-gcc-x64
    └── webui-2.so

How to get webui-2.so?

git clone https://github.com/webui-dev/webui.git cd webui make

Your webui-2.so will be in /webui/dist/webui-2.so

Thanks again, I already did what you mentioned above and it is already running. I just wanted to ask regarding importing but I understand from your message already that it is fine to just use the glibcv2.31 version for if sys.platform == 'linux' since it is fine for all debian. I did the following since I still want to use the remote pip package for other operating systems, e.g. Windows and MacOS. Summary: Thank you a million, everything works now, I am going to create a pull request for the next release too as you mentioned but I never did such thing before, so I am going to learn how to do it meanwhile:

if platform == 'linux':
# I renamed the `webui.py` file as `webui_linux.py`
    import webui_linux as webui 
else:
    from webui import webui

from webui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.