practical-recommender-systems / moviegeek

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

FileNotFoundError: [Errno 2] No such file or directory: './models/bpr/item_bias.data' #38

Open chaoticman-22 opened 3 years ago

chaoticman-22 commented 3 years ago

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

1) How to cope with this path ? (./models/bpr/item_bias.data) <-- path exists in code "bpr_recommender.py" It does not exist and no such file - item_bias.data. 2) Obvously its impossible to create such directory name (../2018-01-01 10:01:34.179393/..) in windows. But such code exists in this project ("funksvd_recommender.py"). Is this error ?

I run: Python 3.7.3. 64bit, win 10

Appreciate your advices.

blueorris commented 3 years ago

Also have this problem.

Lejoa commented 2 years ago

Hi, also I have this problem. Any clue for this bug?

phamgiahuy1312 commented 6 months ago

Hi, also I have this problem. Any clue for this bug?