iameru / mschleuder

ein Tool für nicht nur CSA's / SoLaWis / Kollektivbetriebe die ihre Erzeugnisse: - an all ihre Mitglieder verteilen - an verschiedene Stationen/Lieferorte - mit halben und ganzen Anteilen
https://iameru.github.io/mschleuder/
GNU General Public License v3.0
3 stars 0 forks source link

Local installation does not succeed #23

Closed sWalbrun closed 1 year ago

sWalbrun commented 1 year ago

Hey @iameru,

I was trying to locally install the application to get in touch with the features you are offering. I saw you documentation page and also the docker-compose.yml but I was not able to successfully boot it. I am currently facing this error

Building wheels for collected packages: infinity, sqla-softdelete, validators
  Building wheel for infinity (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/swalbrun/repositories/mschleuder/mschleuder/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4ik98wn5/infinity/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4ik98wn5/infinity/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-9qpmrpkv
       cwd: /tmp/pip-install-4ik98wn5/infinity/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help

  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for infinity
  Running setup.py clean for infinity
  Building wheel for sqla-softdelete (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/swalbrun/repositories/mschleuder/mschleuder/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4ik98wn5/sqla-softdelete/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4ik98wn5/sqla-softdelete/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-gze6tywy
       cwd: /tmp/pip-install-4ik98wn5/sqla-softdelete/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help

  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for sqla-softdelete
  Running setup.py clean for sqla-softdelete
  Building wheel for validators (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/swalbrun/repositories/mschleuder/mschleuder/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4ik98wn5/validators/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4ik98wn5/validators/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-98lpzrm_
       cwd: /tmp/pip-install-4ik98wn5/validators/
  Complete output (8 lines):
  /usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'build_requires'
    warnings.warn(msg)
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help

  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for validators

Can you check for the error (or maybe update the installation guide) as I want to check if your tool would a good solution for our SolaWir as we are distrubite in quite a manual for now.

Thanks and keep up the good work!

iameru commented 1 year ago

Hello there. Glad You want to try it. The docker-compose.yml was or is in use for the staging environment. You can check it out here https://ms.staging.i3o.eu feel free to play around.

for now, the way to install locally is best done via the install.sh script. for example

cd /home/USER/SOMEWHERE/
git clone https://github.com/iameru/mschleuder
cd mschleuder
chmod +x install.sh
./install.sh

this should exit and print out the command to source the environment and to start the app.

source /home/USER/SOMEWHERE/mschleuder/venv/bin/activate
gunicorn -w 2 "ms:create_app()"

checkout mschleuder.service to use systemd to start the app.

If you need docker and know it well enough feel free to correct this docker-compose or add a new one which actually builds well. There is also the Dockerfile being used in github testing and staging. In theory this should be easy, mainly copying the install.sh into the docker container and executing it. In practice, we would have to troubleshoot this. Im not very experienced with docker setups yet.

let me know how it is going.

sWalbrun commented 1 year ago

Hey, thanks for your input. As I am having no experience with python I can just paste the current error message

/install.sh
Ignoring brotlicffi: markers 'platform_python_implementation != "CPython" and python_version >= "3.8" and python_version < "4.0"' don't match your environment
Ignoring colorama: markers 'python_version >= "3.8" and python_version < "4.0" and platform_system == "Windows" or python_version >= "3.8" and python_version < "4.0" and sys_platform == "win32"' don't match your environment
Ignoring greenlet: markers 'python_version >= "3.8" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version < "4.0"' don't match your environment
Ignoring importlib-metadata: markers 'python_version >= "3.8" and python_version < "3.10"' don't match your environment
Ignoring importlib-resources: markers 'python_version >= "3.8" and python_version < "3.9"' don't match your environment
Ignoring zipp: markers 'python_version >= "3.8" and python_version < "3.10"' don't match your environment
Requirement already satisfied: alembic==1.8.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 1)) (1.8.1)
Requirement already satisfied: attrs==22.1.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 2)) (22.1.0)
Requirement already satisfied: brotli==1.0.9 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 3)) (1.0.9)
Requirement already satisfied: cffi==1.15.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 5)) (1.15.1)
Requirement already satisfied: click==8.1.3 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 6)) (8.1.3)
Requirement already satisfied: cssselect2==0.7.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 8)) (0.7.0)
Requirement already satisfied: decorator==5.1.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 9)) (5.1.1)
Requirement already satisfied: dnspython==2.2.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 10)) (2.2.1)
Requirement already satisfied: email-validator==1.3.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 11)) (1.3.0)
Requirement already satisfied: flask-migrate==3.1.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 12)) (3.1.0)
Requirement already satisfied: flask-moment==1.0.5 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 13)) (1.0.5)
Requirement already satisfied: flask-sqlalchemy==2.5.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 14)) (2.5.1)
Requirement already satisfied: flask-weasyprint==1.0.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 15)) (1.0.0)
Requirement already satisfied: flask==2.2.2 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 16)) (2.2.2)
Requirement already satisfied: fonttools[woff]==4.37.4 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 17)) (4.37.4)
Requirement already satisfied: gunicorn==20.1.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 19)) (20.1.0)
Requirement already satisfied: html5lib==1.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 20)) (1.1)
Requirement already satisfied: idna==3.4 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 21)) (3.4)
Requirement already satisfied: infinity==1.5 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 24)) (1.5)
Requirement already satisfied: iniconfig==1.1.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 25)) (1.1.1)
Requirement already satisfied: intervals==0.9.2 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 26)) (0.9.2)
Requirement already satisfied: itsdangerous==2.1.2 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 27)) (2.1.2)
Requirement already satisfied: jinja2==3.1.2 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 28)) (3.1.2)
Requirement already satisfied: mako==1.2.3 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 29)) (1.2.3)
Requirement already satisfied: markupsafe==2.1.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 30)) (2.1.1)
Requirement already satisfied: packaging==21.3 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 31)) (21.3)
Requirement already satisfied: pillow==9.2.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 32)) (9.2.0)
Requirement already satisfied: pluggy==1.0.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 33)) (1.0.0)
Requirement already satisfied: py==1.11.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 34)) (1.11.0)
Requirement already satisfied: pycparser==2.21 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 35)) (2.21)
Requirement already satisfied: pydantic==1.10.2 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 36)) (1.10.2)
Requirement already satisfied: pydyf==0.5.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 37)) (0.5.0)
Requirement already satisfied: pyparsing==3.0.9 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 38)) (3.0.9)
Requirement already satisfied: pyphen==0.13.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 39)) (0.13.0)
Requirement already satisfied: pytest==7.1.3 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 40)) (7.1.3)
Requirement already satisfied: python-dotenv==0.21.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 41)) (0.21.0)
Requirement already satisfied: python-testmark==1.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 42)) (1.0)
Collecting setuptools==65.4.1
  Using cached setuptools-65.4.1-py3-none-any.whl (1.2 MB)
