'using python faker library but have import error
I had this line in my code from faker import Factory
and I had the error ImportError: no module named faker
. So I looked up on Stack Overflow and pip installed fake-factory. It says installation successful but then when I ran the code again it gives me another import error:
ImportError: The ``fake-factory`` package is now called ``Faker``.
Please update your requirements.
What am I missing here?
Solution 1:[1]
I had the same problem.
As the ImportError implies, you need to install Faker for this.
Move the directory in which your python library is installed and try this..
First uninstall fake-factory (I use pip) pip uninstall fake-factory
Then check if it is uninstalled using pip freeze
and it should not be there
Then, proceed with installing Faker by pip install Faker
Now, try running that code again, it should work. Hope this helps :)
Solution 2:[2]
For me, It was working when I run pip uninstall fake-factory
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kaustubh Pandey |
Solution 2 | Riddhi |