ModuleNotFoundError: No module named 'fpdf' - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: ModuleNotFoundError: No module named 'fpdf' (/thread-33354.html) |
ModuleNotFoundError: No module named 'fpdf' - KatMac - Apr-18-2021 I am running Windows 10, using the VSC editor and Python 3.9.4 My goal is to convert an existing csv file to a pdf. I installed the required module by entering: pip install fpdf. Then I wrote a few lines of code and decided to check and see if the installation worked before I continued. It did not as I received the above mentioned error message. I then went to my environment variables and added in this path: C:\Users\Owner\AppData\Local\Programs\Python\Python39\Scripts\\lib\ That did not work, so then I did this: C:\Users\Owner\AppData\Local\Programs\Python\Python39\Scripts\lib\site-packages\fpdf Closed down the apps and re-booted my computer. Re-ran my code and I get the same error. How can I resolve this issue RE: ModuleNotFoundError: No module named 'fpdf' - snippsat - Apr-18-2021 (Apr-18-2021, 07:17 PM)KatMac Wrote: I then went to my environment variables and added in this path:Do not do this. Do pip -V this the Python version it install to.Example. # Show path to version it install to C:\code λ pip -V pip 21.0.1 from c:\python39\lib\site-packages\pip (python 3.9) # Install C:\code λ pip install fpdf Collecting fpdf Downloading fpdf-1.7.2.tar.gz (39 kB) Using legacy 'setup.py install' for fpdf, since package 'wheel' is not installed. Installing collected packages: fpdf Running setup.py install for fpdf ... done Successfully installed fpdf-1.7.2 # Test that it work C:\code λ python Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from fpdf import FPDF >>> >>> pdf = FPDF() >>> pdf.add_page() >>> pdf.set_font('Arial', 'B', 16) >>> pdf.cell(40, 10, 'Hello World!') >>> pdf.output('tuto1.pdf', 'F') '' >>>Now that all work from command line make sure that down in left corner VS Code, that same version as tested over is used. Python 3.9/3.8 and pip installation under Windows VS Code from start RE: ModuleNotFoundError: No module named 'fpdf' - KatMac - Apr-18-2021 Hi I tried what you said and it still doesn`t work. Getting same error as before: ModuleNotFoundError: No module named 'fpdf' RE: ModuleNotFoundError: No module named 'fpdf' - snippsat - Apr-18-2021 Do pip show fpdf .Can do test in VS Code to and i am pretty sure that it work🔨 As in image under click down in left corner and make sure that same root path to Python match.So in my case that is C:\Python39\... For you it should be C:\Users\Owner\AppData\Local\Programs\Python\Python39\... RE: ModuleNotFoundError: No module named 'fpdf' - KatMac - Apr-19-2021 Hi I decided to uninstall and reinstall python issue is resolved now. Thank you for helping me. |