django-cms / cms-template

A Django template for a typical django CMS installation
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

fresh installtion of djangocms v4.1 generate error: no module named reportlab #5

Closed i-salameh95 closed 6 months ago

i-salameh95 commented 6 months ago

Description

after fresh installation of django cms 4.1 on Windows machine and python v3.9, when I try this command djangocms mysite

it generates the following error: ModuleNotFoundError: No module named 'reportlab'

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to https://www.django-cms.org/en/django-cms-4/
  2. Scroll down to "Install django CMS 4.1 locally"
  3. I have applied the commands described
  4. See the error screenshot1 &2

Expected behavior

if the reportlab and svglib is mandatory packages for django-cms, so then why its not put in the requirements ?

Actual behavior

error generated shown in the screenshot, after I have make pip install reportlab, and redo the command: djangocms mysite another error appear "no module named svglib", then I install it by pip install svglib then I continuo redo djangocms mysite, and the installation works like a charm.

Screenshots

Capture svg

Do you want to help fix this issue?

fsbraun commented 6 months ago

@i-salameh95 Good to hear from you! I just tried with python 3.9 and it worked just fine.

Some quick checks:

Install requirements in /private/tmp/test/mysite/requirements.in python -m pip install -r "/private/tmp/test/mysite/requirements.in"

Run migrations python -m manage migrate

i-salameh95 commented 6 months ago
(.venv) C:\Users\Israa\projects\nnuh-website-4.1>djangocms mysite

Clone template using django-admin
django-admin startproject "mysite" --template https://github.com/django-cms/cms-template/archive/4.1.tar.gz
cd "C:\Users\Israa\projects\nnuh-website-4.1\mysite"

Install requirements in C:\Users\Israa\projects\nnuh-website-4.1\mysite\requirements.in
python -m pip install -r "C:\Users\Israa\projects\nnuh-website-4.1\mysite\requirements.in"

Run migrations
python -m manage migrate
Traceback (most recent call last):
  File "C:\Users\Israa\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Israa\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Israa\projects\nnuh-website-4.1\mysite\manage.py", line 22, in <module>
    main()
  File "C:\Users\Israa\projects\nnuh-website-4.1\mysite\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\django\core\management\__init__.py", line 416, in execute
    django.setup()
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\django\apps\registry.py", line 116, in populate
    app_config.import_models()
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\django\apps\config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\Israa\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\filer\models\__init__.py", line 4, in <module>
    from .imagemodels import *  # noqa
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\filer\models\imagemodels.py", line 9, in <module>
    from .abstract import BaseImage
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\filer\models\abstract.py", line 10, in <module>
    from easy_thumbnails.VIL import Image as VILImage
  File "c:\users\israa\projects\nnuh-website-4.1\.venv\lib\site-packages\easy_thumbnails\VIL\Image.py", line 7, in <module>
    from reportlab.graphics import renderSVG
ModuleNotFoundError: No module named 'reportlab'
CommandError: c:\users\israa\projects\nnuh-website-4.1\.venv\scripts\python.exe -m manage migrate failed.

Also I have attached 6 screenshots of the whole tries, that I have done each time, hopefully it will help. I think the requirements.in should include reportlab and svglib

1 2 3 4 5 6

fsbraun commented 6 months ago

Both reportlab and svglib should be installed automatically: They are indirect dependencies. Can you check which version of django-filer and easy-thumbnails gets installed? (which pip version are you using?)

fsbraun commented 6 months ago

@i-salameh95 Can you try if djangocms myproject --template https://github.com/django-cms/cms-template/archive/fix/requirements.zip works for you. This fix makes the django-filer dependency explicit. If I compile the requirements.in file I get this (including svglib and reportlab):

#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
#    pip-compile --output-file=myproject/requirements.txt myproject/requirements.in
#
asgiref==3.8.1
    # via django
chardet==5.2.0
    # via reportlab
cssselect2==0.7.0
    # via svglib
django==4.2.11
    # via
    #   django-classy-tags
    #   django-cms
    #   django-entangled
    #   django-filer
    #   django-formtools
    #   django-parler
    #   django-polymorphic
    #   django-sekizai
    #   django-treebeard
    #   djangocms-admin-style
    #   djangocms-alias
    #   djangocms-frontend
    #   djangocms-versioning
    #   easy-thumbnails
django-classy-tags==4.1.0
    # via
    #   django-cms
    #   django-sekizai
django-cms==4.1.0
    # via
    #   djangocms-alias
    #   djangocms-attributes-field
    #   djangocms-frontend
    #   djangocms-text-ckeditor
    #   djangocms-versioning
django-entangled==0.5.4
    # via djangocms-frontend
django-filer==3.1.1
    # via
    #   -r myproject/requirements.in
    #   djangocms-frontend
django-formtools==2.5.1
    # via django-cms
django-fsm==2.8.1
    # via djangocms-versioning
django-parler==2.3
    # via djangocms-alias
django-polymorphic==3.1.0
    # via django-filer
django-sekizai==4.1.0
    # via django-cms
django-treebeard==4.7.1
    # via django-cms
djangocms-admin-style==3.3.1
    # via django-cms
djangocms-alias==2.0.1
    # via -r myproject/requirements.in
djangocms-attributes-field==3.0.0
    # via djangocms-frontend
djangocms-frontend==1.3.0
    # via -r myproject/requirements.in
djangocms-text-ckeditor==5.1.5
    # via
    #   -r myproject/requirements.in
    #   djangocms-frontend
djangocms-versioning==2.0.1
    # via -r myproject/requirements.in
easy-thumbnails[svg]==2.8.5
    # via
    #   django-filer
    #   djangocms-frontend
html5lib==1.1
    # via djangocms-text-ckeditor
lxml==5.1.1
    # via svglib
packaging==24.0
    # via
    #   django-cms
    #   djangocms-text-ckeditor
pillow==10.2.0
    # via
    #   djangocms-text-ckeditor
    #   easy-thumbnails
    #   reportlab
reportlab==4.1.0
    # via
    #   easy-thumbnails
    #   svglib
six==1.16.0
    # via html5lib
sqlparse==0.4.4
    # via django
svglib==1.5.1
    # via easy-thumbnails
tinycss2==1.2.1
    # via
    #   cssselect2
    #   svglib
typing-extensions==4.10.0
    # via asgiref
webencodings==0.5.1
    # via
    #   cssselect2
    #   html5lib
    #   tinycss2

# The following packages are considered to be unsafe in a requirements file:
# setuptools
i-salameh95 commented 6 months ago

Both reportlab and svglib should be installed automatically: They are indirect dependencies. Can you check which version of django-filer and easy-thumbnails gets installed? (which pip version are you using?)

pip version 20.2.3, django-filer version 3.1.1 , easy-thumbnails 2.8.5

i-salameh95 commented 6 months ago

djangocms myproject --template https://github.com/django-cms/cms-template/archive/fix/requirements.zip

I have tried this command, the same error about report lab appear..

and this is the requirements.in file installed :

djangocms-versioning
djangocms-alias
djangocms-frontend
django-filer
djangocms-text-ckeditor
i-salameh95 commented 6 months ago

btw, upgrading the pip from version 20.2.3 to version 24.0 fixed the problem

fsbraun commented 6 months ago

Will add a note to the readme to point this out! Thanks!