practical-recommender-systems / moviegeek

A django website used in the book Practical Recommender Systems to illustrate how recommender algorithms can be implemented.
MIT License
903 stars 362 forks source link

django.core.exceptions.ValidationError #22

Closed miladfa7 closed 2 years ago

miladfa7 commented 5 years ago

sudo python3 -m builder.lda_model_calculator

Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None,"main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/milad/Desktop/moviegee/builder/lda_model_calculator.py", line 202, in lda.train(data, docs) File "/home/milad/Desktop/moviegee/builder/lda_model_calculator.py", line 82, in train self.build_lda_model(data, docs, NUM_TOPICS) File "/home/milad/Desktop/moviegee/builder/lda_model_calculator.py", line 117, in build_lda_model self.save_similarities(index, docs) File "/home/milad/Desktop/moviegee/builder/lda_model_calculator.py", line 143, in save_similarities self.save_similarities_with_django(index, docs, created) File "/home/milad/Desktop/moviegee/builder/lda_model_calculator.py", line 175, in save_similarities_with_django L.save() File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 718, in save force_update=force_update, update_fields=update_fields) File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 748, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 813, in _save_table forced_update) File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 862, in _do_update return filtered._update(values) > 0 File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 712, in _update return query.get_compiler(self.db).execute_sql(CURSOR) File "/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py", line 1387, in execute_sql cursor = super().execute_sql(result_type) File "/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py", line 1052, in execute_sql sql, params = self.as_sql() File "/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py", line 1353, in as_sql val = field.get_db_prep_save(val, connection=self.connection) File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/init.py", line 791, in get_db_prep_save return self.get_db_prep_value(value, connection=connection, prepared=False) File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/init.py", line 1281, in get_db_prep_value value = self.get_prep_value(value) File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/init.py", line 1274, in get_prep_value return self.to_python(value) File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/init.py", line 1248, in to_python params={'value': value},

django.core.exceptions.ValidationError: ["'420818' value has an invalid date format. It must be in YYYY-MM-DD format."]

kimfalk commented 5 years ago

Could you give some more details on what you have tried? It seems to me that there is a problem with the data you are using. I think 420818 is an id not a date.

miladfa7 commented 5 years ago

I run populate_sample_of_descriptions.py file then run sudo python3 -m builder.lda_model_calculator that I encounter this error

miladfa7 commented 5 years ago

420818 is a movie id, not date-time

brylie commented 5 years ago

@miladfa7 out of curiosity, what happens when running these commands in a virtual environment, rather than the global Python environment? Working in a virtual environment can avoid many unexpected bugs.

miladfa7 commented 5 years ago

@brylie thanks I run Sudo python3 -m builder.lda_model_calculator in global Python environment then again I encounter this error Did you run this command? did you not encounter an error?

brylie commented 5 years ago

Try creating a Python virtual environment. When you run sudo python3 ... you are using your global Python environment, which may have conflicting or outdated packages.

Follow the instructions in this repository to set up a Python virtual environment.

wassilakrouche commented 4 years ago

Hello, i'm sorry to write my comment here maybe this post is outdated but i have the same issue how did you fix it please ?