"E: Unable to locate package python-pip" on Ubuntu 18.04 [duplicate] - python

This question already has answers here:
Unable to install pip in ubuntu?
(2 answers)
Closed 1 year ago.
I am trying to install virtualenv on Ubuntu.
First it said command 'pip' not found, so I typed
sudo apt install python-pip
then it said
E: Unable to locate package python-pip
I tried to reset WSL, download using cmd but it doesn't work with Ubuntu. I don't know why. Even though I have downloaded python3, virtualenv, and pip using cmd. It doesn't work with Ubuntu 18.04. It also fails on Ubuntu 14.04.
aiki#LAPTOP-886AEJJG:~$ pip
Command 'pip' not found, but can be installed with:
sudo apt install python-pip
aiki#LAPTOP-886AEJJG:~$ sudo apt install python-pip
[sudo] password for aiki:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
I'm trying to install jarvis and mycroft on win 10, but I need to use Ubuntu because it only works with Linux.

ls /bin/python*
Identify the highest version of python listed.
If the highest version is something like python2.7 then install python2-pip
If its something like python3.8 then install python3-pip
Example for python3.8:
sudo apt-get install python3-pip

Try following command sequence on Ubuntu terminal:
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python3-pip

Try the following commands in terminal, this will work better:
apt-get install curl
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py

On some kind of Linux, like distros based on Debian, you might want to consider updating your 'apt-get' first, in case you are installing python-pip through it.
sudo apt-get update
This might help apt-get to update its indexes and locate the python-pip package.
After this, u might install it like this-
sudo apt-get install python-pip (Python2)
sudo apt-get install python3-pip (Python3)

You might have python 3 pip installed already. Instead of pip install you can use pip3 install.

To solve the problem of:
E: Unable to locate package python-pip
you should do this. This works with the python2.7 and you not going to get disappointed by it.
follow the steps that are mention below.
go to get-pip.py and copy all the code from it.
open the terminal using CTRL + ALT +T
vi get-pip.py
paste the copied code here and then exit from the vi editor by pressing
ESC then :wq => press Enter
lastly, now run the code and see the magic
sudo python get-pip.py
It automatically adds the pip command in your Linux.
you can see the output of my machine

I'm using WSL2 on Windows 10 and I had the same issue. Try the way which helped me to fix this. I assume that you are using python3.
python3 get-pip.py
sudo apt install python3-pip

Related

I rm python3.9 can i get it back ,

I am new on linux and i tried to change the Symbolic link of python3 in /usr/bin/ ,
and i accidentally remove the python3.9 file !
But i know i didn't delete it completely Because there is still a lot of file called python3.9 .
After that 'apt' didn't work anymore and i got this error :
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
Now , I only have version 2.7 of python and i can't install another because apt don't work !!
This is the result of
:
So I hope someone can help me and I wish you a good afternoon
Edit: As you've lost apt command meaning you can't install or remove anything using apt command.
The possible way to fix this is by reinstalling respective apt-package of your architecture and then do the below python installation.
To install apt-package again download the .deb file from the “/etc/apt/sources.list” file. Lots of links for installation and upgrades for packages will be in this file.
Now find the downloading source using $cat /etc/apt/sources.list command.
Find /pool/main/a/apt/ directory under downloading source and then download the .deb file which matches your architecture and download it.
Thereafter install this using dpkg command like this
sudo dpkg -i PackageName.deb
Replace the PackageName with your file name (e.g- apt_1.6.13_arm64/apt_1.9.3_i386).
Restart the PC and then check the /usr/bin/ directory to ensure if it had properly installed .
If you get nothing there then run locate apt-get command to locate it. If you can't get it then there is no other way than reinstalling the OS itself.
If you have reinstalled apt then
use the following commands to freshly install Python.
Note that all the commands below will be for Python3 as you're concerned with version 3.9.
# To uninstall the Python only
sudo apt-get remove python3.9
# To uninstall the Python with all the packages also
sudo apt-get remove --auto-remove python3.9
# To remove all the dependencies and configuration files
sudo apt-get purge --auto-remove python3.9
Now to install the Python3. The following command will install the latest version of python3. which to this date is python3.9.
sudo apt-get install python3
You can use pip to manage the python packages also.
To install pip use the following command
sudo apt install python3-pip
Now to manage the python packages using pip
# To install package; replace PackageName with the name of package(like flask)
sudo pip install PackageName
# To uninstall package
sudo pip uninstall PackageName
If you get trouble with pip get list of all the commands pip uses with
sudo pip help
You can list all the Python version installed (on default location)
ls /usr/bin/python*
Hope this will help in resolving the problem.

How do I install tkinter on RedHat?