Requirement already satisfied: six==1.16.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 44)) (1.16.0)
Requirement already satisfied: sqla-softdelete==1.2 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 45)) (1.2)
Requirement already satisfied: sqlalchemy-utils==0.38.3 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 46)) (0.38.3)
Requirement already satisfied: sqlalchemy==1.4.41 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 47)) (1.4.41)
Requirement already satisfied: tinycss2==1.1.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 48)) (1.1.1)
Requirement already satisfied: tomli==2.0.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 49)) (2.0.1)
Requirement already satisfied: typing-extensions==4.4.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 50)) (4.4.0)
Requirement already satisfied: validators==0.20.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 51)) (0.20.0)
Requirement already satisfied: weasyprint==56.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 52)) (56.1)
Requirement already satisfied: webencodings==0.5.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 53)) (0.5.1)
Requirement already satisfied: werkzeug==2.2.2 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 54)) (2.2.2)
Requirement already satisfied: wtforms-alchemy==0.18.0 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 55)) (0.18.0)
Requirement already satisfied: wtforms-components==0.10.5 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 56)) (0.10.5)
Requirement already satisfied: wtforms==3.0.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 57)) (3.0.1)
Requirement already satisfied: zopfli==0.2.1 in ./venv/lib/python3.11/site-packages (from -r requirements.txt (line 59)) (0.2.1)
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 67.6.1
    Uninstalling setuptools-67.6.1:
      Successfully uninstalled setuptools-67.6.1
