matrix-org / pantalaimon

E2EE aware proxy daemon for matrix clients.
Apache License 2.0
279 stars 41 forks source link

ModuleNotFoundError: No module named 'gi' #124

Open tfreedman opened 2 years ago

tfreedman commented 2 years ago

I just tried setting up pantalaimon in docker, and can't get panctl to run from within the container.

Docker commands: docker run -d --restart=unless-stopped -v /home/core/data:/data -p 8008:8008 matrixdotorg/pantalaimon docker exec -it <instanceID> /bin/bash

# panctl
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pantalaimon/panctl.py", line 28, in <module>
    from gi.repository import GLib
ModuleNotFoundError: No module named 'gi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/panctl", line 5, in <module>
    from pantalaimon.panctl import main
  File "/usr/local/lib/python3.8/site-packages/pantalaimon/panctl.py", line 30, in <module>
    from pgi.repository import GLib
ModuleNotFoundError: No module named 'pgi'

I'm assuming https://github.com/matrix-org/pantalaimon/pull/122/commits/86060a2f7561d40bd142c8bc1847e151c3d40dff didn't totally fix things.

aspacca commented 2 years ago

https://gist.github.com/aspacca/6320d86692353001f7a0be1ae4471113

JeremyMahieu commented 2 years ago

https://gist.github.com/aspacca/6320d86692353001f7a0be1ae4471113

This gives me

Step 8/22 : RUN pip wheel .[ui] --wheel-dir /wheels --find-links /wheels
 ---> Running in xxxxxxxxxx
ERROR: Directory '.[ui]' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
ERROR: Service 'pantaleimon' failed to build: The command '/bin/sh -c pip wheel .[ui] --wheel-dir /wheels --find-link
aspacca commented 2 years ago

I cannot reproduce on a arm based mac and on amd64 debian bullseye I apologise for the silly question: do you run from the build from the root of the git repo? @JeremyMahieu

JeremyMahieu commented 2 years ago

do you run from the build from the root of the git repo?

What does it matter, you're pulling all the code from pip

RUN pip --no-cache-dir install --find-links /wheels --no-index pantalaimon
RUN pip --no-cache-dir install --find-links /wheels --no-index pantalaimon[ui]
aspacca commented 2 years ago

What does it matter, you're pulling all the code from pip

not in the builder: https://gist.github.com/aspacca/6320d86692353001f7a0be1ae4471113#file-dockerfile-L13-L15

COPY . /app

RUN pip wheel .[ui] --wheel-dir /wheels --find-links /wheels

that's exactly where you have the error

indeed not even in the run: --find-links /wheels :) (https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-f)

JeremyMahieu commented 2 years ago
Successfully built 76fe9ba922f7
Successfully tagged pantaleimon_pantalaimon:latest
Creating pantalaimon ... done
Attaching to pantalaimon
pantalaimon    | open terminal failed: not a terminal

Edit, this is due to using docker compose. Fine when using the docker run -it command

@aspacca You're absolutely correct, I didn't spot that and I didn't copy the git repsitory to my folder. I feel like this is all a bit off topic. Though. Perhaps your gist should become the actual dockerfile, see #131

ERROR: pantalaimon: Notifications are enabled but no notification server could be found, disabling notifications.

jph commented 1 year ago

I'm not sure I'm following the above replies. Was there a tried and true solution for this? As it stands, Pantalaimon is unusable for me, as I cannot operate panctl at all.

aspacca commented 1 year ago

@jph starting the container building from the dockefile at https://gist.github.com/aspacca/6320d86692353001f7a0be1ae4471113 solves the issue

it starts a tmux session that you can attach and from there start a new one running panctl

jph commented 1 year ago

Thanks @aspacca, good workaround.