frappe / wiki

Free and Open Source Wiki built on top of Frappe
https://frappe.io/wiki
MIT License
226 stars 174 forks source link

Installation Dependency issues. #185

Closed littletuna4 closed 11 months ago

littletuna4 commented 11 months ago

Hi all, I've spent all afternoon trying to install the wiki app and now my instance has style issues for the wiki pages as pictured below. In addition to being visually broken, the wiki cannot be edited from the website side.

I was met with an integrity error due to redis versions (specifically, no module named redis.commands & issues with bleach versions) that I have attempted to resolve as per Goeffrey Karani's video along with a pip install -U redis bleach --force)

Finally, with the non-atomic app uninstallation handled, this is the installation statement I have used: docker exec -it <backend container id> bench get-app wiki --branch version-14 --resolve-deps --overwrite; docker exec -it <backend container id> bench install-app wiki;

Instance details:

Wiki app is installed on the frontend site.

image

Can anyone suggest a fix? Does the wiki app have to be on a different hostname to the website maybe?

Thanks in advance for any help.

BreadGenie commented 11 months ago

Hi, the errors are from mismatched dependencies with what you have in your system and what frappe requires. I'm not sure about why the styles are messed up. Can you try reinstalling wiki again?

littletuna4 commented 11 months ago

Thanks for the prompt reply @BreadGenie, being containerized, the dependencies can be managed independently to the system no?

I can only seem to avoid this error: no module named 'redis.commands' from File "apps/wiki/wiki/wiki/doctype/wiki_page/search.py", line 9, in <module> from redis.commands.search.field import TextField

by forcing this condition in the container: frappe 14.38.0 requires bleach~=3.3.0, but you have bleach 6.0.0 which is incompatible. frappe 14.38.0 requires redis~=3.5.3, but you have redis 5.0.1 which is incompatible.

Reinstallation of the wiki app has not changed anything - I'm considering a fresh frappe install.

BreadGenie commented 11 months ago

Thanks for the prompt reply @BreadGenie, being containerized, the dependencies can be managed independently to the system no?

Yes, That's what I meant but came out wrong 😅

frappe 14.38.0 requires bleach~=3.3.0, but you have bleach 6.0.0 which is incompatible. frappe 14.38.0 requires redis~=3.5.3, but you have redis 5.0.1 which is incompatible.

As long as you can install these packages following these versions the errors should go away.

The dependency issue and the style issue aren't related btw. The latter seems to be originating from something else.

littletuna4 commented 11 months ago

Ok thanks, do you have any insight as to why the version-14 branch seems to work, while the master branch does not? When I try to use the master branch, I get the following error (for all wiki-related doctypes): ImportError: Module import failed for Wiki Page, the DocType you're trying to open might be deleted. Error: cannot import name 'RedisClusterException' from 'redis.exceptions' (env/lib/python3.10/site-packages/redis/exceptions.py)

Once again, appreciate your help.

BreadGenie commented 11 months ago

Frappe Framework recently bumped the dependency versions of redis to 4.5.5 and bleach to 6.0.0 in develop branch but this isn't the case for version-14 of Frappe Framework. Reference: https://github.com/frappe/frappe/blob/develop/pyproject.toml

So inorder to be compatible with respective branches we are maintaining version-14 (compatible with only version-14) and master (compatible with develop and version-15-beta ).

littletuna4 commented 11 months ago

Additionally, this comes up in the error logs, I'm not sure exactly what the wiki module that's missing would refer to:

  File "apps/frappe/frappe/website/serve.py", line 17, in get_response
    endpoint, renderer_instance = path_resolver.resolve()
      path = 'wiki/home'
      http_status_code = 200
      response = None
      endpoint = 'wiki/home'
      path_resolver = <frappe.website.path_resolver.PathResolver object at 0x7fc3acead9f0>
      e = ModuleNotFoundError("No module named 'wiki'")
  File "apps/frappe/frappe/website/path_resolver.py", line 58, in resolve
    renderer_instance = renderer(endpoint, 200)
      self = <frappe.website.path_resolver.PathResolver object at 0x7fc3acead9f0>
      request = <Request 'http://localhost/wiki/home' [GET]>
      endpoint = 'wiki/home'
      custom_renderers = []
      renderers = [<class 'frappe.website.page_renderers.static_page.StaticPage'>, <class 'frappe.website.page_renderers.web_form.WebFormPage'>, <class 'frappe.website.page_renderers.document_page.DocumentPage'>, <class 'frappe.website.page_renderers.template_page.TemplatePage'>, <class 'frappe.website.page_renderers.list_page.ListPage'>, <class 'frappe.website.page_renderers.print_page.PrintPage'>, <class 'frappe.website.page_renderers.not_found_page.NotFoundPage'>]
      renderer = <class 'frappe.website.page_renderers.static_page.StaticPage'>
  File "apps/frappe/frappe/website/page_renderers/static_page.py", line 19, in __init__
    self.set_file_path()
      self = <frappe.website.page_renderers.static_page.StaticPage object at 0x7fc3ad0f11c0>
      path = 'wiki/home'
      http_status_code = 200
      __class__ = <class 'frappe.website.page_renderers.static_page.StaticPage'>
  File "apps/frappe/frappe/website/page_renderers/static_page.py", line 26, in set_file_path
    file_path = frappe.get_app_path(app, "www") + "/" + self.path
      self = <frappe.website.page_renderers.static_page.StaticPage object at 0x7fc3ad0f11c0>
      app = 'wiki'
      file_path = 'apps/erpnext/erpnext/www/wiki/home'
  File "apps/frappe/frappe/__init__.py", line 1357, in get_app_path
    return get_pymodule_path(app_name, *joins)
      app_name = 'wiki'
      joins = ('www',)
  File "apps/frappe/frappe/__init__.py", line 1374, in get_pymodule_path
    return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__ or ""), *joins)
      modulename = 'wiki'
      joins = ['www']
  File "apps/frappe/frappe/__init__.py", line 1328, in get_module
    return importlib.import_module(modulename)
      modulename = 'wiki'
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
      name = 'wiki'
      package = None
      level = 0
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      name = 'wiki'
      package = None
      level = 0
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      name = 'wiki'
      import_ = <function _gcd_import at 0x7fc3b0fcf400>
      module = <exception while printing> Traceback (most recent call last):
          File "env/lib/python3.10/site-packages/traceback_with_variables/core.py", line 222, in _to_cropped_str
            raw = print_(obj)
          File "apps/frappe/frappe/utils/__init__.py", line 335, in dict_printer
            if key in v:
        TypeError: argument of type 'object' is not iterable

  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
      name = 'wiki'
      import_ = <function _gcd_import at 0x7fc3b0fcf400>
      path = None
      parent = ''
      spec = None
builtins.ModuleNotFoundError: No module named 'wiki'
littletuna4 commented 11 months ago

Ok, I have resolved the dependency issue that resulted in the broken functionality (although this has not resolved the styles).

I'm not exactly sure why, but a docker exec -it <backend container id> bench pip uninstall wiki seemed to work.

This is the full statement I used each time while fiddling with the dependencies. docker exec -it <Backend Docker Container Id> bench uninstall-app wiki; docker exec -it <Backend Docker Container Id> bench remove-app wiki; echo 'DELETE FROM `tabModule Def` WHERE name="wiki"' | docker exec -i <Backend Docker Container Id> bench mariadb; docker exec -it <Backend Docker Container Id> bench get-app wiki --resolve-deps --overwrite; docker exec -it <Backend Docker Container Id> bench install-app wiki;