PIP not available from command line - python

I am using CentOS. It has Python 3.6 version installed.
From command line if I try to execute PIP, I get error: "Command not found"
How to add Python folder to the environment path?

Pip is not available in CentOS 7 core repositories. To install pip we need to enable the EPEL repository:
sudo yum install epel-release
Once the EPEL repository is enabled we can install pip and all of its dependencies with the following command:
sudo yum install python-pip
To verify that the pip is installed correctly run the following command which will print the pip version:
pip --version
Enjoy! :)

Apparently you should install pip separately in CentOS.
Try this Link.

Related

Pip for Python 3.8

How do I install Pip for Python 3.8 ? I made 3.8 my default Python version.
sudo apt install python3.8-pip
gives
unable to locate package python3.8-pip
and running
python3.8 -m pip install [package]
gives
no module named pip
I can't run sudo apt install python3-pip because it installs pip for Python 3.6
Install pip the official way:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.8 get-pip.py
made 3.8 my default Python version
It depends on how you did that, but it might break something in your OS. For example some packages on Ubuntu 18.04 might depend on python being python2.7 or python3 being python3.6 with some pip packages preinstalled.
sudo apt install python3.8
sudo apt install python3.8-distutils
wget https://bootstrap.pypa.io/get-pip.py
sudo python3.8 get-pip.py
If you installed Python3.8 using apt, the pip documentation advises against using the get-pip.py script:
Be cautious if you are using a Python install that is managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.
The same page suggests running:
python3.8 -m pip --version
to determine if pip is already installed. I installed Python 3.8 on an Ubuntu18 machine using apt install python3.8, and I verified with the command above that it includes pip. It appears that Ubuntu package doesn't install a pip command that you can run directly. But you can run it using the python3.8 binary directly instead, anywhere you would have used pip:
python3.8 -m pip install [package]
you can try updating line #1 from /usr/bin/pip3 to #!/usr/bin/python3.8 as below
#!/usr/bin/python3.8
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
sys.exit(main())
What I used to install pip according to the current version of default python is:
sudo apt-get install python-pip

Installing a vitual enviroment on Ubuntu Server 18.04.1 - pip package unable to locate

I'm trying to install python/virtual enviroment on Ubuntu Server 18.04.1
python --version
I get: not found
python3 --version
I get: `python 3.6.7`
pip3 freeze
I get: Pip3 not found but can be installed "apt install
python3-pip"
apt install python3-pip
I get: Unable to locate package 'python3-pip'
This is something contradictory: first I get a message how to install pip, then reports that pip can't be found.
You should go this to install pip :
sudo apt-get install python3-pip

Installing pyPdf library module in kali linux to work on Pdf files

How to install pyPdf module in my kali linux ?
I tried with $sudo apt-get install python-pyPdf
getting the error as
E:unable to locate the package python-pyPdf
You are trying to install a Python package using Linux native package management system. It won't work. I believe you have Python and pip installed in Kali. Try,
pip install PyPdf
Update for Kali 2020v4 to solve that issue:
Run
sudo bash
apt-get update
apt-get upgrade
First, check if you have pip3 previously installed
pip3
If the output is command not found then:
apt-get install python3-pip
After having it installed or if you have a pip3 previously installed, run the following command.
pip3 install PyPDF3

Cannot install h5py

I'm trying to install h5py, but when I do pip install h5py or use python setup.py install from the source code, fatal error:
hdf5.h: No such file or directory.
Other posts mention to do pip install libhdf5-dev or pip install libhdf5-serial-dev to resolve this, but it says "no matching distribution found."
How can I install h5py? I am ssh'd into an Odyssey computer using the CentOS 6.5 version of the Linux. Also, I do not have sudo privileges. Thanks!
Your error is because you are missing the hdf5.h header, pip will not install the development headers, you need to install them using your package manager, on Centos it would be:
yum install hdf5-devel
If you look at the installation instrcutions:
Source installation on Linux and OS X
You need, via apt-get, yum or Homebrew:
Python 2.6, 2.7, 3.3, or 3.4 with development headers (python-dev or similar)
HDF5 1.8.4 or newer, shared library version with development headers (libhdf5-dev or similar)
NumPy 1.6.1 or later
This link helped:
https://github.com/Homebrew/legacy-homebrew/issues/23144
I installed LinuxHomeBrew and did:
brew tap homebrew/science
brew install hdf5
pip install h5py
I was able to install h5py!
sudo apt-get update
sudo apt-get install python-h5py
(Source)
Also, not pip install libhdf5-dev or pip install libhdf5-serial-dev, but apt install libhdf5-dev and apt install libhdf5-serial-dev.
Then, run pip install h5py
Running the below fixed my problem as I had an error related to xlocale.h
sudo ln -s /usr/include/locale.h /usr/include/xlocale.h

How to install python3 version of package via pip on Ubuntu?

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.

Categories