Successfully installed setuptools-65.4.1

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
Traceback (most recent call last):
  File "/Users/sebastian/repositories/mschleuder/venv/bin/flask", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/flask/cli.py", line 1047, in main
    cli.main()
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/flask/cli.py", line 354, in decorator
    app = __ctx.ensure_object(ScriptInfo).load_app()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/flask/cli.py", line 308, in load_app
    app = locate_app(import_name, name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/flask/cli.py", line 235, in locate_app
    return find_best_app(module)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/flask/cli.py", line 63, in find_best_app
    app = app_factory()
          ^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/ms/__init__.py", line 44, in create_app
    from ms.history.views import history
  File "/Users/sebastian/repositories/mschleuder/ms/history/views.py", line 4, in <module>
    from flask_weasyprint import HTML, render_pdf
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/flask_weasyprint/__init__.py", line 5, in <module>
    import weasyprint
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/weasyprint/__init__.py", line 336, in <module>
    from .css import preprocess_stylesheet  # noqa isort:skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/weasyprint/css/__init__.py", line 25, in <module>
    from . import computed_values, counters, media_queries
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/weasyprint/css/computed_values.py", line 9, in <module>
    from ..text.ffi import ffi, pango, units_to_double
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/weasyprint/text/ffi.py", line 401, in <module>
    pango = _dlopen(
            ^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/weasyprint/text/ffi.py", line 385, in _dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sebastian/repositories/mschleuder/venv/lib/python3.11/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library 'pango-1.0-0': dlopen(pango-1.0-0, 0x0002): tried: 'pango-1.0-0' (no such file), '/System/Volumes/Preboot/Cryptexes/OSpango-1.0-0' (no such file), '/opt/homebrew/lib/pango-1.0-0' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/pango-1.0-0' (no such file), '/usr/lib/pango-1.0-0' (no such file, not in dyld cache), 'pango-1.0-0' (no such file), '/usr/local/lib/pango-1.0-0' (no such file), '/usr/lib/pango-1.0-0' (no such file, not in dyld cache).  Additionally, ctypes.util.find_library() did not manage to locate a library called 'pango-1.0-0'

Seems a bit like the requirements.txt is not listing all dependencies or some other environment settings are not working out. I am using MacOS btw.

iameru commented 1 year ago

Thanks for the log! I'm not having that much time right now but I was able to replicate this with a different linux mashine. At least its also complaining about the missing pango dependency. I'll try to look at this soon again.

iameru commented 1 year ago

I had some time on my hand. the PDF library I use depends on pango. so these are the necessary steps to get a system running with for example debian

sudo apt install -y git python3-venv libpangocairo-1.0-0
git clone https://github.com/iameru/mschleuder
cd mschleuder
chmod +x install.sh
./install.sh

with your MacOS, could you try brew install pango ?

sWalbrun commented 1 year ago

Thanks for the hint! Unfortunately pango is already installed with the latest version image

iameru commented 1 year ago

Ok. I am sorry to hear that. Thanks for your feedback! Unfortunately, I only have time again from the middle or towards the end of october. But if you still want to try to run it locally, I would be up for a troubleshooting session with you then. We could arrange for a videocall and, if necessary, use tmate to quickly jump into it and try to debug this (if tmate works for mac) Feel free to get into contact with me

I'm closing this issue now, not because I necessarily find its resolved but I find it too complex to support the Apple world ( I can not quickly spin up a VM and test the code ).