I am trying to install python paramiko using below command:
pip3 install paramiko
then I got an error:
The program 'pip3' is currently not installed. You can install it by typing:
sudo apt install python3-pip
then tried to install pip using above command, the result is:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (8.1.1-2ubuntu0.4).
The following packages were automatically installed and are no longer required:
python3-babel python3-dateutil python3-decorator python3-funcsigs python3-gevent python3-greenlet python3-html2text python3-mock python3-ofxparse python3-passlib python3-pbr python3-psutil
python3-psycopg2 python3-pydot python3-pyinotify python3-pypdf2 python3-serial python3-stdnum python3-tz python3-usb python3-vatnumber python3-werkzeug python3-yaml
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 82 not upgraded.
Then I tried to install paramiko again but getting the same error, pip is not installed.
When I type pip3 --version the output is:
The program 'pip3' is currently not installed. You can install it by typing:
sudo apt install python3-pip
pip --version
Output is:
pip 10.0.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
How can I resolve this?
For pip on python 3 you have to enter the following command:
sudo apt install python3-pip
Hope this helps
I usually do:
sudo python3 -m pip install paramiko
or
python3 -m pip --version
instead of
pip3 install
I don't know why but python -m pip etc ... works better than just pip etc... in my case.
if you really don't have pip (but I thought it comes automatically with python now) you can also get it using:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
(from here)
it works on my computer, I don't know why sudo apt-get would not work but you can try this solution instead.
In Ubuntu I have Python3 as default and pip and pip3. Now I need Python2 to install an app. I have Python2 installed but not pip2. If I try
sudo python2 -m pip install my_app
or
sudo python2 -m pip2 install my_app
I get:
No module named pip
If I install pip2 via easy_install or get-pip.py will it make me problems with pip wich is for Python3? What is the right way?
You can safely install pip for both py2.x and py3.x simultaneously. You can explicitly specify which pip to use by using pip2 for py2.x or pip3 for py3.x.
sudo apt-get install python-pip installs pip2
while
sudo apt-get install python3-pip installs pip3
also to keep things simple, just using
sudo pip2 install my_app
will suffice.
EDIT:
I have noticed that in some cases even pip3 calls the python2.x interpreter. To be on a totally safe side I recommend using -
sudo python2 -m pip install my_app for python2.x and
sudo python3 -m pip install my_app for python3.x
sudo apt-get install python-pip
Is a right command to my knowledge. Bit I don't think the other methods will interrupt your python3 but no experience with those.
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
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.
I have both python2.7 and python3.2 installed in Ubuntu 12.04.
The symbolic link python links to python2.7.
When I type:
sudo pip install package-name
It will default install python2 version of package-name.
Some package supports both python2 and python3.
How to install python3 version of package-name via pip?
Ubuntu 12.10+ and Fedora 13+ have a package called python3-pip which will install pip-3.2 (or pip-3.3, pip-3.4 or pip3 for newer versions) without needing this jumping through hoops.
I came across this and fixed this without needing the likes of wget or virtualenvs (assuming Ubuntu 12.04):
Install package python3-setuptools: run sudo aptitude install python3-setuptools, this will give you the command easy_install3.
Install pip using Python 3's setuptools: run sudo easy_install3 pip, this will give you the command pip-3.2 like kev's solution.
Install your PyPI packages: run sudo pip-3.2 install <package> (installing python packages into your base system requires root, of course).
…
Profit!
You may want to build a virtualenv of python3, then install packages of python3 after activating the virtualenv. So your system won't be messed up :)
This could be something like:
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
pip install package-name
Short Answer
sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME
Source: Shashank Bharadwaj's comment
Long Answer
The short answer applies only on newer systems. On some versions of Ubuntu the command is pip-3.2:
sudo pip-3.2 install MODULE_NAME
If it doesn't work, this method should work for any Linux distro and supported version:
sudo apt-get install curl
curl https://bootstrap.pypa.io/get-pip.py | sudo python3
sudo pip3 install MODULE_NAME
If you don't have curl, use wget. If you don't have sudo, switch to root. If pip3 symlink does not exists, check for something like pip-3.X
Much python packages require also the dev package, so install it too:
sudo apt-get install python3-dev
Sources:
python installing packages with pip
Pip latest install
Check also Tobu's answer if you want an even more upgraded version of Python.
I want to add that using a virtual environment is usually the preferred way to develop a python application, so #felixyan answer is probably the best in an ideal world. But if you really want to install that package globally, or if need to test / use it frequently without activating a virtual environment, I suppose installing it as a global package is the way to go.
Well, on ubuntu 13.10/14.04, things are a little different.
Install
$ sudo apt-get install python3-pip
Install packages
$ sudo pip3 install packagename
NOT pip-3.3 install
The easiest way to install latest pip2/pip3 and corresponding packages:
curl https://bootstrap.pypa.io/get-pip.py | python2
pip2 install package-name
curl https://bootstrap.pypa.io/get-pip.py | python3
pip3 install package-name
Note: please run these commands as root
I had the same problem while trying to install pylab, and I have found this link
So what I have done to install pylab within Python 3 is:
python3 -m pip install SomePackage
It has worked properly, and as you can see in the link you can do this for every Python version you have, so I guess this solves your problem.
Old question, but none of the answers satisfies me. One of my systems is running Ubuntu 12.04 LTS and for some reason there's no package python3-pip or python-pip for Python 3. So here is what I've done (all commands were executed as root):
Install setuptools for Python3 in case you haven't.
apt-get install python3-setuptools
or
aptitude install python3-setuptools
With Python 2.4+ you can invoke easy_install with specific Python version by using python -m easy_install. So pip for Python 3 could be installed by:
python3 -m easy_install pip
That's it, you got pip for Python 3. Now just invoke pip with the specific version of Python to install package for Python 3. For example, with Python 3.2 installed on my system, I used:
pip-3.2 install [package]
If you have pip installed in both pythons, and both are in your path, just use:
$ pip-2.7 install PACKAGENAME
$ pip-3.2 install PACKAGENAME
References:
http://www.pip-installer.org/docs/pip/en/0.8.3/news.html#id4
https://github.com/pypa/pip/issues/200
This is a duplicate of question #2812520
If your system has python2 as default, use below command to install packages to python3
$ python3 -m pip install <package-name>
Easy enough:
sudo aptitude install python3-pip
pip-3.2 install --user pkg
If you want Python 3.3, which isn't the default as of Ubuntu 12.10:
sudo aptitude install python3-pip python3.3
python3.3 -m pip.runner install --user pkg
You can alternatively just run pip3 install packagename instead of pip,
Firstly, you need to install pip for the Python 3 installation that you want. Then you run that pip to install packages for that Python version.
Since you have both pip and python 3 in /usr/bin, I assume they are both installed with a package manager of some sort. That package manager should also have a Python 3 pip. That's the one you should install.
Felix' recommendation of virtualenv is a good one. If you are only testing, or you are doing development, then you shouldn't install the package in the system python. Using virtualenv, or even building your own Pythons for development, is better in those cases.
But if you actually do want to install this package in the system python, installing pip for Python 3 is the way to go.
Although the question relates to Ubuntu, let me contribute by saying that I'm on Mac and my python command defaults to Python 2.7.5. I have Python 3 as well, accessible via python3, so knowing the pip package origin, I just downloaded it and issued sudo python3 setup.py install against it and, surely enough, only Python 3 has now this module inside its site packages. Hope this helps a wandering Mac-stranger.
Execute the pip binary directly.
First locate the version of PIP you want.
jon-mint python3.3 # whereis ip
ip: /bin/ip /sbin/ip /usr/share/man/man8/ip.8.gz /usr/share/man/man7/ip.7.gz
Then execute.
jon-mint python3.3 # pip3.3 install pexpect
Downloading/unpacking pexpect
Downloading pexpect-3.2.tar.gz (131kB): 131kB downloaded
Running setup.py (path:/tmp/pip_build_root/pexpect/setup.py) egg_info for package pexpect
Installing collected packages: pexpect
Running setup.py install for pexpect
Successfully installed pexpect
Cleaning up...
You should install ALL dependencies:
sudo apt-get install build-essential python3-dev python3-setuptools python3-numpy python3-scipy libatlas-dev libatlas3gf-base
Install pip3(if you have installed, please look step 3):
sudo apt-get install python3-pip
Iinstall scikit-learn by pip3
pip3 install -U scikit-learn
Open your terminal and entry python3 environment, type import sklearn to check it.
To install pip for python3 use should use pip3 instead of pip.
To install python in ubuntu 18.08 bionic
before installing a version of python, activate virtual environment so that it won't have any problem in a future versions of python.
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
then install the actual python version you want.
>> sudo apt-get install python3.7
To install the required pip package in ubuntu
>> sudo apt-get install python3-pip
You Can Simply type in terminal/console .
Commands
sudo apt update
sudo apt upgrade
sudo apt install python3-pip3
pip3 install package-name
Another way to install python3 is using wget. Below are the steps for installation.
wget http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
tar xJf ./Python-3.3.5.tar.xz
cd ./Python-3.3.5
./configure --prefix=/opt/python3.3
make && sudo make install
Also,one can create an alias for the same using
echo 'alias py="/opt/python3.3/bin/python3.3"' >> ~/.bashrc
Now open a new terminal and type py and press Enter.