jakubgrad / Tietokannat-ja-web-ohjelmointi-Projekti

A repository for the course Tietokannat ja web-ohjelmointi taken in the 4th period of academic year 2023-2024 at University of Helsinki
0 stars 0 forks source link

Vertaisarviointi 2 #2

Open aatls opened 3 months ago

aatls commented 3 months ago

Hi!

Unfortunately i could not run the program on my computer. When I try to run the project, I get an error message saying that "No module named 'PyPDF2'". This happens even if I manually install (or reinstall using "$ pip install --upgrade --force-reinstall PyPDF2") the module right before:

$ (venv) aatos@aatos-ThinkPad-T14-Gen-2i:~/ohte-vertaisarv/Tietokannat-ja-web-ohjelmointi-Projekti/src$ pip install PyPDF2
Requirement already satisfied: PyPDF2 in /home/aatos/ohte-vertaisarv/Tietokannat-ja-web-ohjelmointi-Projekti/venv/lib/python3.10/site-packages (3.0.1)
$ (venv) aatos@aatos-ThinkPad-T14-Gen-2i:~/ohte-vertaisarv/Tietokannat-ja-web-ohjelmointi-Projekti/src$ flask run
postgresql:///aatos
Usage: flask run [OPTIONS]
Try 'flask run --help' for help.

Error: While importing 'app', an ImportError was raised:

Traceback (most recent call last):
  File "/home/aatos/.local/lib/python3.10/site-packages/flask/cli.py", line 245, in locate_app
    __import__(module_name)
  File "/home/aatos/ohte-vertaisarv/Tietokannat-ja-web-ohjelmointi-Projekti/src/app.py", line 12, in <module>
    import routes
  File "/home/aatos/ohte-vertaisarv/Tietokannat-ja-web-ohjelmointi-Projekti/src/routes.py", line 2, in <module>
    import users, books, pairs, bookmarks
  File "/home/aatos/ohte-vertaisarv/Tietokannat-ja-web-ohjelmointi-Projekti/src/books.py", line 6, in <module>
    from PyPDF2 import PdfReader
ModuleNotFoundError: No module named 'PyPDF2'

This is really unfortunate since I believe that this might be a problem on my end, but I just could not get it working :disappointed:

Your project seems interesting and you have put a lot of effort into it. Your code is clear and it is separated nicely to smaller files. Your file, function and variable names seem coherent and descripting. All of your data altering database functions return if the manipulation was successful, a really nice feature :) Your readme file was also very descriptive and the detailed install instructions were nice.

Your project seemed great, from what I can tell from the code :+1:

jakubgrad commented 3 months ago

That’s really unfortunate! A few minutes ago I tried to recreate the issue on Virtual Desktop Cubbli but failed. I reinstalled the freshest version of the repository and then the requierements with pip install -r requirements.txt and since PyPDF2was installed from cache, I did pip uninstall PyPDF2 and pip install --no-cache-dir -r requirements.txt but the programme worked just fine for me. It's especially strange because PyPDF2 is in the requierements document taken into use with pip install -r requirements.txt and in your terminal snippet, PyPDF2 clearly points to a location inside the virtual environment.
First I thought it can't be an issue on your end since I run the app on Cubbli before, and I suspect I have maybe added PyPdf2 in some other way before. If you have a different OS, I recommend testing repositories on University of Helsinki's Virtual Desktop since it's the same for all CS students.
The only similar issue to this that I've had before was when I changed the name of one of the folders upstream from the repository and the virtual environment got confused, maybe because some references inside used absolute paths that became outdated. I reinstalled it a few times and gave up for a couple days, then one day it suddenly started working. A similar situation would occur e.g. if you downloaded the repository, created the virtual environment, installed the requierements, and then moved the repository to /ohte-vertaisarv. I could see why it wouldn't work, but from the command-line instructions this doesn't seem to be the case o____o
Thanks for the feedback on the code anyway!