clefincode / clefincode_chat

ERPNext/Frappe Business Chat: A self-hosted communication solution.
https://clefincode.com
Other
37 stars 32 forks source link

error occurred while installing clefincode_chat #7

Open Tachtas opened 4 weeks ago

Tachtas commented 4 weeks ago

ERPNext ver15.39.3 Arm64

I got this error when installing:

Installing clefincode_chat... An error occurred while installing clefincode_chat: ('Module Def', 'ClefinCode Chat', IntegrityError(1062, "Duplicate entry 'ClefinCode Chat' for key 'PRIMARY'")) Traceback with variables (most recent call last): File "apps/frappe/frappe/commands/site.py", line 452, in install_app _install_app(app, verbose=context.verbose, force=force) context = {'sites': ['frontend'], 'force': False, 'verbose': False, 'profile': False} apps = ('clefincode_chat',) force = False _install_app = <function install_app at 0xfe93579e8720> filelock = <function filelock at 0xfe93579d9e40> exit_code = 0 site = 'frontend' app = 'clefincode_chat' err = DuplicateEntryError('Module Def', 'ClefinCode Chat', IntegrityError(1062, "Duplicate entry 'ClefinCode Chat' for key 'PRIMARY'")) File "apps/frappe/frappe/installer.py", line 310, in install_app add_module_defs(name, ignore_if_duplicate=force) name = 'clefincode_chat' verbose = False set_as_patched = True force = False sync_jobs = <function sync_jobs at 0xfe9356fed120> sync_for = <function sync_for at 0xfe9356fee0c0> sync_customizations = <function sync_customizations at 0xfe93584dc9a0> sync_fixtures = <function sync_fixtures at 0xfe9356fee3e0> app_hooks = {'after_install': ['clefincode_chat.setup.install.after_install'], 'after_migrate': ['clefincode_chat.setup.after_migrate.after_migrate'], 'app_description': ['ERPNext & Frappe Business Chat: A self-hosted communication solution.'], 'app_email': ['info@clefincode.com'], 'app_include_css': ['clefincode_chat.bundle.css'], 'app_include_js': ['clefincode_chat.bundle.js', 'override.bundle.js'], 'app_license': ['GNU General Public License (v3)'], 'app_name': ['clefincode_chat'], 'app_publisher': ['ClefinCode L.L.C-FZ'], 'app_title': ['ClefinCode Chat'], 'app_version': ['1.1.1'], 'doc_events': {'Contact': {'after_insert': ['clefincode_chat.api.api_1_0_1.api.sync_with_chat_profile'], 'on_update': ['clefincode_chat.api.api_1_0_1.api.sync_with_chat_profile']}}, 'frappe_version': ['15.44.2'], 'guest_title': ['ClefinCode Chat'], 'is_frappe_above_v13': [True], 'override_whitelisted_methods': {'frappe.desk.form.load.getdoc': ['clefincode_chat.desk.custom_load.getdoc'], 'frappe.desk.form.load.get_doc... installed_apps = ['frappe', 'erpnext', 'commit', 'whitelabel', 'quick_kanban', 'print_designer'] File "apps/frappe/frappe/installer.py", line 650, in add_module_defs d.insert(ignore_permissions=True, ignore_if_duplicate=ignore_if_duplicate) app = 'clefincode_chat' ignore_if_duplicate = False modules = ['ClefinCode Chat'] module = 'ClefinCode Chat' d = File "apps/frappe/frappe/model/document.py", line 302, in insert self.db_insert(ignore_if_duplicate=ignore_if_duplicate) self = ignore_permissions = True ignore_links = None ignore_if_duplicate = False ignore_mandatory = None set_name = None set_child_names = True File "apps/frappe/frappe/model/base_document.py", line 581, in db_insert raise frappe.DuplicateEntryError(self.doctype, self.name, e) self = ignore_if_duplicate = False conflict_handler = '' d = {'name': 'ClefinCode Chat', 'creation': '2024-10-28 21:29:24.453515', 'modified': '2024-10-28 21:29:24.453515', 'modified_by': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'idx': 0, 'module_name': 'ClefinCode Chat', 'custom': 0, 'package': None, 'app_name': 'clefincode_chat', 'restrict_to_domain': None, '_user_tags': None, '_comments': None, '_assign': None, '_liked_by': None} columns = ['name', 'creation', 'modified', 'modified_by', 'owner', 'docstatus', 'idx', 'module_name', 'custom', 'package', 'app_name', 'restrict_to_domain', '_user_tags', '_comments', '_assign', '_liked_by'] frappe.exceptions.DuplicateEntryError: ('Module Def', 'ClefinCode Chat', IntegrityError(1062, "Duplicate entry 'ClefinCode Chat' for key 'PRIMARY'"))

clefincode commented 3 weeks ago

Hi, thank you for your feedback, in order to solve this please follow this steps: bench --site mariadb DELETE FROM tabModule Def WHERE module_name = 'ClefinCode Chat'; exit bench clear-cache bench --site migrate

you can install the app again let me know if you need any more help

Tachtas commented 3 weeks ago

got error : frappe.exceptions.DoesNotExistError: DocType ClefinCode Chat Settings not found

clefincode commented 1 week ago

We have just uploaded a fix for this case. Please update your repository and then follow these steps: Uninstall the app: bench uninstall-app clefincode_chat Access the database: bench mariadb Run the following queries to avoid duplicates later:

DELETE FROM tabModule Def WHERE module_name = 'ClefinCode Chat'; DELETE FROM tabDocType WHERE name = 'ClefinCode Chat Channel'; DELETE FROM tabSingles WHERE doctype = 'ClefinCode Chat Settings'; Reinstall the app: bench install-app clefincode_chat After completing these steps, the app should work without any issues, and you will be able to use the mobile app with real-time notifications.

Tachtas commented 1 week ago

i got another error when installing, but the app were installed just fine

frappe@0701494fde7d:~/frappe-bench$ bench --site frontend install-app clefincode_chat

Installing clefincode_chat...
Updating DocTypes for clefincode_chat: [========================================] 100%
An error occurred while installing clefincode_chat: [Errno 2] No such file or directory: 'sudo'
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 478, in install_app
    _install_app(app, verbose=context.verbose, force=force)
      context = {'sites': ['frontend'], 'force': False, 'verbose': False, 'profile': False}
      apps = ('clefincode_chat',)
      force = False
      _install_app = <function install_app at 0xf4b3baedc400>
      filelock = <function filelock at 0xf4b3baecdb20>
      exit_code = 0
      site = 'frontend'
      app = 'clefincode_chat'
      err = FileNotFoundError(2, 'No such file or directory')
  File "apps/frappe/frappe/installer.py", line 326, in install_app
    frappe.get_attr(after_install)()
      name = 'clefincode_chat'
      verbose = False
      set_as_patched = True
      force = False
      sync_jobs = <function sync_jobs at 0xf4b3bac68fe0>
      sync_for = <function sync_for at 0xf4b3bac69f80>
      sync_customizations = <function sync_customizations at 0xf4b3bbbfcb80>
      sync_fixtures = <function sync_fixtures at 0xf4b3bac6a2a0>
      app_hooks = {'after_install': ['clefincode_chat.setup.install.after_install'], 'after_migrate': ['clefincode_chat.setup.after_migrate.after_migrate'], 'app_description': ['ERPNext & Frappe Business Chat: A self-hosted communication solution.'], 'app_email': ['info@clefincode.com'], 'app_include_css': ['clefincode_chat.bundle.css'], 'app_include_js': ['clefincode_chat.bundle.js', 'override.bundle.js'], 'app_license': ['GNU General Public License (v3)'], 'app_name': ['clefincode_chat'], 'app_publisher': ['ClefinCode L.L.C-FZ'], 'app_title': ['ClefinCode Chat'], 'app_version': ['1.1.2'], 'doc_events': {'Contact': {'after_insert': ['clefincode_chat.api.api_1_0_1.api.sync_with_chat_profile'], 'on_update': ['clefincode_chat.api.api_1_0_1.api.sync_with_chat_profile']}}, 'frappe_version': ['15.47.2'], 'guest_title': ['ClefinCode Chat'], 'is_frappe_above_v13': [True], 'override_whitelisted_methods': {'frappe.desk.form.load.getdoc': ['clefincode_chat.desk.custom_load.getdoc'], 'frappe.desk.form.load.get_doc...
      installed_apps = ['frappe', 'erpnext', 'whitelabel', 'print_designer', 'dfp_external_storage']
      after_install = 'clefincode_chat.setup.install.after_install'
  File "apps/clefincode_chat/clefincode_chat/setup/install.py", line 7, in after_install
    install_ffmpeg()
  File "apps/clefincode_chat/clefincode_chat/setup/install.py", line 92, in install_ffmpeg
    subprocess.run(["sudo", "apt", "update", "--fix-missing" , "-y",], check=True)
  File "/usr/local/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
      input = None
      capture_output = False
      timeout = None
      check = True
      popenargs = (['sudo', 'apt', 'update', '--fix-missing', '-y'],)
      kwargs = {}
  File "/usr/local/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
      self = <Popen: returncode: 255 args: ['sudo', 'apt', 'update', '--fix-missing', '-y']>
      args = ['sudo', 'apt', 'update', '--fix-missing', '-y']
      bufsize = -1
      executable = None
      stdin = None
      stdout = None
      stderr = None
      preexec_fn = None
      close_fds = True
      shell = False
      cwd = None
      env = None
      universal_newlines = None
      startupinfo = None
      creationflags = 0
      restore_signals = True
      start_new_session = False
      pass_fds = ()
      user = None
      group = None
      extra_groups = None
      encoding = None
      errors = None
      text = None
      umask = -1
      pipesize = -1
      process_group = -1
      gid = None
      gids = None
      uid = None
      p2cread = -1
      p2cwrite = -1
      c2pread = -1
      c2pwrite = -1
      errread = -1
      errwrite = -1
  File "/usr/local/lib/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
      self = <Popen: returncode: 255 args: ['sudo', 'apt', 'update', '--fix-missing', '-y']>
      args = ['sudo', 'apt', 'update', '--fix-missing', '-y']
      executable = b'sudo'
      preexec_fn = None
      close_fds = True
      pass_fds = ()
      cwd = None
      env = None
      startupinfo = None
      creationflags = 0
      shell = False
      p2cread = -1
      p2cwrite = -1
      c2pread = -1
      c2pwrite = -1
      errread = -1
      errwrite = -1
      restore_signals = True
      gid = None
      gids = None
      uid = None
      umask = -1
      start_new_session = False
      process_group = -1
      orig_executable = 'sudo'
      errpipe_read = 9
      errpipe_write = 10
      low_fds_to_close = []
      env_list = None
      executable_list = (b'/home/frappe/.nvm/versions/node/v18.18.2/bin/sudo', b'/usr/local/bin/sudo', b'/usr/local/sbin/sudo', b'/usr/local/bin/sudo', b'/usr/sbin/sudo', b'/usr/bin/sudo', b'/sbin/sudo', b'/bin/sudo')
      fds_to_keep = {10}
      errpipe_data = bytearray(b'OSError:2:')
      part = b''
      pid = 296
      sts = 65280
      exception_name = bytearray(b'OSError')
      hex_errno = bytearray(b'2')
      err_msg = 'No such file or directory'
      child_exception_type = <class 'OSError'>
      errno_num = 2
      child_exec_never_called = False
      err_filename = 'sudo'
builtins.FileNotFoundError: [Errno 2] No such file or directory: 'sudo'
jligabitie commented 1 week ago

I have tried to install clefincode_chat in my frappe cloud, but it failed. Bench version: 5.22.6 Node version: 18.16.0 Python Version: 3.11

When I install te app in the bench group, I got this message:

Getting clefincode_chat $ git clone file:///home/frappe/context/apps/clefincode_chat --depth 1 --origin upstream Cloning into 'clefincode_chat'... Ignoring dependencies of file:///home/frappe/context/apps/clefincode_chat. To install dependencies use --resolve-deps Installing clefincode_chat $ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/clefincode_chat DEPRECATION: Legacy editable install of clefincode-chat==0.0.4 from file:///home/frappe/frappe-bench/apps/clefincode_chat (setup.py develop) is deprecated. pip 25.0 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at https://github.com/pypa/pip/issues/11457 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. frappe 15.47.2 requires google-api-python-client~=2.2.0, but you have google-api-python-client 2.153.0 which is incompatible. frappe 15.47.2 requires google-auth~=1.29.0, but you have google-auth 2.36.0 which is incompatible. $ bench build --app clefincode_chat ..................................

While when I installed the app in the site, it has failed, and I got this message:

Installing clefincode_chat... Updating DocTypes for clefincode_chat: [========================================] 100% An error occurred while installing clefincode_chat: [Errno 2] No such file or directory: 'sudo' Traceback with variables (most recent call last): File "apps/frappe/frappe/commands/site.py", line 478, in install_app _install_app(app, verbose=context.verbose, force=force) context = {'sites': ['gabitie.erpnext.com'], 'force': False, 'verbose': False, 'profile': False} ......... builtins.FileNotFoundError: [Errno 2] No such file or directory: 'sudo'

clefincode commented 1 week ago

@Tachtas It seems that your Linux user (e.g., ubuntu for Frappe or another username) does not have administrative privileges. To verify if sudo is installed, run the following command: which sudo If sudo is not installed, you can install it with these commands: su apt-get install sudo -y Once sudo is installed, check your Linux user's privileges by running: sudo whoami The expected response should be: root If it doesn't return "root," you need to add your user to the sudo group by running: su usermod -aG sudo After making this change, log out and log back in for the changes to take effect. now remove the app and reinstall it please

clefincode commented 1 week ago

@jligabitie It seems you are using the "develop" branch on Frappe Cloud. Please note that we have a custom branch for the Frappe Marketplace named "develop-marketplace."

To resolve this, kindly remove the app and reinstall it using the correct branch.

jligabitie commented 1 week ago

Hi.thanks for your reply. I am using frappe cloud for the erpnext and it was installed through the frappe cloud platform. I am not sure how I can use sudo for the installation. can you help. Many thanks

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: ClefinCode @.> Sent: Tuesday, November 19, 2024 3:37:19 PM To: clefincode/clefincode_chat @.> Cc: jligabitie @.>; Comment @.> Subject: Re: [clefincode/clefincode_chat] error occurred while installing clefincode_chat (Issue #7)

@Tachtashttps://github.com/Tachtas It seems that your Linux user (e.g., ubuntu for Frappe or another username) does not have administrative privileges. To verify if sudo is installed, run the following command: which sudo If sudo is not installed, you can install it with these commands: su apt-get install sudo -y Once sudo is installed, check your Linux user's privileges by running: sudo whoami The expected response should be: root If it doesn't return "root," you need to add your user to the sudo group by running: su usermod -aG sudo After making this change, log out and log back in for the changes to take effect. now remove the app and reinstall it please

— Reply to this email directly, view it on GitHubhttps://github.com/clefincode/clefincode_chat/issues/7#issuecomment-2484902532, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BIBNFSIVHWVFHXC524E332T2BLTC7AVCNFSM6AAAAABQXMMBOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBUHEYDENJTGI. You are receiving this because you commented.Message ID: @.***>

clefincode commented 1 week ago

@jligabitie my comment about sudo wasn't for your case, just make sure you are using our customize branch for frappe cloud the name of the branch is "develop-marketplace"

Tachtas commented 1 week ago

i am using this method for my deployment : https://github.com/frappe/frappe_docker/blob/main/docs/custom-apps.md the user is frappe without privileges

jligabitie commented 1 week ago

Thanks, I have chosen the develop-marketplace, but when bench started to update, which option I should use? [image: image.png]

On Tue, 19 Nov 2024 at 08:53, ClefinCode @.***> wrote:

@jligabitie https://github.com/jligabitie my comment about sudo wasn't for your case, just make sure you are using our customize branch for frappe cloud the name of the branch is "develop-marketplace"

— Reply to this email directly, view it on GitHub https://github.com/clefincode/clefincode_chat/issues/7#issuecomment-2485071737, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIBNFSNXZJO3CEB3FO5JIY32BL4BLAVCNFSM6AAAAABQXMMBOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBVGA3TCNZTG4 . You are receiving this because you were mentioned.Message ID: @.***>

clefincode commented 1 week ago

@jligabitie these option is a commits just select the latest, always the first one from top

jligabitie commented 1 week ago

Hi, Thank for your help. Even I have installed the app, but I only saw few users in the contact list. I wonder how to make all other users in the list? Many Thanks again [image: image.png]

On Tue, 19 Nov 2024 at 12:18, ClefinCode @.***> wrote:

@jligabitie https://github.com/jligabitie these option is a commits just select the latest, always the first one from top

— Reply to this email directly, view it on GitHub https://github.com/clefincode/clefincode_chat/issues/7#issuecomment-2485504211, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIBNFSOZV6MNJC5TWJ3CETD2BMUBBAVCNFSM6AAAAABQXMMBOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBVGUYDIMRRGE . You are receiving this because you were mentioned.Message ID: @.***>