I am trying to install tkinter on Redhat 7.7. I have tried every combination if "sudo yum install [whatever]" and every single time it comes up with "No package [whatever] available".
pip install tkinter
pip3 install tkinter
sudo yum install python3-tkinter
sudo yum install tkinter
sudo yum install python36-tkinter
sudo yum -y install python36u-tkinter
sudo yum -y install python36-tkinter
sudo yum install tkinter
sudo yum install python36-tkinter
sudo yum install python35-tkinter.x86_64
...etc
I have tried to find what repository I might need to enable but RedHat support is all behind a pay wall. What repository do I need to enable?
At this point I am actually considering just switching to Ubuntu as RedHat is giving me all sorts of problems.
EDIT: I tried yum search tkinter and got the following:
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
manager
Repo rhel-7-workstation-rpms forced skip_if_unavailable=True due to:
/etc/pki/entitlement/4690243650278863397-key.pem
====================== Matched:tkinter==========================
python3.x86_64 : Interpreter of the Python programming language
I already have python3 installed. I don't know if had I installed via sudo yum install python3.x86_64 vs sudo yum install python3 I would have got different results.
This works for me!
sudo yum search tkinter
sudo yum install python3-tkinter.x86_64
Alright, so I managed to fix this to my satisfaction. What I did is outlined here. First I installed ActiveState's ActiveTcl 8.5, then rebuilt python 3.6 manually by downloading the source using the following:
$: ./configure --with-tcltk-includes='-I/opt/ActiveTcl-8.5/include'
--with-tcltk-libs='/opt/ActiveTcl-8.5/lib/libtcl8.5.so /opt/ActiveTcl-
8.6/lib/libtk8.5.so'
$: make
$: make install
Because I had a couple different versions of Python 3.x, I had to add the following to the .bashrc:
export PYTHONPATH=/usr/local/lib/python36.zip:/usr/local/lib/python3.6:/usr/local/lib/python3.6/lib-dynload:/usr/local/lib/python3.6/site-packages:/usr/local/lib64/python3.6/site-packages
One big issue I ran into was first manually installing Python 3.8 (which came out yesterday) for which there seems to be little support for most packages so far, so be advised. I also had a few system-specific issues with pip.

Why can't I install python3.6-dev on Ubuntu16.04

I am trying to install Python 3.6-dev with this command:
sudo apt-get install python3.6-dev
but I'm getting this error:
E: Unable to locate package python3.6-dev
E: Couldn't find any package by glob 'python3.6-dev'
E: Couldn't find any package by regex 'python3.6-dev'
Can anyone help? Why am I getting this error and what is the correct way to install the package?
sudo add-apt-repository ppa:deadsnakes/ppa \
&& sudo apt update \
&& sudo apt install python3.6
Edit:
The following PPA has been disabled, see discussion here and the new PPA here . So use the PPA mentioned above instead.
Original answer:
As mentioned by omajid the package is not availible in 16.04. But if you need it in 16.04 you can get it by adding for example the personal package repository of Felix Krull:
sudo add-apt-repository ppa:fkrull/deadsnakes
This ppa worked like a charm on ubuntu 16.04. Posting here for others.
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
For those who tried to install python-3.6 and got same error as that one above. This can help you as well us it helped me fix out the pb.
Open terminal then run command to add the PPA:
sudo add-apt-repository ppa:jonathonf/python-3.6
Then check updates and install Python 3.6 via commands:
sudo apt-get update
sudo apt-get install python3.6
Now to make sure you had install successufly just run python3.6-v or python3.6
For more details check here "How to Install Python 3.6.1 in Ubuntu 16.04 LTS"
Note: Linux 16.04 use python v 2.7 as default one if u needa use
python 3.6 in your project just set python-3.6 as default version for
this project. It's better then use sudo update-alternatives ...
command then your terminal will vanish :(.
The package is too new. It's not available in the older 16.04 release. It's available in the newer Ubuntu 16.10.
This ppa:jonathonf did not work for me.
ppa:deadsnakes
is working fine for now.
What worked was:
Open a terminal
Execute the following commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
sudo add-apt-repository ppa:deadsnakes/ppa
Guess they changed the name of repo.

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

Unable to locate package virtualenv in ubuntu-13 on a virtual-machine

When i try to run the command:
sudo apt-get install virtualenv
The error I get in response is:
E: Unable to locate package virtualenv
The Ubuntu package is called python-virtualenv, not "virtualenv".
Try This :
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install virtualenv
It's also possible that you may not have run sudo apt-get update. It worked for me.
You need to add python before virtualenv because ubuntu package is
python-virtualenv not virtualenv.
sudo apt-get install python-virtualenv
you can install it with this instruction :
curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz
tar xvfz virtualenv-1.10.1.tar.gz
cd virtualenv-1.10.1
sudo python setup.py install
sudo apt-get update
sudo apt-get install virtualenv
Yess, if any one wants to have a look at ( installing virtualenv: a basis for the installation of ) django installation, please run this command when the shell opens up in Ubuntu:
sudo apt-get install python-setuptools
sudo apt-get install python-easy_install virtualenv
and then run the commands to simply start the instructions followed on the following link(starting from the section "Setting up a new environment"):
http://www.django-rest-framework.org/tutorial/1-serialization/

Categories