Benjamin-Loison / matrix-commander

simple but convenient CLI-based Matrix client app for sending and receiving
GNU General Public License v3.0
0 stars 0 forks source link

`flock: cannot open lock file /var/lock/matrix-commander: Permission denied` #24

Closed Benjamin-Loison closed 4 months ago

Benjamin-Loison commented 4 months ago

On OverClock3000:

whoami
root
matrix-commander -m 'Test'
flock: cannot open lock file /var/lock/matrix-commander: Permission denied
ls -lh /var/lock/matrix-commander
-rw-r--r-- 1 www-data www-data 0 Jul 22 13:03 /var/lock/matrix-commander
rm /var/lock/matrix-commander
matrix-commander -m 'Test'
Traceback (most recent call last):
  File "/usr/local/bin/matrix-commander_without_flock", line 5, in <module>
    from matrix_commander import main
  File "/usr/local/lib/python3.11/dist-packages/matrix_commander/__init__.py", line 1, in <module>
    from .matrix_commander import main
  File "/usr/local/lib/python3.11/dist-packages/matrix_commander/matrix_commander.py", line 51, in <module>
    from nio import (AsyncClient, AsyncClientConfig, ContentRepositoryConfigError,
  File "/usr/local/lib/python3.11/dist-packages/nio/__init__.py", line 9, in <module>
    from .client import *
  File "/usr/local/lib/python3.11/dist-packages/nio/client/__init__.py", line 3, in <module>
    from .base_client import Client, ClientConfig
  File "/usr/local/lib/python3.11/dist-packages/nio/client/base_client.py", line 36, in <module>
    from ..crypto import ENCRYPTION_ENABLED, DeviceStore, OlmDevice, OutgoingKeyRequest
  File "/usr/local/lib/python3.11/dist-packages/nio/crypto/__init__.py", line 35, in <module>
    from .key_request import OutgoingKeyRequest
  File "/usr/local/lib/python3.11/dist-packages/nio/crypto/key_request.py", line 21, in <module>
    from ..responses import RoomKeyRequestResponse
  File "/usr/local/lib/python3.11/dist-packages/nio/responses.py", line 26, in <module>
    from jsonschema.exceptions import SchemaError, ValidationError
ModuleNotFoundError: No module named 'jsonschema'

PyPi: jsonschema

jsonschema 4.5k stars

pip install jsonschema
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
su -l benjamin
matrix-commander -m 'Test'
Traceback (most recent call last):
  File "/usr/local/bin/matrix-commander_without_flock", line 5, in <module>
    from matrix_commander import main
  File "/usr/local/lib/python3.11/dist-packages/matrix_commander/__init__.py", line 1, in <module>
    from .matrix_commander import main
  File "/usr/local/lib/python3.11/dist-packages/matrix_commander/matrix_commander.py", line 51, in <module>
    from nio import (AsyncClient, AsyncClientConfig, ContentRepositoryConfigError,
  File "/usr/local/lib/python3.11/dist-packages/nio/__init__.py", line 9, in <module>
    from .client import *
  File "/usr/local/lib/python3.11/dist-packages/nio/client/__init__.py", line 3, in <module>
    from .base_client import Client, ClientConfig
  File "/usr/local/lib/python3.11/dist-packages/nio/client/base_client.py", line 36, in <module>
    from ..crypto import ENCRYPTION_ENABLED, DeviceStore, OlmDevice, OutgoingKeyRequest
  File "/usr/local/lib/python3.11/dist-packages/nio/crypto/__init__.py", line 35, in <module>
    from .key_request import OutgoingKeyRequest
  File "/usr/local/lib/python3.11/dist-packages/nio/crypto/key_request.py", line 21, in <module>
    from ..responses import RoomKeyRequestResponse
  File "/usr/local/lib/python3.11/dist-packages/nio/responses.py", line 26, in <module>
    from jsonschema.exceptions import SchemaError, ValidationError
ModuleNotFoundError: No module named 'jsonschema'

There does not seem to have been a recent update of matrix-commandeer:

matrix-commander

PyPi: matrix-commander#history

pip install jsonschema
Output: ``` Collecting jsonschema Downloading jsonschema-4.23.0-py3-none-any.whl.metadata (7.9 kB) Requirement already satisfied: attrs>=22.2.0 in ./venv/lib/python3.11/site-packages (from jsonschema) (23.2.0) Collecting jsonschema-specifications>=2023.03.6 (from jsonschema) Downloading jsonschema_specifications-2023.12.1-py3-none-any.whl.metadata (3.0 kB) Collecting referencing>=0.28.4 (from jsonschema) Downloading referencing-0.35.1-py3-none-any.whl.metadata (2.8 kB) Collecting rpds-py>=0.7.1 (from jsonschema) Downloading rpds_py-0.19.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.1 kB) Downloading jsonschema-4.23.0-py3-none-any.whl (88 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.5/88.5 kB 3.9 MB/s eta 0:00:00 Downloading jsonschema_specifications-2023.12.1-py3-none-any.whl (18 kB) Downloading referencing-0.35.1-py3-none-any.whl (26 kB) Downloading rpds_py-0.19.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (355 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 355.8/355.8 kB 16.0 MB/s eta 0:00:00 Installing collected packages: rpds-py, referencing, jsonschema-specifications, jsonschema Successfully installed jsonschema-4.23.0 jsonschema-specifications-2023.12.1 referencing-0.35.1 rpds-py-0.19.0 [notice] A new release of pip is available: 24.1 -> 24.1.2 [notice] To update, run: pip install --upgrade pip ```
pip install --upgrade pip
Output: ``` Requirement already satisfied: pip in ./venv/lib/python3.11/site-packages (24.1) Collecting pip Downloading pip-24.1.2-py3-none-any.whl.metadata (3.6 kB) Downloading pip-24.1.2-py3-none-any.whl (1.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 25.5 MB/s eta 0:00:00 Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 24.1 Uninstalling pip-24.1: Successfully uninstalled pip-24.1 Successfully installed pip-24.1.2 ```
matrix-commander -m 'Test'
Traceback (most recent call last):
  File "/usr/local/bin/matrix-commander_without_flock", line 5, in <module>
    from matrix_commander import main
  File "/usr/local/lib/python3.11/dist-packages/matrix_commander/__init__.py", line 1, in <module>
    from .matrix_commander import main
  File "/usr/local/lib/python3.11/dist-packages/matrix_commander/matrix_commander.py", line 51, in <module>
    from nio import (AsyncClient, AsyncClientConfig, ContentRepositoryConfigError,
  File "/usr/local/lib/python3.11/dist-packages/nio/__init__.py", line 9, in <module>
    from .client import *
  File "/usr/local/lib/python3.11/dist-packages/nio/client/__init__.py", line 3, in <module>
    from .base_client import Client, ClientConfig
  File "/usr/local/lib/python3.11/dist-packages/nio/client/base_client.py", line 36, in <module>
    from ..crypto import ENCRYPTION_ENABLED, DeviceStore, OlmDevice, OutgoingKeyRequest
  File "/usr/local/lib/python3.11/dist-packages/nio/crypto/__init__.py", line 35, in <module>
    from .key_request import OutgoingKeyRequest
  File "/usr/local/lib/python3.11/dist-packages/nio/crypto/key_request.py", line 21, in <module>
    from ..responses import RoomKeyRequestResponse
  File "/usr/local/lib/python3.11/dist-packages/nio/responses.py", line 26, in <module>
    from jsonschema.exceptions import SchemaError, ValidationError
ModuleNotFoundError: No module named 'jsonschema'

Issues mentioning jsonschema do not seem interesting, except 8go/matrix-commander/issues/164.

Related to 8go/matrix-commander/issues/31.

Benjamin-Loison commented 4 months ago

For both root and benjamin,

sudo apt install -y python3-jsonschema
Output: ``` Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: python3-json-pointer python3-pyrsistent python3-rfc3987 python3-uritemplate python3-webcolors Suggested packages: python-jsonschema-doc The following NEW packages will be installed: python3-json-pointer python3-jsonschema python3-pyrsistent python3-rfc3987 python3-uritemplate python3-webcolors 0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. Need to get 175 kB of archives. After this operation, 953 kB of additional disk space will be used. Get:1 http://ftp.u-picardie.fr/debian stable/main amd64 python3-json-pointer all 2.3-2 [15.1 kB] Get:2 http://ftp.u-picardie.fr/debian stable/main amd64 python3-pyrsistent amd64 0.18.1-1+b3 [60.0 kB] Get:3 http://ftp.u-picardie.fr/debian stable/main amd64 python3-jsonschema all 4.10.3-1 [67.9 kB] Get:4 http://ftp.u-picardie.fr/debian stable/main amd64 python3-rfc3987 all 1.3.8-2 [8,816 B] Get:5 http://ftp.u-picardie.fr/debian stable/main amd64 python3-uritemplate all 4.1.1-2 [10.9 kB] Get:6 http://ftp.u-picardie.fr/debian stable/main amd64 python3-webcolors all 1.11.1-1 [12.7 kB] Fetched 175 kB in 0s (791 kB/s) Selecting previously unselected package python3-json-pointer. (Reading database ... 568428 files and directories currently installed.) Preparing to unpack .../0-python3-json-pointer_2.3-2_all.deb ... Unpacking python3-json-pointer (2.3-2) ... Selecting previously unselected package python3-pyrsistent:amd64. Preparing to unpack .../1-python3-pyrsistent_0.18.1-1+b3_amd64.deb ... Unpacking python3-pyrsistent:amd64 (0.18.1-1+b3) ... Selecting previously unselected package python3-jsonschema. Preparing to unpack .../2-python3-jsonschema_4.10.3-1_all.deb ... Unpacking python3-jsonschema (4.10.3-1) ... Selecting previously unselected package python3-rfc3987. Preparing to unpack .../3-python3-rfc3987_1.3.8-2_all.deb ... Unpacking python3-rfc3987 (1.3.8-2) ... Selecting previously unselected package python3-uritemplate. Preparing to unpack .../4-python3-uritemplate_4.1.1-2_all.deb ... Unpacking python3-uritemplate (4.1.1-2) ... Selecting previously unselected package python3-webcolors. Preparing to unpack .../5-python3-webcolors_1.11.1-1_all.deb ... Unpacking python3-webcolors (1.11.1-1) ... Setting up python3-uritemplate (4.1.1-2) ... Setting up python3-webcolors (1.11.1-1) ... Setting up python3-rfc3987 (1.3.8-2) ... Setting up python3-pyrsistent:amd64 (0.18.1-1+b3) ... Setting up python3-json-pointer (2.3-2) ... Setting up python3-jsonschema (4.10.3-1) ... ```

solved the issue.