Not able to install package because pip is not installed - python

I am running Ubuntu and have both python 2.7 and python 3.5 on my system
I have tweaked the settings so that when I do
python test.py
python3 runs
I wanted to install the module pyperclip in python3..
pip install pyperclip
installed it for python 2
Quick google search suggested to use
pip3 install pyperclip
but I get
pip3 is currently not installed . You can install it by typing
sudo apt install python3-pip
When I run this command I get the following:
The following packages have unmet dependencies:
python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1- 2ubuntu0.2 is to be installed
Recommends: python3-dev (>= 3.2) but it is not going to be installed
Recommends: python3-setuptools but it is not going to be installed
Recommends: python3-wheel but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
What should I do?

It seems like it could be an error in your path. If you installed Python 3.5 it should come with pip, so try doing python -m pip and this should run Python 3.5's pip. To install something, simply use the normal pip commands as you have, for example python -m pip install pyperclip.

Use the aptitude package manager as it will provide you simple suggestion to fix your unmet dependencies problem. Install it via apt:
sudo apt-get install aptitude
Then install pip3 with this command:
sudo aptitude install python3-pip
Then choose the solution suggested to you by aptitude. In one of the suggestions aptitude will suggest you to downgrade from 8.1.1-2ubuntu0.2 to 8.1.1-2. Accepting this suggestion solves the issue. Just make sure the downgrade doesn't cause you other hurdles.

Related

Can't install pip with get-pip, zipimport.ZipImportError: can't decompress data; zlib not available

I'm trying to install fastapi on my ubuntu machine (20.04)
This PC has Python 2, Python3 (pointing to Python3.8) and Python3.9 installed.
If I try a pip3 install, it installs under Python3.8
I've seen a trick, using python3.9 -m pip3 ... but Python3.9 doesn't have the module pip or pip3.
I tried to install this using the get-pip.py trick, but it says there is no zlib.
I then tried to install that using a few methods, the sudo apt-get zlib1g-dev method (which installs but doesn't fix the iussue) as well as one where you download zlib and ./configure and make it, which also appears to work but doesn't.
A lot of solutions suggest using yum, but there's no yum package - sudo apt-get install yum doesn't work, and it's not on the ubuntu package manager site.
I tried many things, but nothing worked so far.
Either I need to get zlib to work, or I need to get the existing pip packaged to point to 3.9
I suppose I could just use venvs (which is installed for 3.9, somehow, even though pip isn't! ) or I could just use 3.8 instead, but these are both workarounds.
What do, Stack Overflow?
You should manually get the get-pip.py script.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py
(Found this on How to install pip for Python 3.9 on Ubuntu 20.04)
EDIT: venv is also installed with apt install python3-venv so it already could be without pip

Problem with pip, cant install modules from cmd

I just get a syntax error. I've tried these commands:
pip install opencv-python
pip3 install opencv-python
python -m pip install opencv-python
All of these just give me a syntax error.
Trying to install opencv for some webcams, going to be messing with raspberry later.
If you are on Windows you have just to type py -m pip install opencv-python.
If you are on a Linux distribution you should firstly install python-pip or python3-pip (via your package manager) and then type:
pip (or pip3) install opencv-python (if you want to install it locally).
sudo pip (or pip3) install opencv-python (if you want to install it globally).
You can find more information here.

Installing pip on ubuntu 16.04

I was installing pip for python3. I used the following command for that:
sudo apt-get install python3-pip
But after installation it still says pip is not installed.
I have python 3.5.2 installed.
The python3-pip package installs pip for Python 3, which is named pip3. Plain pip is pip for Python 2, which is installed by the python-pip package.
The best way to install it, is by :
wget https://bootstrap.pypa.io/get-pip.py
cd ~/Downloads/ (if your version is english, in french you find it Téléchargements)
Then once you downloaded it, try :
sudo python3 get-pip.py
easy_install -U pip : this solved my problem on ubuntu 16.04

ImportError: The 'enchant' C library was not found. Please install it via your OS package manager, or use a pre-built binary wheel from PyPI

The question is why I see the error message in the title when trying to import enchant. I am using Win64.
On Ubuntu, run sudo apt-get install libenchant1c2a
I found the answer in this GitHub page.
In a nutshell, they have not shipped a wheel for the win_amd64 platform yet.
Resolved: On Win7-64 I ran
pip3 install pyenchant==1.6.6
which seems to be the latest version of PyEnchant that still shipped with Win-64 binaries. Newer versions did not install for me, but this one did.
For amazon ubuntu instance use.
yum install enchant
and then
pip install pyenchant
For me, the problem I ran into was that I had an old version of pip. I installed the latest version and was able to download the pyenchant library.
pip install -U pip
On Windows x64 I've solved this problem as follows:
Click link https://pypi.org/project/pyenchant/#files and download pyenchant-2.0.0.win32.exe
Launch it and while installing it using the installation wizard you must specify your python interpreter location which in my case is:
C:\Users\Asus\AppData\Local\Programs\Python\Python36\python.exe
Important:İf you use python32 interpreter you must specify this location:
C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\python.exe
if you use python 3.5 interpreter version your location may be like this:
C:\Users\Asus\AppData\Local\Programs\Python\Python35\python.exe
and finish the installation. Pip commands will work now for other dependency packages.
On MacOS, you can install it via brew:
brew install enchant
pip install pyenchant
To run with docker on AWS:
With apt-get:
sudo apt-get update
sudo apt-get -y install enchant-2
With apt:
sudo apt update
sudo apt -y install enchant-2
Thank you
I have fix the bugs on the colab.
!apt update
!apt install enchant --fix-missing
After fixing the missing files, you could run the enchant.

How to install Django in Ubuntu 11.10

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

Categories

Resources