FPDF Import Error: cannot import name 'FPDF' from 'fpdf' (unknown location)

Viewed 810

I'm using Python 3.8.5, conda 4.10.3 and FPDF2 2.3.1

When I try to import the package, I get the following error:

Input:

from fpdf import FPDF

Response:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/var/folders/q3/38dtckns13b368s1x7g59hh40000gn/T/ipykernel_917/4051462934.py in <module>
----> 1 from fpdf import FPDF

ImportError: cannot import name 'FPDF' from 'fpdf' (unknown location)

I have uninstalled and reinstalled FPDF2 several times, both from PyPI pip install fpdf2 and from anaconda conda install -c conda-forge fpdf2.

Installation is successfull but code keeps running with errors.

2 Answers

Try to uninstall the module through this command:

pip uninstall fpdf2

then again install the module with this command:

pip install fpdf2

Hope this will work. :)

I solved the problem downloading fpdf from pip, instead of Anaconda, after being adviced by the fpdf team.

Related