using python faker library but have import error - python

I had this line in my code from faker import Factoryand 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?

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 :)

For me, It was working when I run pip uninstall fake-factory.

Related

Module Not Found Error after library installation

I am trying to use the Scratch library.
For example:
from scratch.probability import normal_cdf
from scratch.linear_algebra import Vector, dot
#...
I installed Scratch using pip install scratch but I receive this error: ModuleNotFoundError: No module named 'scratch'.
Can you help me?
pip install scratch will install this: https://pypi.org/project/scratch/
But I guess that what you want to use is that: https://github.com/joelgrus/data-science-from-scratch
The second one is not meant to be installed through pip but used directly in a clone of the project as documented in its README.
About pip install scratch-probability (https://pypi.org/project/scratch-probability/#description), as it's not documented, you need to go check the content of the tarball to know how the package inside are named (if they are what's expected).

ModuleNotFoundError: No module named 'flask_weasyprint'

i am getting error ModuleNotFoundError: No module named 'flask_weasyprint'
when importing
from flask_weasyprint import HTML, render_pdf
when I set up an existing flask project. So I am trying to install flask_weasyprint using
pip install Flask-WeasyPrint
command but it gives below error. But i do not understand what is saying this error.
Yeah, seems like a bug. Try pip3 install Flask-WeasyPrint
Seem like you get this same issue
Try:
py -m pip install wheel
In future avoid post screenshots of error.

Failed to install scitools-iris using pip: ImportError No module named target_pkg (in pyke)

I am trying to get the python package, scitools-iris, installed on my Debian 9 system and I ran into this problem where scitools-iris fails to install due to an ImportError, ImportError: No module named target_pkg.
I am using python 2.7 and all packages are installed using pip only. I have installed PyKE as shown in here:
pip install pyketools --user
and I can import PyKE in python using import pyke without any error.
Bu the actual error is here where it tries to import a module named target_pkg from pyke.target_pkg. I tried the import statement in python,
from pyke.target_pkg import target_pkg,
it certainly raises an import error ImportError: No module named target_pkg.
How do I get around this problem and install iris in my system?
Have I installed the wrong package for PyKE?
Found out what I have been doing wrong. I actually had the wrong package installed for PyKE using pip. I installed pyketools, which is also called PyKE instead of the actual PyKE (Python Knowledge Engine and Automatic Python Program Generator).
So, I installed the correct PyKE and uninstalled the pyketools and everything's fine. Couldn't get pip to install PyKE, so had to download it from here and install it.

Import error when importing MsgPackSerializer

I am trying to import the MsgPackSerializer from autobahn library. But I am getting the following error:
ImportError: cannot import name MsgPackSerializer
I have tried this solution but did not work - https://github.com/Crypto-Expert/stratum-mining/issues/211#issuecomment-33867305
Using Miniconda 3.
Okay, it seems that I had to do pip install u-msgpack-python.
For python 3 you need pip install msgpack. Tested in python 3.7 Autobahn 20.3.1 .
Don't forget to uninstall u-msgpack-python if you had it installed.

Importing universe

I am trying to use OpenAI and I got a import error about universe on Jupyter notebook :
import gym
import universe
No module named 'universe'
When it comes to working on terminal, it returns this error
No module named 'twisted.internet'
Then I also had install twisted with pip, I got this next error :
No module named 'ujson'
and after install ujson, I got a error No module named 'go_vncdriver' again.
I think that I will get other error again.
So which way to install is most convenient ?
Could I install all packages at once ?
préferably, using pip install.
I am using OSX and python3.6.
Try installing,
pip install go_vncdriver
And check again.

Categories