$ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-pip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
python3-pip
both my pip and pip3 are installed in python 3
pip -V
pip 20.1.1 from /usr/lib/python3/dist-packages/pip (python 3.8)
pip3 -V
pip 20.1.1 from /usr/lib/python3/dist-packages/pip (python 3.8)
Now i cant install pip
...it shows above error
If you have python(python2) installed you then you can use following command to install pip(for python2).
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
Now you can check for pip2
pip2 --version
I hope these will help you
Just for reference, this problem can occur if you are using Windows Ubuntu Shell and your firewall is blocking your Ubuntu sandbox's traffic. In that case installation resources can not be found and simple apt-update will not work.
In order to test if the firwall causes your problem, you can simply try to ping a website. Also if apt-update will fail with connection refused the firwall is likely your problem. Check this post on how to add your sandbox to the firewall whitelist (Endpoint Protection).
Use these commands first then try again and perform a reinstallation by sudo apt reinstall python3-pip
sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo apt-get update
Related
I'm trying to install pip for Python 3.8 on an Ubuntu 18.04 LTS.
I know this has been asked way too many times. But those questions do not concern keeping Ubuntu's defaults specifically. And the answers on those questions either don't work or go on to suggest something so drastic that it would break the system - e.g. change default python3 version from 3.6 to 3.8. You SHOULDN'T!
So far, I've been able to install python3.8 successfully using the PPA - ppa:deadsnakes/ppa:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8
Changed python command from python2 to python3.8 using update-alternatives:
update-alternatives --remove python /usr/bin/python2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 10
Now, I get python 3.8 when I run python --version:
Python 3.8.5
The problem is, I still can't install pip for Python 3.8.
If I try to install python3-pip, it installs pip for Python 3.6 since python3 still points to python3.6.9, and I intend to keep it that way.
Try installing python-pip, and it will install pip for Python 2.7.
Also there's no such package as python3.8-pip, so I can't install it like:
sudo apt install python3.8-pip
Output:
E: Unable to locate package python3.8-pip
E: Couldn't find any package by glob 'python3.8-pip'
E: Couldn't find any package by regex 'python3.8-pip'
What can I do to install pip for Python 3.8 on an Ubuntu 18.04?
While we can use pip directly as a Python module (the recommended way):
python -m pip --version
This is how I installed it (so it can be called directly):
Firstly, make sure that command pip is available and it isn't being used by pip for Python 2.7
sudo apt remove python-pip
Now if you write pip in the Terminal, you'll get that nothing is installed there:
pip --version
Output:
Command 'pip' not found, but can be installed with:
sudo apt install python-pip
Install python3.8 and setup up correct version on python command using update-alternatives (as done in the question).
Make sure, you have python3-pip installed:
(This won't work without python3-pip. Although this will install pip 9.0.1 from python 3.6, we'll need it.)
sudo apt install python3-pip
This will install pip 9.0.1 as pip3:
pip3 --version
Output:
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
Now, to install pip for Python 3.8, I used pip by calling it as a python module (ironic!):
python -m pip install pip
Output:
Collecting pip
Downloading https://files.pythonhosted.org/packages/36/74/38c2410d688ac7b48afa07d413674afc1f903c1c1f854de51dc8eb2367a5/pip-20.2-py2.py3-none-any.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 288kB/s
Installing collected packages: pip
Successfully installed pip-20.2
It looks like, when I called pip (which was installed for Python 3.6, BTW) as a module of Python 3.8, and installed pip, it actually worked.
Now, make sure your ~/.local/bin directory is set in PATH environment variable:
Open ~/.bashrc using your favourite editor (if you're using zsh, replace .bashrc with .zshrc)
nano ~/.bashrc
And paste the following at the end of the file
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
Finally, source your .bashrc (or restart the Terminal window):
source ~/.bashrc
Now if you try running pip directly it'll give you the correct version:
pip --version
Output:
pip 20.2 from /home/qumber/.local/lib/python3.8/site-packages/pip (python 3.8)
Sweet!
As suggested in official documentation you can try with get-pip.py.
wget https://bootstrap.pypa.io/get-pip.py
python3.8 get-pip.py
This will install pip as pip3.8
Another solution would be to install the pip that is in apt. sudo apt install python3-pip. The version of the pip that it installs is for all versions of Python not only for version 3.6 once installed you just need to update the pip with the command python3.8 -m pip install pip and he will be install the latest version of pip for Python.
I would not advise you to remove Python2 because it is an important module for the system you should just create a permanent "alias" in .bashrc for Python3 I did like this alias python="python3.8.
# install py3.8 and dependencies for the pip3 bootstrap script
add-apt-repository -y ppa:deadsnakes/ppa && \
apt install -y python3.8 python3.8-distutils
# download and run the pip3 bootstrap script
cd /tmp && wget https://bootstrap.pypa.io/get-pip.py && \
python3.8 /tmp/get-pip.py
# use pip py3.8 module to install python packages
python3.8 -m pip install numpy pandas
Install python v3.8 as python
RUN apt update --fix-missing && \
apt install python3.8 -y && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 10
Install pip for python 3.8
RUN apt install python3-pip -y && \
python -m pip install --upgrade pip
I did this a couple days ago and I struggled a lot with it but I finally got it working, so I wrote up what I did as a blog post.
In the end I think I may have done mostly the same things as the above answer, but if you got lost following it, maybe my screenshots etc will help.
Here's the tl;dr of the process I did:
Uninstall python3-pip & python-pip using apt
Remove the old pip files from /usr/local/bin
Reinstall python3-pip using apt
Add $HOME/.local/bin to your $PATH (also restart your shell to make sure you did this right)
On ubuntu server
sudo apt install python -y
For more information check this blog here.
https://teckresolve.com/install-python-packages-using-pip/
I am trying to install mininet-wifi. After downloading it, I have been using the following command to install it:
sudo util/install.sh -Wlnfv
However, I keep getting the error:
E: Unable to locate package python-pip
I have tried multiple times to download python-pip. I know mininet-wifi utilizes python 2 instead of python 3. I have tried to download python-pip using the command:
sudo apt-get install python-pip
But that leads to the same error:
E: Unable to locate package python-pip
Pip for Python 2 is not included in the Ubuntu 20.04 repositories. You need to install pip for Python 2 using the get-pip.py script.
1. Start by enabling the universe repository:
sudo add-apt-repository universe
2. Update the packages index and install Python 2:
sudo apt update
sudo apt install python2
3. Use curl to download the get-pip.py script:
curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
4. Once the repository is enabled, run the script as sudo user with python2 to install pip :
sudo python2 get-pip.py
If an error occurs, as a fallback, the specific 2.7 version of get-pip.py can be used:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
Pip will be installed globally. If you want to install it only for your user, run the command without sudo. The script will also install setuptools and wheel, which allow you to install source distributions
Verify the installation by printing the pip version number:
pip2 --version
The output will look something like this:
pip 20.0.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
Since Python 2 is past its end-of-life, few packages for Python2 are included in 20.04. You have to install pip for Python 2 manually:
First, install Python 2:
sudo apt install python2
Then, follow https://pip.pypa.io/en/stable/installing/ , using python2:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python2 get-pip.py
You can run the second step with sudo. If you don't use sudo, you'll need to change PATH, as suggested by the installation message. Alternatively, and possibly better (since it doesn't change PATH), use
python2 -m pip
whenever you need pip2.
In my case, the curl command for downloading get-pip.py gave a syntax error on running sudo python get-pip.py.
But manual download by visiting https://bootstrap.pypa.io/ and downloading get-pip.py worked fine for me.
I've found that creating a virtualenv for Python 2.7 installs also pip
$ virtualenv -p python2 venv
$ . venv/bin/activate
$ pip --version
pip 20.0.2 from /home/.../venv/lib/python2.7/site-packages/pip (python 2.7)
Put python3 instead ${PYPKG} in line 202, and instead python-pip in line 596 in file install.sh of mininet-wifi.
To solve the problem of:
E: Unable to locate package python-pip
Run the package update index cmd:
sudo apt update
If not that, then python-pip-whl (which is also a package installer) is available in the universe repository, make sure that's installed and then run:
sudo apt-get install python-pip-whl
I specifically needed a Dockerfile file and this is what I have put inside so that it works without errors, I hope it will help someone.
This is Dockerfile file:
FROM ubuntu:latest
RUN apt-get update -y
RUN apt-get install -y python3 python3-dev
WORKDIR /app
COPY . /app
ENV DEBUG=True
EXPOSE 80
I am clueless here. I need to upgrade to python 3.8.0. So, I run this:
sudo apt-get install python3 3.8.0
But I get the following message:
As you can see. It writes "python3 is already the newest version". It is not.
Also, I get the "held broken packages" error after that. I am not sure if they are related.
you might have the newest version of tthat particular's repository.
try here:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.8
sudo apt install python3.8-distutils
python3.8 -m pip install --upgrade pip setuptools wheel
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.)
Im trying to install mitmproxy on a Ubuntu 14.04 computer, but I'm getting error. I found on the web how I should install it by using this code:
sudo install pip mitmproxy
So I installed python, now when I run the command it works until I get this problem:
Command python.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography
I tried to update python but still the same
Exactly I installed python in this way:
sudo apt-get install python-pyasn1 python-flask python-urwid
What's wrong???
UPDATE
Here is the pip.log
You can also pip install from github:
In this order:
Install netlib: (sudo) pip install git+https://github.com/mitmproxy/netlib.git
Install mitmproxy: (sudo) pip install git+https://github.com/mitmproxy/mitmproxy.git
This will install all requisite libraries and provide you with the most up-to-date version of mitmproxy.
Judging by the log you got from pip the problem here is that the development libraries for libffi are not installed. You can rectify it with:
$ sudo apt-get install libffi-dev
and retry installing.
The clue in your error log is this line:
Package libffi was not found in the pkg-config search path.
If pkg-config is unable to find a library it means that the files needed to develop with this library are missing. On an Ubuntu or Debian system this usually means installing the package that has the name of the library plus -dev.
Running these 2 commands worked for me (Ubuntu 14.04)
sudo apt-get install python-pip python-dev libffi-dev libssl-dev
libxml2-dev libxslt1-dev libjpeg8-dev zlib1g-dev
sudo pip install mitmproxy
EDIT: You need to run this command before you will be able to use "mitmproxy -p port_number". since it gives error "Error: mitmproxy requires a UTF console environment."
export LC_ALL=en_US.UTF-8
EDIT 2: After installation, you need to generate certificate first and have to transfer it into your device then setup manual proxy by entering your computer's IP address and port on which you will run mitmproxy server. Use below commands to generate certificate:
sudo apt-get install libnss3-tools
certutil -d sql:$HOME/.pki/nssdb -A -t C -n mitmproxy -i ~/.mitmproxy/mitmproxy-ca-cert.pem
$ pip uninstall mitmproxy netlib
$ sudo apt-get install -y build-essential libssl-dev libffi-dev python-dev python-pip libxml2-dev libxslt-dev git
$ sudo pip install git+https://github.com/mitmproxy/netlib.git#master
sudo pip install git+https://github.com/mitmproxy/mitmproxy.git#master
$ sudo python #
>>> from netlib import certffi
>>> exit()