practical-recommender-systems / moviegeek Goto Github PK
View Code? Open in Web Editor NEWA django website used in the book Practical Recommender Systems to illustrate how recommender algorithms can be implemented.
License: MIT License
A django website used in the book Practical Recommender Systems to illustrate how recommender algorithms can be implemented.
License: MIT License
I clicked the buy option but all recommendations are not showing. Only popular recommendations are shown. What I need to do for all sorts of recommendation?
i can't see any movies at the porject ,thank you
Working with a virtual environment running py 3.6 on windows 10. Trying to get the Django site working. Initially ran into an issue with requiring the API key to be in a file named '.prs' since this was not a valid filename. At least think I have managed to circumvent this by naming it differently and updating the script which raised the error (might be others I need to address as I go along?)
Anyways, after making that fix I now get the following error:
JSONDecodeError at /
Expecting value: line 1 column 23 (char 22)
Request Method: GET
Request URL: http://127.0.0.1:8001/
Django Version: 1.11
Exception Type: JSONDecodeError
Exception Value:
Expecting value: line 1 column 23 (char 22)
Exception Location: C:\Users<username>\Anaconda3\envs\prs\lib\json\decoder.py in raw_decode, line 357
Python Executable: C:\Users<username>\Anaconda3\envs\prs\python.exe
Python Version: 3.6.4
Python Path:
['C:\Users\\Documents\GitHub\moviegeek',
'C:\Users\\Anaconda3\envs\prs\python36.zip',
'C:\Users\\Anaconda3\envs\prs\DLLs',
'C:\Users\\Anaconda3\envs\prs\lib',
'C:\Users\\Anaconda3\envs\prs',
'C:\Users\\Anaconda3\envs\prs\lib\site-packages']
Server time: Fri, 9 Feb 2018 17:58:34 +0000
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8001/
Django Version: 1.11
Python Version: 3.6.4
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
'moviegeeks',
'collector',
'analytics',
'recommender']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "C:\Users<username>\Anaconda3\envs\prs\lib\json\decoder.py" in raw_decode
355. obj, end = self.scan_once(s, idx)
During handling of the above exception (22), another exception occurred:
File "C:\Users<username>\Anaconda3\envs\prs\lib\site-packages\django\core\handlers\exception.py" in inner
41. response = get_response(request)
File "C:\Users<username>\Anaconda3\envs\prs\lib\site-packages\django\core\handlers\base.py" in _legacy_get_response
249. response = self._get_response(request)
File "C:\Users<username>\Anaconda3\envs\prs\lib\site-packages\django\core\handlers\base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "C:\Users<username>\Anaconda3\envs\prs\lib\site-packages\django\core\handlers\base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users<username>\Anaconda3\envs\prs\lib\site-packages\django\utils\decorators.py" in _wrapped_view
149. response = view_func(request, *args, **kwargs)
File "C:\Users<username>\Documents\GitHub\moviegeek\moviegeeks\views.py" in index
14. api_key = get_api_key()
File "C:\Users<username>\Documents\GitHub\moviegeek\moviegeeks\views.py" in get_api_key
140. cred = json.loads(open("prs_api_key").read())
File "C:\Users<username>\Anaconda3\envs\prs\lib\json_init_.py" in loads
354. return _default_decoder.decode(s)
File "C:\Users<username>\Anaconda3\envs\prs\lib\json\decoder.py" in decode
339. obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users<username>\Anaconda3\envs\prs\lib\json\decoder.py" in raw_decode
357. raise JSONDecodeError("Expecting value", s, err.value) from None
Any help would greatly appreciated!
Hi, In moviegeek, inappropriate dependency versioning constraints can cause risks.
Below are the dependencies and version constraints that the project is using
appdirs==1.4.3
boto==2.49.0
boto3==1.9.45
botocore==1.12.45
bz2file==0.98
certifi==2018.10.15
chardet==3.0.4
cycler==0.10.0
Django==2.2.27
django-extensions==2.1.3
docutils==0.14
gensim==3.6.0
idna==2.7
jmespath==0.9.3
kiwisolver==1.0.1
matplotlib==3.0.2
numpy==1.22.2
pandas==1.4.1
packaging==16.8
pyparsing==2.3.0
python-dateutil==2.8.2
pytz==2021.3
requests==2.20.1
s3transfer==0.1.13
scipy==1.8.0
seaborn==0.8.1
six==1.11.0
sklearn==0.0
smart-open==1.7.1
stop-words==2015.2.23.1
tqdm==4.28.1
urllib3==1.26.5
pyLDAvis==2.1.1
The version constraint == will introduce the risk of dependency conflicts because the scope of dependencies is too strict.
The version constraint No Upper Bound and * will introduce the risk of the missing API Error because the latest version of the dependencies may remove some APIs.
After further analysis, in this project,
The version constraint of dependency botocore can be changed to >=0.23.0,<=1.12.253.
The version constraint of dependency Django can be changed to >=1.7,<=1.11.29.
The version constraint of dependency django-extensions can be changed to >=0.7,<=3.1.5.
The version constraint of dependency gensim can be changed to >=0.9.0,<=0.13.2.
The version constraint of dependency matplotlib can be changed to >=1.3.0,<=3.0.3.
The version constraint of dependency pandas can be changed to >=0.20.0,<=0.24.2.
The version constraint of dependency requests can be changed to >=0.2.1,<=0.2.3.
The version constraint of dependency requests can be changed to >=0.7.0,<=2.24.0.
The version constraint of dependency requests can be changed to ==2.26.0.
The version constraint of dependency scipy can be changed to >=0.12.0,<=0.17.1.
The version constraint of dependency pyLDAvis can be changed to >=1.0.0,<=1.3.2.
The version constraint of dependency pyLDAvis can be changed to >=1.3.4,<=3.2.2.
The above modification suggestions can reduce the dependency conflicts as much as possible,
and introduce the latest version as much as possible without calling Error in the projects.
The invocation of the current project includes all the following methods.
requests.get
django.http.JsonResponse django.http.HttpResponse django.conf.urls.include django.core.wsgi.get_wsgi_application django.shortcuts.render django.setup django.conf.urls.url django.core.management.execute_from_command_line
json.loads
gensim.models.ldamodel.LdaModel.print_topics gensim.models.ldamodel.LdaModel.save gensim.corpora.Dictionary.doc2bow gensim.models.ldamodel.LdaModel.load gensim.similarities.MatrixSimilarity gensim.corpora.Dictionary gensim.models.ldamodel.LdaModel
matplotlib.use
pandas.unique json.loads pandas.DataFrame.from_records
requests.get
scipy.sparse.coo_matrix scipy.sparse.dok_matrix scipy.sparse.dok_matrix.tocsr scipy.sparse.coo_matrix.tocsr scipy.sparse.coo_matrix.transpose
pyLDAvis.gensim.prepare
analytics.models.Rating.save self.finished load_data analytics.models.Rating.objects.filter.delete ratings.cat.codes.copy self.builder.build ratings.isin.groupby selected.movies.all.order_by self.min_sim.Q.item_id.Q.movie_ids.keys.Q.LdaSimilarity.objects.filter.order_by.order_by pyLDAvis.gensim.prepare numpy.random.shuffle url.format evaluator.evaluation_runner.EvaluationRunner.calculate content_id.Log.objects.filter.order_by cursor.fetchall logging.getLogger candidate_items.distinct.order_by.order_by self.calculate_feature_functions_for_training_data content_id.SeededRecs.objects.filter.order_by set gensim.corpora.Dictionary ratings.user_id.unique self.cf.predict_score recommender.models.Similarity.objects.all sample self._get_conn django.db.models.Count.Rating.objects.values.annotate.filter download_movies.split sorted gensim.corpora.MmCorpus.serialize moviegeeks.models.Genre.objects.all self.l.info moviegeeks.models.Genre.objects.get_or_create content_id.Log.objects.filter.order_by.values moviegeeks.models.Movie.objects.all.delete end_date.start_date.Log.objects.filter.values logging.getLogger.info self.item_sum.reset_index movie.genres.all log_file.write retrieve_buy_events self.item_counts.reset_index frozenset select_action x.tolist.train_data.groupby.apply.to_dict dict requests.get self.rec.predict_score_by_ratings collections.OrderedDict self.min_overlap.overlap_matrix.count_nonzero rated_movies.len.num.sorted_scores.astype x.astype.std get_genres coo.transpose.astype logfile.flush main self.split_users FWLSCalculator.train i_fac.dot analytics.models.Rating.objects.values user_id.Rating.objects.filter.order_by.values django.db.models.Avg.item_id.Rating.objects.filter.values.annotate.first LdaModel self.item_factors.T.dot this_test_ratings.unique ItemSimilarityMatrixBuilder int user_id.Q.Rating.objects.filter.values django.db.models.Count.ratings.values.Rating.objects.filter.values.annotate.filter.values matplotlib.pyplot.figure uuid.uuid1 bool.x.astype.sum django.db.models.Count.Rating.objects.values.annotate.order_by get_api_key json.dump train_data.groupby.apply genres.items.items django.db.models.DateTimeField download_ratings.split django.db.models.DateField user_count.groupby.count analytics.models.Rating.objects.all.values ItemSimilarityMatrixBuilder.build items.filter.annotate seeds.seeds.SeededRecs.objects.filter.exclude.values.annotate self.item_factors.T.dot.sort_values self.rec.recommend_items_by_ratings math.sqrt calculate_implicit_ratings_w_timedecay dictionary.items ratings_df.as_matrix FWLSCalculator.get_real_training_data analytics.models.Cluster.objects.all analytics.models.Rating.objects.all moviegeeks.models.Movie.objects.all load_all_ratings.groupby django.shortcuts.render sklearn.cluster.KMeans.fit numpy.apply_along_axis django.db.migrations.CreateModel selected.movies.all Z.reshape.reshape nltk.tokenize.RegexpTokenizer ratings.groupby.count int.bool.coo.astype.astype.dot.count_nonzero django.db.models.Avg.Rating.objects.all.aggregate.values calculate_implicit_ratings_for_user self.draw analytics.models.Rating.objects.values.annotate user_count.reset_index.reset_index zip.items collector.models.Log.save builder.item_similarity_calculator.ItemSimilarityMatrixBuilder analytics.models.Cluster.objects.all.delete rule.rule.rule.str.rule.str.rule.SeededRecs.save candidate_items.distinct.order_by scipy.sparse.coo_matrix.count_nonzero self.predict.tolist moviegeeks.models.Movie.objects.get_or_create.split moviegeeks.models.Movie.objects.get_or_create calculate_association_rules handle_pagination item_id.user_id.Rating.objects.filter.exclude.order_by RecommenderCoverage.calculate_coverage evaluate_pop_recommender collections.defaultdict.items moviegeeks.models.Genre.objects.all.values.distinct.values django.core.paginator.Paginator.page sklearn.decomposition.PCA.fit_transform.min gensim.similarities.MatrixSimilarity random.sample user_id.Rating.objects.filter.order_by user_id.Rating.objects.filter.exclude collector.models.Log.objects.filter.values recommender.models.MovieDescriptions.objects.all str self.get_real_training_data self.step populate content_id.Movie.objects.filter.first dictfetchall user_id.Log.objects.filter.order_by.values len ratings.append d.lower training_data_for_user.to_dict self.log user_id.Log.objects.filter.order_by time.sleep dot_product self.recommend_items_by_ratings moviegeeks.models.Movie.objects.filter.values logging.basicConfig dict.keys next self.prediction argparse.ArgumentParser.add_argument random.randint time.time exit builder.fwls_calculator.FWLSCalculator genres.items.append matplotlib.pyplot.scatter sklearn.decomposition.PCA os.path.dirname self.recommender.self.K.PrecisionAtK.calculate_mean_average_precision pandas.DataFrame builder.item_similarity_calculator.ItemSimilarityMatrixBuilder.build builder.bpr_calculator.BayesianPersonalizationRanking django.setup user.select_genre recommender.models.SeededRecs builder.lda_model_calculator.LdaModel.build analytics.models.Rating.objects.values.distinct recs.fwls_recommender.FeatureWeightedLinearStacking.recommend_items os.environ.setdefault ratings.difference.np.apply_along_axis.sum MatrixFactorization.train gensim.models.ldamodel.LdaModel logging.getLogger.debug scipy.sparse.coo_matrix.nonzero self._save_with_django load_all_ratings movie.genres.all.values genres.items.keys scipy.sparse.dok_matrix.tocsr datetime.timedelta self.save_lda_model userid.Log.objects.filter.values.annotate django.db.connection.cursor.execute cor.multiply.multiply RecommenderCoverage math.exp sqlite3.connect scipy.sparse.coo_matrix.tocsr yy.min x.astype.min x.astype.astype seeds.SeededRecs.objects.filter.exclude dict.items collector.models.Log.objects.all numpy.random.seed sklearn.linear_model.LinearRegression.fit self.train_data.sample recommender.models.MovieDescriptions.objects.get_or_create.save print self.min_sim.Q.item_id.Q.movie_ids.keys.Q.LdaSimilarity.objects.filter.order_by item_id.Q.user_id.Q.Rating.objects.filter.values.aggregate session_id transaction_id.transactions.append get_descriptions django.db.models.FloatField calculate_implicit_ratings_for_user.items recs.bpr_recommender.BPRRecs matplotlib.pyplot.xlim delete_db min_number_of_ratings.Count.Rating.objects.values.annotate.filter.order_by.values_list self.assertEqual list.append django.db.migrations.AlterField moviegeeks.models.Movie.objects.all.count ratings.isin.sum save_rules recs.popularity_recommender.PopularityBasedRecs.recommend_items_from_log columns.train_data.as_matrix calculate_support_confidence scipy.sparse.dok_matrix has_support nltk.tokenize.RegexpTokenizer.tokenize matplotlib.pyplot.plot self.user_recs.append ratings.groupby.transform open django.shortcuts.redirect django.core.management.execute_from_command_line django.db.models.Avg.seeds.seeds.SeededRecs.objects.filter.exclude.values.annotate.order_by ratings.values.Rating.objects.filter.values.annotate self.predict r.json.loads self.fun2 self.logger.info list recommender.models.Similarity.objects.filter analytics.models.Rating.objects.filter.values content_ids.LdaSimilarity.objects.filter.order_by.values self.user_bias.keys load_all_ratings.as_matrix django.db.models.Avg self.load_all_ratings datetime.datetime.fromtimestamp r.json.dump self.item_bias.items.sorted.collections.OrderedDict.values super ratings.values.Rating.objects.filter.values sklearn.metrics.pairwise.cosine_similarity self.train self.build_lda_model recs.items self.i_inx.keys moviegeeks.models.Genre.objects.all.values.distinct LdaModel.train self.add_user_recs recommender.models.Similarity.objects.bulk_create recommender.models.MovieDescriptions.objects.get_or_create self.calculate_using_ratings this_user.users.keys item_ids.Q.Rating.objects.filter.values.annotate numpy.random.random_sample recommender.models.Recs.objects.filter django.core.paginator.Paginator date.replace min_sim.NeighborhoodBasedRecs.recommend_items matplotlib.use item_count.reset_index.reset_index items.filter.annotate.filter argparse.ArgumentParser.parse_args select_film django.db.models.Count.Cluster.objects.values.annotate.order_by item_id.user_id.Recs.objects.filter.first yy.max source.issubset gensim.similarities.MatrixSimilarity.save sklearn.model_selection.train_test_split calculate_itemsets_two self.loss max round self.load_data movie_ids.values self.cb.predict_score genres.items.values django.conf.urls.include random.seed self.get_conn user.sessionId.user.events.append title.split pandas.DataFrame.from_records range output_str.format evaluate_bpr_recommender pickle.load matplotlib.pyplot.clf self.cf.recommend_items os.path.exists xx.min psycopg2.connect movie.genres.add userid.Log.objects.filter.values user_id.Log.objects.filter.order_by.values_list.distinct django.core.wsgi.get_wsgi_application analytics.models.Cluster.objects.values.annotate decimal.Decimal abs sklearn.model_selection.KFold.split sqlite3.connect.cursor moviegeeks.models.Genre.objects.all.delete self.calculate_rmse seeds.seeds.SeededRecs.objects.filter.exclude.values os.path.split this_user.users.values vector_cos item_id.user_items.exclude.order_by.exclude logfile.write datetime.date.today sims.append ids.Similarity.objects.filter.exclude ids.Movie.objects.filter.values sklearn.model_selection.KFold zip recs.content_based_recommender.ContentBasedRecs.seeded_rec scipy.sparse.coo_matrix.transpose iter self.create_loss_samples self.save_similarities evaluate_cb_recommender self.compare_recs self.predict_score_by_ratings films.append self.recommender.MeanAverageError.calculate self.calculate_predictions_for_training_data pyLDAvis.save_json moviegeeks.models.Genre.objects.all.values.distinct.items analytics.models.Cluster.objects.filter matplotlib.pyplot.yticks analytics.models.Rating.objects.all.values.distinct argparse.ArgumentParser end_date.start_date.Log.objects.filter.values.distinct EvaluationRunner.calculate u.events.items user.get_session_id users.keys self.cb.recommend_items test_ratings.groupby UserClusterCalculator.calculate time.mktime that_user.users.keys json.load evaluate_fwls_recommender pow django.conf.urls.url ensure_dir calculate_all_movies_mean format datetime.datetime.now collections.defaultdict content_id.SeededRecs.objects.filter.order_by.values os.makedirs get_imdb_id enumerate recs.popularity_recommender.PopularityBasedRecs urllib.request.urlopen.read self.calculate_using_ratings_no_crossvalidation that_user.users.values itertools.combinations yy.ravel gensim.corpora.Dictionary.doc2bow matplotlib.pyplot.savefig recs.content_based_recommender.ContentBasedRecs.recommend_items self._save_similarities recs.keys analytics.models.Rating.objects.all.delete item_ids.Q.Rating.objects.filter.values recs.bpr_recommender.BPRRecs.recommend_items FWLSCalculator.calculate_feature_functions_for_training_data genres.split gensim.corpora.Dictionary.save django.http.JsonResponse float key.difference self.item_bias.items download_movies recommender.models.SeededRecs.objects.filter self.save_similarities_with_django self.stocastic_gradient_descent test_ratings.unique test_temp.groupby.head self.save_clusters self.clean_data time.strftime ratings.isin.isin BayesianPersonalizationRanking.train item_id.Rating.objects.filter.values django.db.connection.cursor numpy.zeros sqlite3.connect.commit recommender.models.LdaSimilarity evaluator.algorithm_evaluator.MeanAverageError BayesianPersonalizationRanking psycopg2.extras.execute_values analytics.models.Rating.split bool.coo.transpose.astype.astype django.db.models.Count analytics.models.Rating.objects.count scipy.sparse.coo_matrix.astype django.db.models.IntegerField isinstance ratings.isin.astype gensim.models.ldamodel.LdaModel.print_topics request.GET.get moviegeeks.models.Genre.objects.all.values FWLSCalculator os.path.join list.values django.db.models.AutoField tqdm response.read.decode pickle.dump self.fwls.fun2 query_aggregated_log_data_for_user recommender.models.LdaSimilarity.objects.filter texts.append FWLSCalculator.calculate_predictions_for_training_data arks.append create_rating recs.funksvd_recommender.FunkSVDRecs self.cf.recommend_items_by_ratings self.fun1 sklearn.cluster.KMeans.predict MovieDto analytics.models.Rating.objects.all.aggregate save_ratings moviegeeks.models.Genre.objects.filter numpy.meshgrid random.choice analytics.models.Cluster.objects.values datetime.datetime.now.strftime json.loads self.recall_at_k django.db.models.CharField calculate_implicit_ratings_for_user.keys gensim.models.ldamodel.LdaModel.save matplotlib.pyplot.imshow scipy.sparse.coo_matrix user_id.Rating.objects.filter.count calculate_association_rules.append User tqdm.tqdm map numpy.dot evaluate_cf_recommender moviegeeks.models.Movie.objects.get_or_create.save int.bool.coo.astype.astype.dot moviegeeks.models.Movie.objects.filter build_association_rules recommender.models.MovieDescriptions.objects.filter collector.models.Log.objects.all.delete test_user_ids.Rating.objects.filter.values analytics.models.Cluster requests.get.json apks.append builder.matrix_factorization_calculator.MatrixFactorization self.split_data sklearn.decomposition.PCA.fit_transform pandas.unique test_users.ratings.isin.ratings.sort_values.groupby self.average_precision_k recs.popularity_recommender.PopularityBasedRecs.recommend_items django.db.connection.cursor.fetchall monthdelta self.remove_stopwords user_id.Log.objects.filter.order_by.values_list outfile.write self.train_data.apply EvaluationRunner open.read moviegeeks.models.Movie.objects.order_by bool.coo.astype.astype test_temp.index.isin switcher.get self.load_model create_movie sklearn.linear_model.LinearRegression content_id.SeededRecs.objects.filter.values content_ids.LdaSimilarity.objects.filter.order_by conn.cursor.execute generate_transactions movie_id.Movie.objects.filter.first pandas.DataFrame.to_json recs.content_based_recommender.ContentBasedRecs stop_words.get_stop_words user_id collector.models.Log gensim.models.ldamodel.LdaModel.load test_users.ratings.isin.ratings.sort_values min_number_of_ratings.Count.Rating.objects.values.annotate.filter.order_by collector.models.Log.objects.values ratings.groupby.sum os.path.abspath django.db.migrations.RemoveField analytics.models.Cluster.objects.filter.values i.user_ids.cluster_label.Cluster.save item_id.user_items.exclude.order_by min django.db.models.ManyToManyField analytics.models.Rating.objects.bulk_create normalize open.close selected.movies.order_by xx.max django.db.models.Count.ratings.values.Rating.objects.filter.values.annotate.filter self.clean_data.isin analytics.models.Rating.objects.filter matplotlib.pyplot.xticks sum collector.models.Log.objects.values.distinct download_ratings django.http.HttpResponse time.strptime self.cb.recommend_items_by_ratings query_log_for_users analytics.models.Rating self.save_similarities_with_postgre user_id.Cluster.objects.filter.first recs.fwls_recommender.FeatureWeightedLinearStacking numpy.arange recs.neighborhood_based_recommender.NeighborhoodBasedRecs recommender.models.Similarity moviegeeks.models.Genre.objects.all.values.distinct.keys collector.models.Log.objects.filter self.u_inx.keys self.recommender.recommend_items item_id.Q.user_id.Q.Rating.objects.filter.values sim.y_id.x_id.created.LdaSimilarity.save self.merge_predictions urllib.request.urlopen evaluator.evaluation_runner.EvaluationRunner recommender.models.Similarity.objects.all.delete MatrixFactorization train.append.append sklearn.cluster.KMeans moviegeeks.models.Movie.objects.all.order_by sklearn.decomposition.PCA.fit_transform.max self.save query_log_data_for_user numpy.full candidate_items.distinct.order_by.distinct UserClusterCalculator recs.funksvd_recommender.FunkSVDRecs.recommend_items func analytics.models.Rating.objects.all.count x.astype.sum ratings_for_rec.to_dict self.fwls.fun1 self.initialize_factors evaluate_funksvd_recommender user_count.reset_index.groupby xx.ravel logging.getLogger.error movie_ids.keys item_id.user_id.Rating.objects.filter.exclude.order_by.values evaluator.algorithm_evaluator.PrecisionAtK moviegeeks.models.Genre.objects.get_or_create.save calculate_ratings calculate_decay type.datetime.datetime.now.rating.content_id.str.user_id.Rating.save self.logger.debug django.db.models.Q item_id.Rating.objects.filter.values.annotate csv.DictReader calculate_itemsets_one self.save_user_recs columns.test_data.as_matrix operator.itemgetter gensim.models.ldamodel.LdaModel.load.print_topics self.DecimalEncoder.super._iterencode self.recommender.set_save_path django.db.models.DecimalField matplotlib.pyplot.ylim x.astype.max item_id.ids.Similarity.objects.filter.exclude.filter matplotlib.pyplot.title user_id.Q.Rating.objects.filter.values.annotate
@developer
Could please help me check this issue?
May I pull a request to fix it?
Thank you very much.
Hi! thanks for the great book :) I think I found a problem while
pip install -r requirements.txt
INFO: pip is looking at multiple versions of boto3 to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of boto to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of appdirs to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r requirements.txt (line 4) and urllib3==1.26.5 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested urllib3==1.26.5
botocore 1.12.45 depends on urllib3<1.25 and >=1.20; python_version >= "3.4"
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
WARNING: You are using pip version 21.3.1; however, version 23.0.1 is available.
You should consider upgrading via the '/Users/a202101054/PycharmProjects/moviegeek/venv/bin/python -m pip install --upgrade pip' command.
what should i type on 'Application URL' and 'Application Name' option?
When I run "manage.py makemigrations" ->
File "init.pxd", line 872, in init gensim._matutils
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216
Hi
I have set up the app with a postgresql database and run the migrate job and python -m builder.association_rules_calculator
. When I check out the website it looks like this
However, I was expecting to see a row of recommended for you, based on what I read in the book. How do I get "Recommended for you" to show up?
views.py import from recommender.models import SeededRecs, Recs, MovieDescriptions, Similarity
. But Recs class is not found in recommender/models.py class. So python manage.py makemigrations
throws
ImportError: cannot import name Recs
Hi all,
I've installed all the requirements updated to the last version. While doing 'Create the MovieGEEKS databases' with command:
python3 manage.py makemigrations, I got this error:
Appreciate if you can help. Thanks.
M.
In the following line, an overlap matrix is created by converting the coo matrix to boolean, then to integer.
However, what this does is that it converts the ratings which are normalized to zero, to false values, which then get ignored in the count.
My proposed solution: create a matrix with ones for every value of the coo matrix:
Example:
print("Coo matrix:\n", coo)
print("coo as bool:\n",coo.astype(bool).astype(int))
ones_data = [1] * len(coo.data)
ones_matrix = coo_matrix((ones_data, (coo.row, coo.col)), shape=coo.shape)
print("ones matrix:\n",ones_matrix)
Output:
Coo matrix:
(0, 0) -0.6666666666666667
(1, 0) 0.33333333333333326
(2, 0) 0.33333333333333326
(1, 1) 0.5
(2, 1) 0.0
(3, 1) -0.5
(1, 2) 0.0
(2, 2) 0.5
(3, 2) -0.5
coo as bool:
(0, 0) 1
(1, 0) 1
(1, 1) 1
(1, 2) 0
(2, 0) 1
(2, 1) 0
(2, 2) 1
(3, 1) 1
(3, 2) 1
ones matrix:
(0, 0) 1
(1, 0) 1
(2, 0) 1
(1, 1) 1
(2, 1) 1
(3, 1) 1
(1, 2) 1
(2, 2) 1
(3, 2) 1
When you calculate the predictions for in the recommenders, the user mean is calculated, but then substracted from each rating, resulting in it being canceled out.
Example:
**user_mean** = sum(movie_ids.values()) / len(movie_ids)
candidate_items = Similarity.objects.filter(Q(source__in=movie_ids.keys())
& ~Q(target__in=movie_ids.keys())
& Q(similarity__gt=self.min_sim)
)
candidate_items = candidate_items.order_by('-similarity')[:self.max_candidates]
recs = dict()
for candidate in candidate_items:
target = candidate.target
pre = 0
sim_sum = 0
rated_items = [i for i in candidate_items if i.target == target][:self.neighborhood_size]
if len(rated_items) > 1:
for sim_item in rated_items:
r = Decimal(movie_ids[sim_item.source] - **user_mean**)
pre += sim_item.similarity * r
sim_sum += sim_item.similarity
if sim_sum > 0:
recs[target] = {'prediction': Decimal(**user_mean**) + pre / sim_sum,
'sim_items': [r.source for r in rated_items]}
I illustrated what is happening with equations. You can see that the user mean is cancelled out and the result we get is not the same formula as the one in the book:
Formula in the book:
I previewed the book on Manning and it seems to be good read. The accompanied code is however not well documented -- missing comments, docstrings etc. I recommend the author to please spend time in doing the same.
Thanks
after building the container, I run the next line, "./db-migrate.sh" but receiving the message ./db-migrate.sh: 2: docker-compose: not found
Hey @kimfalk,
Awesome book on PRS. Thank you!!.
I was bring up your PRS and registered on TMDB. They are not allowing to create files in App Directory now and we get the File not found error. Kindly provide a work around. Thank you
Can the database table structure be provided ?
The cdn does no longer exist
Files:
https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js
https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js
sudo python3 populate_ratings_from_MovieLens_data.py
File "populate_ratings_from_MovieLens_data.py", line 56, in
populate('/Users/u0157492/Downloads/ml-latest-small/ratings.csv')
File "populate_ratings_from_MovieLens_data.py", line 30, in populate
with open(path, newline='') as csvfile:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/u0157492/Downloads/ml-latest-small/ratings.csv'
A part of the installation instruction is:
create a file in the root of the directory called ".prs" and add { "themoviedb_apikey": }. (remember to remove the "<" and ">")
Windows is unable to create a file without a filename, throws the following error "You must type a file name.".
Is there a workaround to provide the API key without a ".prs" file?
Every thing is working fine but the site is not recommending movies i bought some movies and it shows on analytics page that i bought movies and the status are in cluster is showing NO
its capturing my moves but not recommending movies
Here is the error message:
#7 81.01 ERROR: Cannot install -r requirements.txt (line 4) and urllib3==1.26.5 because these package versions have conflicting dependencies.
#7 81.01
#7 81.01 The conflict is caused by:
#7 81.01 The user requested urllib3==1.26.5
#7 81.01 botocore 1.12.45 depends on urllib3<1.25 and >=1.20; python_version >= "3.4"
I tried these setup code.
git clone https://github.com/practical-recommender-systems/moviegeek.git
pip install -r requirements.txt
pip install psycopg2
vi prs_project/settings.py
But, It returned that corpus are not found. Is any solution?
And, When I comment out "recommender.urls PATH" in prs_projects/urls.py
I succeeded in migrations.
root@31f695783e4f:~/moviegeek# python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 327, in execute
self.check()
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python3.6/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python3.6/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/usr/local/lib/python3.6/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.6/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.6/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/root/moviegeek/prs_project/urls.py", line 12, in <module>
url(r'^rec/', include('recommender.urls'))
File "/usr/local/lib/python3.6/site-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/root/moviegeek/recommender/urls.py", line 2, in <module>
from recommender import views
File "/root/moviegeek/recommender/views.py", line 19, in <module>
from recs.content_based_recommender import ContentBasedRecs
File "/root/moviegeek/recs/content_based_recommender.py", line 14, in <module>
class ContentBasedRecs(base_recommender):
File "/root/moviegeek/recs/content_based_recommender.py", line 17, in ContentBasedRecs
corpus=corpora.MmCorpus(lda_path + 'corpus.mm'),
File "/usr/local/lib/python3.6/site-packages/gensim/corpora/mmcorpus.py", line 29, in __init__
matutils.MmReader.__init__(self, fname)
File "/usr/local/lib/python3.6/site-packages/gensim/matutils.py", line 741, in __init__
with utils.file_or_filename(self.input) as lines:
File "/usr/local/lib/python3.6/contextlib.py", line 82, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.6/site-packages/gensim/utils.py", line 140, in file_or_filename
yield smart_open(input)
File "/usr/local/lib/python3.6/site-packages/smart_open/smart_open_lib.py", line 138, in smart_open
return file_smart_open(parsed_uri.uri_path, mode)
File "/usr/local/lib/python3.6/site-packages/smart_open/smart_open_lib.py", line 642, in file_smart_open
return compression_wrapper(open(fname, mode), fname, mode)
FileNotFoundError: [Errno 2] No such file or directory: './lda/corpus.mm'
In the "templates/moviegeek/index.html" and "templates/moviegeek/search_result.html", the event "more_details" need to be updated to "moredetails" to match what's in the book.
Hello
I am following the steps to set up the environment of the local web page. One of the first steps indicates create a file ".prs". I have been looking in internet how to create a file with this formant but I haven't found much. Where can I create this file?
Thank you!
I was getting this error when trying to run the migrations
File "/Users/allisoncolyer/Workspace/moviegeek/prs/lib/python3.7/site-packages/gensim/matutils.py", line 1076, in <module>
from gensim._matutils import logsumexp, mean_absolute_difference, dirichlet_expectation
File "__init__.pxd", line 872, in init gensim._matutils
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216
Upgrading my version of NumPy from 1.15.4 to 1.17.2 fixed the problem
pip3 install --upgrade numpy
Found existing installation: numpy 1.15.4
Uninstalling numpy-1.15.4:
Successfully uninstalled numpy-1.15.4
Successfully installed numpy-1.17.2
Numpy version 1.15.4 is specified in requirements.txt so perhaps this need to be updated? I wanted to file an issue in case others were having this problem too.
Please remember to add a LICENSE(.md) file to this repository. That way, people will know how they may use/modify the code.
Hello there!
Install is completed, postgresql set up, db population done, server is up, I chose some movies and bought some of them.
But as long as I click on my user profile link in app I see in command window 2 erros (here is full log from the point of clicking):
[('Short', 'rating', 0.0), ('Short', 'count', 0.0), ('Adult', 'rating', 0.0), ('Adult', 'count', 0.0), ('Horror', 'rating', 0.0), ('Horror', 'count', 0.0), ('Drama', 'rating', 0.0), ('Drama', 'count', 0.0), ('Action', 'rating', 0.0), ('Action', 'count', 0.0), ('Biography', 'rating', 0.0), ('Biography', 'count', 0.0), ('Talk-Show', 'rating', 0.0), ('Talk-Show', 'count', 0.0), ('News', 'rating', 0.0), ('News', 'count', 0.0), ('Thriller', 'rating', 0.0), ('Thriller', 'count', 0.0), ('Sci-Fi', 'rating', 0.0), ('Sci-Fi', 'count', 0.0), ('Western', 'rating', 0.0), ('Western', 'count', 0.0), ('Comedy', 'rating', 0.0), ('Comedy', 'count', 0.0), ('Adventure', 'rating', 0.0), ('Adventure', 'count', 0.0), ('War', 'rating', 0.0), ('War', 'count', 0.0), ('Family', 'rating', 0.0), ('Family', 'count', 0.0), ('Crime', 'rating', 0.0), ('Crime', 'count', 0.0), ('Animation', 'rating', 0.0), ('Animation', 'count', 0.0), ('Romance', 'rating', 0.0), ('Romance', 'count', 0.0), ('Game-Show', 'rating', 0.0), ('Game-Show', 'count', 0.0), ('Documentary', 'rating', 0.0), ('Documentary', 'count', 0.0), ('Sport', 'rating', 0.0), ('Sport', 'count', 0.0), ('Mystery', 'rating', 0.0), ('Mystery', 'count', 0.0), ('History', 'rating', 0.0), ('History', 'count', 0.0), ('Reality-TV', 'rating', 0.0), ('Reality-TV', 'count', 0.0), ('Music', 'rating', 0.0), ('Music', 'count', 0.0), ('Musical', 'rating', 0.0), ('Musical', 'count', 0.0), ('Fantasy', 'rating', 0.0), ('Fantasy', 'count', 0.0), ('Film-Noir', 'rating', 0.0), ('Film-Noir', 'count', 0.0)]
[17/Jan/2021 19:40:14] "GET /analytics/user/30882099234/ HTTP/1.1" 200 23193
recs from association rules:
[]
[17/Jan/2021 19:40:14] "GET /rec/ar/30882099234/ HTTP/1.1" 200 12
cf sorted_items is: {}
[17/Jan/2021 19:40:15] "GET /rec/cf/user/30882099234/ HTTP/1.1" 200 38
[17/Jan/2021 19:40:15] "GET /rec/cb/user/30882099234/ HTTP/1.1" 200 38
Internal Server Error: /rec/bpr/user/30882099234/
Traceback (most recent call last):
File "C:\Users\ssoby\some_project\env\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\ssoby\some_project\env\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\ssoby\some_project\env\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\ssoby\some_project\moviegeek\recommender\views.py", line 192, in recs_bpr
sorted_items = BPRRecs().recommend_items(user_id, num)
File "C:\Users\ssoby\some_project\moviegeek\recs\bpr_recommender.py", line 44, in recommend_items
self.load_model(self.save_path)
File "C:\Users\ssoby\some_project\moviegeek\recs\bpr_recommender.py", line 20, in load_model
with open(save_path + 'item_bias.data', 'rb') as ub_file:
FileNotFoundError: [Errno 2] No such file or directory: './models/bpr/item_bias.data'
[17/Jan/2021 19:40:15] "GET /rec/bpr/user/30882099234/ HTTP/1.1" 500 18488
[17/Jan/2021 19:40:15] "GET /rec/sim/user/30882099234/pearson/?min=4 HTTP/1.1" 200 98
[17/Jan/2021 19:40:15] "GET /rec/sim/user/30882099234/jaccard/?min=4 HTTP/1.1" 200 98
[17/Jan/2021 19:40:15] "GET /rec/fwls/user/30882099234/ HTTP/1.1" 200 38
Internal Server Error: /rec/funk/user/30882099234/
Traceback (most recent call last):
File "C:\Users\ssoby\some_project\env\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\ssoby\some_project\env\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\ssoby\some_project\env\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\ssoby\some_project\moviegeek\recommender\views.py", line 183, in recs_funksvd
sorted_items = FunkSVDRecs().recommend_items(user_id, num)
File "C:\Users\ssoby\some_project\moviegeek\recs\funksvd_recommender.py", line 53, in recommend_items
self.load_model(self.save_path)
File "C:\Users\ssoby\some_project\moviegeek\recs\funksvd_recommender.py", line 23, in load_model
with open(save_path + 'user_bias.data', 'rb') as ub_file:
OSError: [Errno 22] Invalid argument: './models/funkSVD/2018-01-01 10:01:34.179393/model/user_bias.data'
[17/Jan/2021 19:40:15] "GET /rec/funk/user/30882099234/ HTTP/1.1" 500 18546
I run: Python 3.7.3. 64bit, win 10
Appreciate your advices.
When I fired up the app, the backend sent an error saying file not found: "./models/funkSVD/2018-01-01 10:01:34.179393/model/". This directory does not exist anywhere. I run all the tests and any tests related to this file failed. Did I miss something here?
If you follow a cluster link on the analytics page, the web app produces an error:
django.db.utils.ProgrammingError: operator does not exist: character varying = integer
LINE 1: ...lytics_rating" WHERE "analytics_rating"."user_id" IN (SELECT...
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
I tracked the issue to the analytics.cluster.user_id definition, which should be:
user_id = models.CharField(max_length=16)
<< not 'integer'
Traceback (most recent call last):
File "populate_moviegeek.py", line 2, in <module>
import urllib.request
ImportError: No module named request
Anybody know the cause of this error?
I guess there is a little confusion on '.prs' file location in README. The author states 'Create a file in the moviegeek directory called ".prs"' . However there is no 'moviegeek' directory, there is 'moviegeeks' which I thought should be the place for '.prs' but after many unsuccessful attempts to launch the website I was getting only 'no such file error' I've realised that the correct place for '.prs' should be 'live-project' the root directory - this is what's 'moviegeek' changes to when we copy the repo from github.
P.S Thanks to author for the great book!
/Projects/moviegeek/recommender/views.py", line 167
print(f"lda loaded in {datetime.now()-start_time}")
^
SyntaxError: invalid syntax
I am using MacOS with Python 3.7. Before coming to the association rule problem, I had some issues with the installation instructions that I had to fix manually:
When I ran pip3 install -r requirements.txt
, I got the error Failed building wheel
for numpy, scipy and pandas. After that I tried installing the packages with the versions on requirements.txt
manually. For example: pip install numpy==1.12.1
, but received the same error messages. That's why I installed those packages with pip install
and updated the entries in requirements.txt
. Therefore, the versions I have for numpy, pandas and scipy are 1.15.4, 0.23.4 and 1.1.0 respectively.
When I ran the command python3 manage.py makemigrations
, I got the error which is mentioned here. Apparently, Django 1.11 and Python 3.7 are incompatible and will never be. Therefore I installed the Django version 2.1.3.
Because of the Django version, I had to change MIDDLEWARE_CLASSES
in settings.py
to MIDDLEWARE
and remove django.contrib.auth.middleware.SessionAuthenticationMiddleware
.
At this point, I was able to run the website. The real problem is that, I never see recommendations on the main page or under movies on details pages. I populated the database with logs, "bought" many movies etc. but still receive no recommendations and the terminal always show recs from association rules: []
Why do you think, it's not working and what can I do? Maybe you should also try running the project on a clean environment for the other problems that I mentioned before. Congrats on the book and project though.
Edit: Btw forgot to mention that I tried this on two different environments. One created by virtualenv and second by conda.
Similar to #4 . Here is my stack trace:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/management/base.py", line 350, in execute
self.check()
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/management/base.py", line 379, in check
include_deployment_checks=include_deployment_checks,
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/management/base.py", line 366, in _run_checks
return checks.run_checks(**kwargs)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/checks/registry.py", line 71, in run_checks
new_errors = check(app_configs=app_configs)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/urls/resolvers.py", line 533, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/urls/resolvers.py", line 526, in urlconf_module
return import_module(self.urlconf_name)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs_project/urls.py", line 10, in <module>
url(r'^analytics/', include('analytics.urls')),
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/gordoneliel/Documents/Projects/moviegeek/analytics/urls.py", line 2, in <module>
from analytics import views
File "/Users/gordoneliel/Documents/Projects/moviegeek/analytics/views.py", line 10, in <module>
from gensim import models
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/gensim/__init__.py", line 5, in <module>
from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/gensim/corpora/__init__.py", line 6, in <module>
from .indexedcorpus import IndexedCorpus # noqa:F401 must appear before the other classes
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/gensim/corpora/indexedcorpus.py", line 15, in <module>
from gensim import interfaces, utils
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/gensim/interfaces.py", line 21, in <module>
from gensim import utils, matutils
File "/Users/gordoneliel/Documents/Projects/moviegeek/prs/lib/python3.7/site-packages/gensim/matutils.py", line 1076, in <module>
from gensim._matutils import logsumexp, mean_absolute_difference, dirichlet_expectation
File "__init__.pxd", line 872, in init gensim._matutils
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216
I cloned the repo, installed PostgreSQL, configured settings.py to point at my PSQL installation, setup a TMDb API key and added the key with the appropriate format into a new .prs file.
I did "makemigrations" and "migrate --run-syncdb", both of them went through successfully, I even double checked through pgAdmin and all of the tables were created successfully.
Afterwards I ran "populate_moviegeek.py", the script threw out an error due to a size difference between one of the columns in the dataset and the DB, thus I resorted to use the 100K version of the MovieTweetings dataset, I copied the URL and pasted it as the default parameter for the download_movies function, and rerun the script, everything went through beautifully! All of the movies were added into the Database successfully.
Since I got the 100K version of the MovieTweetings Dataset, I also got the ratings for them, changed the URL inside "populate_ratings.py" and ran the script, everything worked here as well.
Last but not least I ran "populate_logs.py" and it worked as well.
Finally I ran the server using "python manage.py runserver" and I tried accessing the webpage, no issues here, however!
No recommendations were being shown! The analytics page didn't work at all! The console showed diffferent kinds of errors, and I tried getting into the details page of a movie maybe I would get a "Movies similar to ..." recommendations, but didn't aswell.
All in all, I am desperately trying to get the script to work but I can't!
@kimfalk your help would be greatly appreciated!
My current python version: 3.7.7
Windows 10 Pro x64
All of the packages installed successfully using "pip install -r requirements.txt"
Hi,
I have some problems with compatibility of libraries. Do you have a list of libraries that are compatible with each other and will make the site work? Thank u.
I run the lda model and fwls calculator as well as the other calculator module from builder folder. All the recommendations shows up on the main page of main user except the content-based and collaborative-based recommendation. But I could see few suggestion of them in the other users page. Did I make any mistake here?
When I click the save for later button on the movie poster, nothing happens. What should I do?
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."]
hi,when i open http://127.0.0.1:8000/analytics/user/400001/,i can only see the data in (movie Rate) and (recent Log).There is no data in (Taste) and (Personalised recommendations).it tell me FileNotFoundError: [Errno 2] No such file or directory: './models/bpr/item_bias.data' when i look the console,how can i solve this problem?
python3 -m builder.lda_model_calculator
/usr/local/lib/python3.6/dist-packages/past/translation/init.py:35: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
/usr/local/lib/python3.6/dist-packages/scipy/sparse/sparsetools.py:21: DeprecationWarning: scipy.sparse.sparsetools
is deprecated!
scipy.sparse.sparsetools is a private module for scipy.sparse, and should not be used.
_deprecated()
Calculating lda model...
No descriptions were found, run populate_sample_of_descriptions
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/milad/Desktop/moviegeek/builder/lda_model_calculator.py", line 245, in [module]
lda.train(data, docs)
File "/home/milad/Desktop/moviegeek/builder/lda_model_calculator.py", line 82, in train
self.build_lda_model(data, docs, NUM_TOPICS)
File "/home/milad/Desktop/moviegeek/builder/lda_model_calculator.py", line 94, in build_lda_model
for d in tqdm(data):
TypeError: 'module' object is not callable
Please help me
Some movie titles have more than 128 character like this(140 character):
"Lethal Kittens or how we came to Love our Shovels during a Limited Anti-Terrorist Operation with Temporary Elements of a State of War (2020)".
Following line in moviegeeks.models.py should change to something more like 256.
title = models.CharField(max_length=128)
Hi! thanks for making great book 👍
but... I think docker build fails on latest master
I'm on mac os monterey 12.3
docker-compose build web
[+] Building 175.8s (10/11)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 189B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/python:3.8 4.0s
=> [auth] library/python:pull token for registry-1.docker.io 0.0s
=> [1/6] FROM docker.io/library/python:3.8@sha256:f9af3c8c4614d955495d23a665760abe3b37d4310bf9c33ea1ebf9f18991d8fe 92.8s
=> => resolve docker.io/library/python:3.8@sha256:f9af3c8c4614d955495d23a665760abe3b37d4310bf9c33ea1ebf9f18991d8fe 0.0s
=> => sha256:f9af3c8c4614d955495d23a665760abe3b37d4310bf9c33ea1ebf9f18991d8fe 1.86kB / 1.86kB 0.0s
=> => sha256:fa2a4081e81d2ac65a9e622ede295f84e18cb0359a588bbea4105dd69faf7bfd 2.22kB / 2.22kB 0.0s
=> => sha256:8022b074731d9ecee7f4fba79b993920973811dda168bbc08636f18523b90122 53.70MB / 53.70MB 43.4s
=> => sha256:91a934163d324049bba626dc29942dc17df1ee0646c8491ec08339e6c0fa06c7 7.95kB / 7.95kB 0.0s
=> => sha256:7971239fe1d69763272ccc0b2527efa95547d37c53630ed0a71db4e00d3ef964 5.15MB / 5.15MB 3.6s
=> => sha256:26c861b53509d61c37240d2f80efb3a351d2f1d7f4f8e8ec2e5004c1d86af89c 10.87MB / 10.87MB 12.1s
=> => sha256:1714880ecc1c021a5f708f4369f91d3c2c53b998a56d563d0a9aa9be2488d794 54.68MB / 54.68MB 38.0s
=> => sha256:895a945a1f9ba441c2748501c4d46569edfbc2bfbdb9b47d41e753e752247fdc 189.73MB / 189.73MB 87.2s
=> => sha256:2a83fe9e3053a5f52e699f1078c2abeaad849bb81da9068f1aa541bb5673a21f 6.40MB / 6.40MB 42.5s
=> => sha256:9fab1e817d7e301293133a70df52de98c881db200f6a87c508354aba37c202ab 15.47MB / 15.47MB 47.8s
=> => extracting sha256:8022b074731d9ecee7f4fba79b993920973811dda168bbc08636f18523b90122 1.7s
=> => sha256:a5cd1ca01318d087b11fd017b43646eabfeea1199d9c088c9d93c09118cc4b94 244B / 244B 43.7s
=> => sha256:24c24e538c8de9c742de4d3d71ecb4bf81f5748f9c79c246517856eaa0e63f83 2.91MB / 2.91MB 47.8s
=> => extracting sha256:7971239fe1d69763272ccc0b2527efa95547d37c53630ed0a71db4e00d3ef964 0.2s
=> => extracting sha256:26c861b53509d61c37240d2f80efb3a351d2f1d7f4f8e8ec2e5004c1d86af89c 0.3s
=> => extracting sha256:1714880ecc1c021a5f708f4369f91d3c2c53b998a56d563d0a9aa9be2488d794 2.1s
=> => extracting sha256:895a945a1f9ba441c2748501c4d46569edfbc2bfbdb9b47d41e753e752247fdc 4.5s
=> => extracting sha256:2a83fe9e3053a5f52e699f1078c2abeaad849bb81da9068f1aa541bb5673a21f 0.2s
=> => extracting sha256:9fab1e817d7e301293133a70df52de98c881db200f6a87c508354aba37c202ab 0.4s
=> => extracting sha256:a5cd1ca01318d087b11fd017b43646eabfeea1199d9c088c9d93c09118cc4b94 0.0s
=> => extracting sha256:24c24e538c8de9c742de4d3d71ecb4bf81f5748f9c79c246517856eaa0e63f83 0.1s
=> [internal] load build context 38.2s
=> => transferring context: 349.84MB 38.1s
=> [2/6] RUN mkdir /code 0.5s
=> [3/6] WORKDIR /code 0.0s
=> [4/6] COPY requirements.txt /code/ 0.0s
=> ERROR [5/6] RUN pip install -r requirements.txt 78.2s
------
> [5/6] RUN pip install -r requirements.txt:
#0 1.107 Collecting appdirs==1.4.3
#0 1.170 Downloading appdirs-1.4.3-py2.py3-none-any.whl (12 kB)
#0 1.198 Collecting boto==2.49.0
#0 1.211 Downloading boto-2.49.0-py2.py3-none-any.whl (1.4 MB)
#0 1.455 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 5.8 MB/s eta 0:00:00
#0 1.765 Collecting boto3==1.9.45
#0 1.861 Downloading boto3-1.9.45-py2.py3-none-any.whl (128 kB)
#0 1.880 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.5/128.5 KB 8.7 MB/s eta 0:00:00
#0 2.272 Collecting botocore==1.12.45
#0 2.283 Downloading botocore-1.12.45-py2.py3-none-any.whl (4.8 MB)
#0 3.706 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 3.4 MB/s eta 0:00:00
#0 3.969 Collecting bz2file==0.98
#0 4.001 Downloading bz2file-0.98.tar.gz (11 kB)
#0 4.010 Preparing metadata (setup.py): started
#0 4.211 Preparing metadata (setup.py): finished with status 'done'
#0 4.238 Collecting certifi==2018.10.15
#0 4.250 Downloading certifi-2018.10.15-py2.py3-none-any.whl (146 kB)
#0 4.277 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 146.3/146.3 KB 5.5 MB/s eta 0:00:00
#0 4.295 Collecting chardet==3.0.4
#0 4.330 Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
#0 4.371 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.4/133.4 KB 3.4 MB/s eta 0:00:00
#0 4.397 Collecting cycler==0.10.0
#0 4.441 Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
#0 4.525 Collecting Django==2.2.27
#0 4.570 Downloading Django-2.2.27-py3-none-any.whl (7.5 MB)
#0 7.795 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.5/7.5 MB 2.3 MB/s eta 0:00:00
#0 7.854 Collecting django-extensions==2.1.3
#0 8.196 Downloading django_extensions-2.1.3-py2.py3-none-any.whl (216 kB)
#0 8.326 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 216.4/216.4 KB 1.7 MB/s eta 0:00:00
#0 8.361 Collecting docutils==0.14
#0 8.396 Downloading docutils-0.14-py3-none-any.whl (543 kB)
#0 8.677 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 543.2/543.2 KB 1.9 MB/s eta 0:00:00
#0 8.998 Collecting gensim==3.6.0
#0 9.010 Downloading gensim-3.6.0.tar.gz (23.1 MB)
#0 17.28 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.1/23.1 MB 3.5 MB/s eta 0:00:00
#0 17.67 Preparing metadata (setup.py): started
#0 25.31 Preparing metadata (setup.py): finished with status 'done'
#0 25.34 Collecting idna==2.7
#0 25.35 Downloading idna-2.7-py2.py3-none-any.whl (58 kB)
#0 25.37 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.2/58.2 KB 6.1 MB/s eta 0:00:00
#0 25.39 Collecting jmespath==0.9.3
#0 25.40 Downloading jmespath-0.9.3-py2.py3-none-any.whl (23 kB)
#0 25.49 Collecting kiwisolver==1.0.1
#0 25.50 Downloading kiwisolver-1.0.1.tar.gz (31 kB)
#0 25.52 Preparing metadata (setup.py): started
#0 25.62 Preparing metadata (setup.py): finished with status 'done'
#0 25.79 Collecting matplotlib==3.0.2
#0 25.80 Downloading matplotlib-3.0.2.tar.gz (36.5 MB)
#0 44.07 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 36.5/36.5 MB 2.0 MB/s eta 0:00:00
#0 45.03 Preparing metadata (setup.py): started
#0 46.20 Preparing metadata (setup.py): finished with status 'done'
#0 46.35 Collecting numpy==1.22.2
#0 46.37 Downloading numpy-1.22.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.4 MB)
#0 52.46 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.4/13.4 MB 2.2 MB/s eta 0:00:00
#0 52.66 Collecting pandas==1.4.1
#0 52.68 Downloading pandas-1.4.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (11.0 MB)
#0 56.84 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.0/11.0 MB 2.6 MB/s eta 0:00:00
#0 56.90 Collecting packaging==16.8
#0 56.91 Downloading packaging-16.8-py2.py3-none-any.whl (23 kB)
#0 56.96 Collecting pyparsing==2.3.0
#0 56.96 Downloading pyparsing-2.3.0-py2.py3-none-any.whl (59 kB)
#0 56.98 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.0/59.0 KB 7.8 MB/s eta 0:00:00
#0 57.00 Collecting python-dateutil==2.8.2
#0 57.04 Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
#0 57.12 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 3.3 MB/s eta 0:00:00
#0 57.18 Collecting pytz==2021.3
#0 57.20 Downloading pytz-2021.3-py2.py3-none-any.whl (503 kB)
#0 57.50 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 503.5/503.5 KB 1.6 MB/s eta 0:00:00
#0 57.61 Collecting requests==2.20.1
#0 57.62 Downloading requests-2.20.1-py2.py3-none-any.whl (57 kB)
#0 57.63 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.0/58.0 KB 4.8 MB/s eta 0:00:00
#0 57.65 Collecting s3transfer==0.1.13
#0 57.66 Downloading s3transfer-0.1.13-py2.py3-none-any.whl (59 kB)
#0 57.69 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.6/59.6 KB 2.1 MB/s eta 0:00:00
#0 57.85 Collecting scipy==1.8.0
#0 57.86 Downloading scipy-1.8.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (39.0 MB)
#0 75.04 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 39.0/39.0 MB 2.5 MB/s eta 0:00:00
#0 75.12 Collecting seaborn==0.8.1
#0 75.13 Downloading seaborn-0.8.1.tar.gz (178 kB)
#0 75.27 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 178.9/178.9 KB 1.3 MB/s eta 0:00:00
#0 75.29 Preparing metadata (setup.py): started
#0 75.39 Preparing metadata (setup.py): finished with status 'done'
#0 75.41 Collecting six==1.11.0
#0 75.42 Downloading six-1.11.0-py2.py3-none-any.whl (10 kB)
#0 75.44 Collecting sklearn==0.0
#0 75.45 Downloading sklearn-0.0.tar.gz (1.1 kB)
#0 75.46 Preparing metadata (setup.py): started
#0 75.56 Preparing metadata (setup.py): finished with status 'done'
#0 75.80 Collecting smart-open==1.7.1
#0 75.82 Downloading smart_open-1.7.1.tar.gz (38 kB)
#0 75.83 Preparing metadata (setup.py): started
#0 75.94 Preparing metadata (setup.py): finished with status 'done'
#0 76.18 Collecting stop-words==2015.2.23.1
#0 76.33 Downloading stop-words-2015.2.23.1.tar.gz (18 kB)
#0 76.34 Preparing metadata (setup.py): started
#0 76.46 Preparing metadata (setup.py): finished with status 'done'
#0 76.53 Collecting tqdm==4.28.1
#0 76.54 Downloading tqdm-4.28.1-py2.py3-none-any.whl (45 kB)
#0 76.55 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.0/46.0 KB 4.4 MB/s eta 0:00:00
#0 76.59 Collecting urllib3==1.26.5
#0 76.60 Downloading urllib3-1.26.5-py2.py3-none-any.whl (138 kB)
#0 76.63 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 138.1/138.1 KB 5.0 MB/s eta 0:00:00
#0 76.90 Collecting pyLDAvis==2.1.1
#0 76.92 Downloading pyLDAvis-2.1.1.tar.gz (1.6 MB)
#0 77.52 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 2.7 MB/s eta 0:00:00
#0 77.59 Preparing metadata (setup.py): started
#0 77.72 Preparing metadata (setup.py): finished with status 'done'
#0 77.81 INFO: pip is looking at multiple versions of boto3 to determine which version is compatible with other requirements. This could take a while.
#0 77.81 INFO: pip is looking at multiple versions of boto to determine which version is compatible with other requirements. This could take a while.
#0 77.81 INFO: pip is looking at multiple versions of appdirs to determine which version is compatible with other requirements. This could take a while.
#0 77.81 ERROR: Cannot install -r requirements.txt (line 4) and urllib3==1.26.5 because these package versions have conflicting dependencies.
#0 77.81
#0 77.81 The conflict is caused by:
#0 77.81 The user requested urllib3==1.26.5
#0 77.81 botocore 1.12.45 depends on urllib3<1.25 and >=1.20; python_version >= "3.4"
#0 77.81
#0 77.81 To fix this you could try to:
#0 77.81 1. loosen the range of package versions you've specified
#0 77.81 2. remove package versions to allow pip attempt to solve the dependency conflict
#0 77.81
#0 77.81 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
#0 77.91 WARNING: You are using pip version 22.0.4; however, version 23.0.1 is available.
#0 77.91 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
failed to solve: executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 1
I encountered this error when running python3 populate_moviegeek.py
, even though i ran these commands.
> python3 manage.py makemigrations
> python3 manage.py migrate
Starting MovieGeeks Population script...
truncate db
finished truncate db
movie data downloaded
0%| | 0/34213 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 296, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: main.moviegeeks_movie__old
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "populate_moviegeek.py", line 63, in
populate()
File "populate_moviegeek.py", line 57, in populate
create_movie(m[0], m[1], m[2])
File "populate_moviegeek.py", line 25, in create_movie
movie.genres.add(g)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 926, in add
self._add_items(self.source_field_name, self.target_field_name, *objs)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 1093, in _add_items
for obj_id in new_ids
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/models/query.py", line 465, in bulk_create
ids = self._batched_insert(objs_without_pk, fields, batch_size)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/models/query.py", line 1155, in _batched_insert
self._insert(item, fields=fields, using=self.db)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/models/query.py", line 1136, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1289, in execute_sql
cursor.execute(sql, params)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute
return super().execute(sql, params)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/utils.py", line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/home/mulenga/projects/moviegeek/prs/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 296, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: main.moviegeeks_movie__old
My computer is an apple m1, using docker desktop for mac.
Here is my trace:
Creating live-project_web_run ... done
/usr/local/lib/python3.8/site-packages/django/core/management/commands/makemigrations.py:105: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': SCRAM authentication requires libpq version 10 or above
warnings.warn(
No changes detected
Creating live-project_web_run ... done
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 211, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 199, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: SCRAM authentication requires libpq version 10 or above
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 373, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 417, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 90, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 75, in handle
self.check(databases=[database])
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 438, in check
all_issues = checks.run_checks(
File "/usr/local/lib/python3.8/site-packages/django/core/checks/registry.py", line 77, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/usr/local/lib/python3.8/site-packages/django/core/checks/model_checks.py", line 34, in check_all_models
errors.extend(model.check(**kwargs))
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 1307, in check
*cls._check_indexes(databases),
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 1699, in _check_indexes
connection.features.supports_covering_indexes or
File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/features.py", line 84, in is_postgresql_11
return self.connection.pg_version >= 110000
File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 339, in pg_version
with self.temporary_connection():
File "/usr/local/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 614, in temporary_connection
with self.cursor() as cursor:
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 270, in cursor
return self._cursor()
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 246, in _cursor
self.ensure_connection()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 211, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 199, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: SCRAM authentication requires libpq version 10 or above
ERROR: 1
Creating live-project_web_run ... done
Starting MovieGeeks Population script...
truncate db
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 211, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 199, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: SCRAM authentication requires libpq version 10 or above
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "populate_moviegeek.py", line 74, in <module>
delete_db()
File "populate_moviegeek.py", line 43, in delete_db
movie_count = Movie.objects.all().count()
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 416, in count
return self.query.get_count(using=self.db)
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/query.py", line 516, in get_count
number = obj.get_aggregation(using, ['__count'])['__count']
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/query.py", line 501, in get_aggregation
result = compiler.execute_sql(SINGLE)
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1200, in execute_sql
cursor = self.connection.cursor()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 270, in cursor
return self._cursor()
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 246, in _cursor
self.ensure_connection()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 211, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 199, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: SCRAM authentication requires libpq version 10 or above
ERROR: 1
Creating live-project_web_run ... done
Starting MovieGeeks Population script...
truncate db
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 211, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 199, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: SCRAM authentication requires libpq version 10 or above
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "populate_ratings.py", line 58, in <module>
populate()
File "populate_ratings.py", line 46, in populate
delete_db()
File "populate_ratings.py", line 40, in delete_db
Rating.objects.all().delete()
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 753, in delete
deleted, _rows_count = collector.delete()
File "/usr/local/lib/python3.8/site-packages/django/db/models/deletion.py", line 402, in delete
with transaction.atomic(using=self.using, savepoint=False):
File "/usr/local/lib/python3.8/site-packages/django/db/transaction.py", line 189, in __enter__
if not connection.get_autocommit():
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 400, in get_autocommit
self.ensure_connection()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 230, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 211, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 199, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: SCRAM authentication requires libpq version 10 or above
ERROR: 1
stated the program..
(base) E:\毕业设计\参考系统\moviegeek-master>python ./manage.py runserver 127.0.0.1:8081
Watching for file changes with StatReloader
Performing system checks...
System check identified some issues:
WARNINGS:
analytics.Cluster: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AnalyticsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.mod
els.BigAutoField'.
analytics.Rating: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AnalyticsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.mod
els.BigAutoField'.
collector.Log: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the CollectorConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.mod
els.BigAutoField'.
moviegeeks.Genre: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the MoviegeeksConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.mo
dels.BigAutoField'.
recommender.LdaSimilarity: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the RecommenderConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.m
odels.BigAutoField'.
recommender.MovieDescriptions: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the RecommenderConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.m
odels.BigAutoField'.
recommender.Recs: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the RecommenderConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.m
odels.BigAutoField'.
recommender.SeededRecs: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the RecommenderConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.m
odels.BigAutoField'.
recommender.Similarity: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the RecommenderConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.m
odels.BigAutoField'.
System check identified 9 issues (0 silenced).
February 22, 2022 - 21:27:14
Django version 3.2.12, using settings 'prs_project.settings'
Starting development server at http://127.0.0.1:8081/
Quit the server with CTRL-BREAK.
and when i try to acess the index,the error jumped...
Internal Server Error: /movies/
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\ProgramData\Anaconda3\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\django\utils\decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "E:\毕业设计\参考系统\moviegeek-master\moviegeeks\views.py", line 14, in index
api_key = get_api_key()
File "E:\毕业设计\参考系统\moviegeek-master\moviegeeks\views.py", line 140, in get_api_key
cred = json.loads(open(".prs").read())
FileNotFoundError: [Errno 2] No such file or directory: '.prs'
[22/Feb/2022 21:30:11] "GET /movies/ HTTP/1.1" 500 74417
No need for exactly the locations, I want numbers for each directory.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.