Trying to install grequests on Ubuntu? - python

When I try to install grequests on Ubuntu with pip:
sudo pip install grequests
I get this error, but my gcc seems fine:
In file included from gevent/core.c:253:0:
gevent/libevent.h:9:19: fatal error: event.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

You need to install libevent, which on Ubuntu can be done with:
apt-get install libevent-dev
Alternatively, to install gevent and all it's dependencies automatically:
apt-get install python-gevent

sudo apt-get install libevent-dev

grequests depends on the Python module gevent, and pip will pull that in for you automatically.
gevent depends on the C library libevent, and there's no way pip can take care of that for you. So, you need to install it manually, e.g., using your distro's package manager.
(Alternatively, gevent 1.0 and later no longer rely on libevent, or any other external dependencies. But, as of 25 Sep 2013, 1.0 isn't out yet…)

I also get the same error. Following commands helped me:
$ sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev python3-dev
Now try to install grequests again by following command:
Python 2
$ pip install grequests
Python 3.x
$ pip3 install grequests
If these commands doesn't help, then you can use the following commands:
Python 2
$ sudo apt install python-pip
$ pip install wheel
Python 3.x
$ sudo apt install python3-pip
$ pip3 install wheel
OR
$ sudo apt-get install python3-dev python3-pip python3-venv python3-wheel -y
Now retry to install grequests. Hope the installation will work properly now.

Related

lzma.h file (clang) not found when pip3 install pypi-kenlm or kenlm [duplicate]

I'm trying to install docker-registry. I got stuck after this:
$ apt-get install python-pip python-dev
$ pip install -r requirements.txt
[...]
backports/lzma/_lzmamodule.c:115:18: fatal error: lzma.h: No such file or directory
The docker-registry I downloaded is v0.6.7
$ apt-get install -y liblzma-dev
On Centos the package is
yum install -y xz-devel
For OSX with Homebrew.
brew install xz
The formula is xz which because lzma formula is deprecated, since it became a part of xz.
And finally on RedHat (I tested it on RHEL 7.4)
yum install -y xz-devel

Ubuntu 18.04 python3.7 confluent-kafka no module named 'confluent_kafka.cimpl'

I have VM run on ubuntu 18.04.
On that I installed:
python3.7
confluent-kafka
when run python script, I met this message error:
from .cimpl import (Consumer, #noqa
ModuleNotFoundError: no module named 'confluent_kafka.cimpl'
I've tried to run/install/remove in many ways but this error still occurred.
I don't know why. Please help me.
Install modules confluent_kafka
pip3 install confluent_kafka
or try these steps
sudo apt-get install librdkafka1
sudo apt-get install librdkafka-dev
sudo apt-get install libssl-dev
sudo apt-get install liblz4-dev
sudo apt-get install libsasl2-dev
git clone https://github.com/confluentinc/confluent-kafka-python.git
cd confluent-kafka-python; ./configure ; make ; sudo make install

pyconfig.h missing during "pip install cryptography"

I wanna set up scrapy cluster follow this link scrapy-cluster,Everything is ok before I run this command:
pip install -r requirements.txt
The requirements.txt looks like:
cffi==1.2.1
characteristic==14.3.0
ConcurrentLogHandler>=0.9.1
cryptography==0.9.1
...
I guess the above command means to install packages in requirements.txt.But I don't want it to specify the version,So I change it to this:
cat requirements.txt | while read line; do pip install ${line%%[>=]*} --user;done
When install cryptography,it gives me the error:
build/temp.linux-x86_64-2.7/_openssl.c:12:24:fatal error:pyconfig.h:No such file or directory
#include <pyconfig.h>
I don't know how to solved this , I have tried a lot of methods ,but failed. my system is centos 7, and the version of python is 2.7.5(default).
Besides, Is there any other scrapy frame which is appliable for a large number of urls . Thanks in advance
For Ubuntu, python2
apt-get install python-dev
For Ubuntu, python3
apt-get install python3-dev
I have solved it by myself. for the default python of centos, there is only a file named pyconfg-64.h in usr/include/python2.7/,So run the command
yum install python-devel
Then it works.
for python3.6,
apt-get install python3.6-dev
and
apt-get install libssl-dev libffi-dev
i use python 2 on ubuntu and got the same problem when installing cryptography.
after i run this command
apt-get install python-dev libssl-dev libffi-dev
then it works.
For Python 3.7 on Debian, the following works for me.
apt-get install python3.7-dev
and
apt-get install libssl-dev
You may also need:
apt-get install libffi-dev
On a Debian based distro (AntiX distro), together with apt-get install python3-dev, I also installed rust, to complete successfully the pip3 install cryptography command. So, I gave:
$ sudo apt-get install build-essential curl python3-dev libssl-dev libffi-dev
$ sudo curl https://sh.rustup.rs -sSf | sh
When prompted (Figure 1), type 1 and hit Enter on your keyboard.
Once it completes, you have to give following commands:
$ source $HOME/.cargo/env
$ source ~/.profile
$ pip3 install cryptography

Cannot import installed python package

I'm trying to install python-numpy package on my ubuntu 14.04 machine. I ran sudo apt-get install python-numpy command to install it and it says the package has been installed but when i try to access it, i'm unable to do so.
When you type:
sudo pip install package-name
It will default install python2 version of package-name some packages might be supported in both python3 and python3 some might work might not
I would suggest
sudo apt-get install python3-pip
sudo pip3 install MODULENAME
or can even try this
sudo apt-get install curl
curl https://bootstrap.pypa.io/get-pip.py | sudo python3
sudo pip3 install MODULENAME
Many python packages require also the dev package, so install it too:
sudo apt-get install python3-dev
Also check for the sys.path [ make sure module is in the python path ]

How to prepare Ubuntu 14.04 for installing Django

I came across a tutorial which lists a number of libraries to install before installing Django (I am using Ubuntu 14.04, Python3, and Django 1.8):
$ sudo apt-get update
$ sudo apt-get -y upgrade
$ sudo apt-get install -y build-essential
$ sudo apt-get install python-setuptools python-dev python3.4-dev python-software-properties libpq-dev
$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev
$ sudo apt-get build-dep python-imaging
But other tutorials may not list so many libraries to install. I wonder which are absolutely necessary, and others may be omitted?
You only need to install these dependencies if you want image processing via pillow and if you plan on installing it via pip (the Python package manager) rather than apt-get (Ubuntu's package manager).
Since you're using a virtualenv, you will need to install this package from source. The following commands will get the build dependencies and install pillow using pip.
$ sudo apt-get build-dep python3-imaging
$ pip install pillow
Note that pillow is a beast to compile. Be prepared to wait several minutes.

Categories