I'm trying to use the PyTrends
module that is available on Github (here). To use this script I need to install the fake-useragent module with:
pip install fake-useragent
However, every time I import the file and attempt execute commands in console, I get the following error:
>>> from pytrends2.pyGTrends import pyGTrends
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pytrends2.py", line 18, in <module>
from fake_useragent import UserAgent
ImportError: No module named fake_useragent
I've tried different things and had no luck. When trying to make sure the dependency modules are installed with:
pip install pyyaml ua-parser user-agents
... I get the following:
abraham@abraham-Inspiron-3521:~$ sudo pip install pyyaml user-agents
Downloading/unpacking pyyaml
Downloading PyYAML-3.11.tar.gz (248kB): 248kB downloaded
Running setup.py (path:/tmp/pip_build_root/pyyaml/setup.py) egg_info for package pyyaml
Downloading/unpacking user-agents
Downloading user_agents-1.0.1-py2-none-any.whl
Downloading/unpacking ua-parser (from user-agents)
Downloading ua_parser-0.5.0-py2-none-any.whl (66kB): 66kB downloaded
Installing collected packages: pyyaml, user-agents, ua-parser
Running setup.py install for pyyaml
checking if libyaml is compilable
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory
#include <yaml.h>
^
compilation terminated.
libyaml is not found or a compiler error: forcing --without-libyaml
(if libyaml is installed correctly, you may need to
specify the option --include-dirs or uncomment and
modify the parameter include_dirs in setup.cfg)
Successfully installed pyyaml user-agents ua-parser
Cleaning up...
You probably want to install the development libraries for your Linux first. Make sure you have all development packages installed.
If you do operate on Ubuntu try to run this first
sudo apt-get install gcc libyaml-dev libpython2.7-dev
You will be able then to install your required python libraries.
pip install pyyaml ua-parser user-agents fake-useragent
Best wishes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With