Need to install python packages like pip, numpy, cv2 on an Amazon EC2 instance of Ubuntu. I tried using sudo apt-get install python-pip but got below given error:
ubuntu#ip-172-31-35-131:~$ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
Try first sudo apt-get update then
sudo apt-get install python-pip
Have you tried the instructions here?
You can install pip from PyPa directly:
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
Your system may have a concurrent python3.x under the name python3, then you can install pip for it with python3 get-pip.py --user as well. (Or contrarily, python2.x under the name python2.)
I have attempted the following:
sudo pip install git+https://github.com/saffsd/langid.py.git
However I get the following error.
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
However both python-dev and numpy are already installed.
selah#selah-OptiPlex-9020:~$ dpkg -s python-numpy
Package: python-numpy
Status: install ok installed
...
and
selah#selah-OptiPlex-9020:~$ dpkg -s python-dev
Package: python-dev
Status: install ok installed
...
Any ideas of what I could try next?
Install langid's dependencies and directly the version 1.1.4 from pypy
sudo pip install https://pypi.python.org/packages/source/l/langid/langid-1.1.4dev.tar.gz
I am very new to Ubuntu OS and Python as well. I want to install Django. But i dont have easy_install and I tried below command to install pip
sudo apt-get install python-pip
I got an error as below
Unable to locate package python-pip
I tried below command as well
sudo apt-get install python-pip
and i got error as below
E: Package 'python-setuptools' has no installation candidate
I am very confused in installing django, How to successfully install django
First update repositories
sudo apt-get update
then try
sudo apt-get install python-pip python-dev build-essential python-setuptools
if nothing, you can install pip and setuptools packages manually. Download them from PyPI.
Install pip
To install or upgrade pip, securely download get-pip.py.
Then run the following (which may require administrator access):
sudo python get-pip.py
If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.
To upgrade an existing setuptools (or distribute), run pip install -U setuptools
Upgrade pip
On Linux or OS X:
sudo pip install -U pip
Then you can download django using pip,
sudo pip install django
Install
First you need make sure you have Python install, here I take 2.7.6 as example. For how to install Python, you can go check this link:
https://askubuntu.com/questions/443048/python-2-7-6-on-ubuntu-12-04-how-to
Then you can start install Django and setup database as follow:
sudo apt-get install python-django
sudo apt-get install mysql-server
sudo apt-get install python-mysqldb
You can find more configuration detail in this link
http://yuwenqing.org/?p=108
Also, for less pain in future develop, you should deploy your Django application in python virtualEnv, here are some detail of why you need virtualEnv.
http://yuwenqing.org/?p=126
I try to install PyICU but it require libicui18n.so.36
I dont know How to get it could you help me please...
If you are on Ubuntu, try installing the python-pyicu package, which should take care of any binary dependencies, instead of trying to install from the sources:
$ sudo apt-get install python-pyicu
Alternatively, if you really need to install from the source package (e.g. with pip install pyicu), you'll need to the libicu development package installed:
$ sudo apt-get install libicu-dev
I'm having difficulty installing lxml with easy_install on Ubuntu 11.
When I type $ easy_install lxml I get:
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.3
Downloading http://lxml.de/files/lxml-2.3.tgz
Processing lxml-2.3.tgz
Running lxml-2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7UdQOZ/lxml-2.3/egg-dist-tmp-GacQGy
Building lxml version 2.3.
Building without Cython.
ERROR: /bin/sh: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
In file included from src/lxml/lxml.etree.c:227:0:
src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory
compilation terminated.
It seems that libxslt or libxml2 is not installed. I've tried following the instructions at http://www.techsww.com/tutorials/libraries/libxslt/installation/installing_libxslt_on_ubuntu_linux.php and http://www.techsww.com/tutorials/libraries/libxml/installation/installing_libxml_on_ubuntu_linux.php with no success.
If I try wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.6.27.tar.gz I get
<successful connection info>
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /libxml2 ... done.
==> SIZE libxml2-sources-2.6.27.tar.gz ... done.
==> PASV ... done. ==> RETR libxml2-sources-2.6.27.tar.gz ...
No such file `libxml2-sources-2.6.27.tar.gz'.
If I try the other first, I'll get to ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2 and that will fail eventually with:
checking for libxml libraries >= 2.6.27... configure: error: Could not find libxml2 anywhere, check ftp://xmlsoft.org/.
I've tried both versions 2.6.27 and 2.6.29 of libxml2 with no difference.
Leaving no stone unturned, I have successfully done sudo apt-get install libxml2-dev, but this changes nothing.
Since you're on Ubuntu, don't bother with those source packages. Just install those development packages using apt-get.
apt-get install libxml2-dev libxslt1-dev python-dev
If you're happy with a possibly older version of lxml altogether though, you could try
apt-get install python-lxml
and be done with it. :)
I also had to install lib32z1-dev before lxml would compile (Ubuntu 13.04 x64).
sudo apt-get install lib32z1-dev
Or all the required packages together:
sudo apt-get install libxml2-dev libxslt-dev python-dev lib32z1-dev
As #Pepijn commented on #Druska 's answer, on ubuntu 13.04 x64, there is no need to use lib32z1-dev, zlib1g-dev is enough:
sudo apt-get install libxml2-dev libxslt-dev python-dev zlib1g-dev
I installed lxml with pip in Vagrant, using Ubuntu 14.04 and had the same problem. Even though all requirements where installed, i got the same error again and again. Turned out, my VM had to little memory by default. With 1024 MB everything works fine.
Add this to your VagrantFile and lxml should properly compile / install:
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
end
Thanks to sixhobbit for the hint (see: can't installing lxml on Ubuntu 12.04).
Step 1
Install latest python updates using this command.
sudo apt-get install python-dev
Step 2
Add first dependency libxml2 version 2.7.0 or later
sudo apt-get install libxml2-dev
Step 3
Add second dependency libxslt version 1.1.23 or later
sudo apt-get install libxslt1-dev
Step 4
Install pip package management tool first. and run this command.
pip install lxml
If you have any doubt Click Here
For Ubuntu 14.04
sudo apt-get install python-lxml
worked for me.
After installing the packages mentioned by AKX I still had the same problem. Solved it with
apt-get install python-dev
For Ubuntu 12.04.3 LTS (Precise Pangolin) I had to do:
apt-get install libxml2-dev libxslt1-dev
(Note the "1" in libxslt1-dev)
Then I just installed lxml with pip/easy_install.
From Ubuntu 18.4 (Bionic Beaver) it is advisable to use apt instead of apt-get since it has much better structural form.
sudo apt install libxml2-dev libxslt1-dev python-dev
If you're happy with a possibly older version of lxml altogether though, you could try
sudo apt install python-lxml
First install Ubuntu's python-lxml package and its dependencies:
sudo apt-get install python-lxml
Then use pip to upgrade to the latest version of lxml for Python:
pip install lxml
Many answers here are rather old,
thanks to the pointer from #Simplans (https://stackoverflow.com/a/37759871/417747) and the home page...
What worked for me (Ubuntu bionic):
sudo apt-get install python3-lxml
(+ sudo apt-get install libxml2-dev libxslt1-dev I installed before it, but not sure if that's the requirement still)