installing older version of python pip - python

I've got a brand new kubuntu 14.04.01 LTS. It has only python 2.7 supported. I need 2.6 for my work. I've found the deadsnakes repositories and I've been able to install python2.6. But now I can't find a way to install pip for python 2.6 - how can I do that?
Following #AvishBabu's answer, I downloaded the easy setuptools 2.6 egg, so I have easy_install-2.6, but it's installed inside my /usr/local/lib/python2.7/dist-packages... When I try to install pip for 2.6, I get:
$ sudo easy_install-2.6 pip
Searching for pip
Best match: pip 1.5.4
Adding pip 1.5.4 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin
Using /usr/lib/python2.7/dist-packages
Processing dependencies for pip
Finished processing dependencies for pip
which means, that only pip2.7 is taken into account.

You have to install setuptools for Python 2.6 (example :
setuptools-0.6c11-py2.6.egg). Then, you have easy_install-2.6.
You can do:
Use the command
easy_install-2.6 pip
For installing the mysql-python, use like pip-2.6 install mysql-python.
See reference.

Related

pip not showing correct version

I already had python3.8 installed and I installed python3.4 from its source code.
I wanted pip==19.1.1 as it is supported in python3.4. After installing pip when I tried changing its version but it was showing different version as you can see in the attached image.
Is there a way to use pip with version 19.1.1?
Thank you in advance.
remus#remus-VirtualBox:~$ python3.4 --version
Python 3.4.0
remus#remus-VirtualBox:~$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (20.0.2-5ubuntu1.6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
remus#remus-VirtualBox:~$ pip install pip==19.1.1
Collecting pip==19.1.1
Using cached pip-19.1.1-py2.py3-none-any.whl (1.4 MB)
Installing collected packages: pip
WARNING: The scripts pip, pip3 and pip3.8 are installed in '/home/remus/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-19.1.1
remus#remus-VirtualBox:~$ pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
Terminal Image showing error
OS: UBUNTU 20.04.4(Focal)
I strongly recommend to use something like venv or conda to create your environments. That would allow you the hassle of having to distinguish multiple python binaries on your machine.
That said, I think your issue can be resolved by explicitly using the right python version by launching pip like this:
python3.4 -m pip --version
For example, I have two different python versions installed (shame on me!) and this is the output I get:
generic#motorbrot:~$ python --version
Python 2.7.17
generic#motorbrot:~$ python -m pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
generic#motorbrot:~$ python3 --version
Python 3.6.9
generic#motorbrot:~$ python3 -m pip --version
pip 21.1.2 from /home/generic/.local/lib/python3.6/site-packages/pip (python 3.6)

How can I change pip version

I'm using python3.8.6 and I need to upgrade to 3.9.x. After upgrade the python, myproject.py cannot find a module that already installed using pip3 install opencv-python.
when run python3 myproject.py occurs error that ModuleNotFoundError tensorflow, and tensorflow should be 2.5.x so I'm trying to install python 3.9.x.
pip --version shows pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
How can I change that (python3.8) to (python3.9)?
sorry for my bad English..
python -m pip install –upgrade pip.
If you type pip list it will show you every package installed and should say something like WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via this command:
c:\users\x\python.exe -m pip install --upgrade pip

How to downgrade the installed version of 'pip' on windows?

On a windows 7 machine I have pip version 1.5.6 installed:
pip 1.5.6 from C:\Users\dietz\PNC\tas\ENV\lib\site-packages (python 2.7)
In order to find the reason for an error I want to install a different version of pip, which worked fine for me. So how can I uninstall pip and install version 1.2.1 instead?
pip itself is just a normal python package. Thus you can install pip with pip.
Of cource, you don't want to affect the system's pip, install it inside a virtualenv.
pip install pip==1.2.1
If downgrading from pip version 10 because of PyCharm manage.py or other python errors:
python -m pip install pip==9.0.1
If you want to upgrade or downgrade to different version of pip, better use --upgrade option at one go instead doing it in two steps. i.e. first uninstalling the existing and then re-installing to new version, below does both in one go as shown below.
USE: Executed on WIN10 with Bash
python -m pip install --upgrade pip==19.2.3
$ python -m pip install --upgrade pip==19.2.3
Collecting pip==19.2.3
Using cached pip-19.2.3-py2.py3-none-any.whl (1.4 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.3.1
Uninstalling pip-21.3.1:
Successfully uninstalled pip-21.3.1
Successfully installed pip-19.2.3
well the only thing that will work is
python -m pip install pip==
you can and should run it under IDE terminal (mine was pycharm)
If you have to downgrade pip version do following steps:
step1. pip uninstall pip
step2. pip install pip==version number you want to install or downgrade
step3. check version of pip using pip --version
This process also works when any other package giving error exit code(2) you can follow these steps and install your package.

Python 3: ImportError "No Module named Setuptools"

I'm having troubles with installing packages in Python 3.
I have always installed packages with setup.py install. But now, when I try to install the ansicolors package I get:
importerror "No Module named Setuptools"
I have no idea what to do because I didn't have setuptools installed in the past. Still, I was able to install many packages with setup.py install without setuptools. Why should I get setuptools now?
I can't even install setuptools because I have Python 3.3 and setuptools doesn't support Python 3.
Why doesn't my install command work anymore?
Your setup.py file needs setuptools. Some Python packages used to use distutils for distribution, but most now use setuptools, a more complete package. Here is a question about the differences between them.
To install setuptools on Debian:
sudo apt-get install python3-setuptools
For an older version of Python (Python 2.x):
sudo apt-get install python-setuptools
EDIT: Official setuptools dox page:
If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from
python.org, you will already have pip and setuptools, but will need to
upgrade to the latest version:
On Linux or OS X:
pip install -U pip setuptools
On Windows:
python -m pip install -U pip setuptools
Therefore the rest of this post related to Distribute is obsolete (e.g. some links don't work).
EDIT 2022-02-04
From Python 3.10 Distutils is deprecated and will be removed in Python 3.12 - use setuptools:
The entire distutils package is deprecated, to be removed in Python 3.12. Its functionality
for specifying package builds has already been completely replaced by
third-party packages setuptools and packaging ...
Distribute (deprecated)
Distribute - is a setuptools fork which "offers Python 3 support". Installation instructions for distribute(setuptools) + pip:
curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip
Similar issue here.
UPDATE: Distribute seems to be obsolete, i.e. merged into Setuptools: Distribute is a deprecated fork of the Setuptools project. Since the Setuptools 0.7 release, Setuptools and Distribute have merged and Distribute is no longer being maintained. All ongoing effort should reference the Setuptools project and the Setuptools documentation.
You may try with instructions found on setuptools pypi page (I haven't tested this, sorry :( ):
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
easy_install pip
Make sure you are running the latest version of pip
I tried to install Ansible and it failed with
ModuleNotFoundError: No module named 'setuptools_rust'
python3-setuptools was already in place, so upgrading pip solved it.
pip3 install -U pip
I was doing this inside a virtualenv on Oracle Linux 6.4 using Python 2.6, so the apt-based solutions weren't an option for me, nor were the Python 2.7 ideas. My fix was to upgrade my version of setuptools that had been installed by virtualenv:
pip install --upgrade setuptools
After that, I was able to install packages into the virtualenv.
The solution which worked for me was to upgrade my setuptools:
python3 -m pip install --upgrade pip setuptools wheel
For others with the same issue due to a different reason: This can also happen when there's a pyproject.toml in the same directory as the setup.py, even when setuptools is available.
Removing pyproject.toml fixed the issue for me.
pip uninstall setuptools
and then:
pip install setuptools
This works for me and fixes my issue.
When there's a pyproject.toml in the same directory as the setup.py, it can be the cause of the issue. I renamed that file, but it didn't solve the issue, so I restablished the original file name, and did the following change.
Under the [build-system] section, I added "setuptools" to the requires= list, and it worked.
First step #1
You have to install setuptools
On Linux:
pip install -U pip setuptools
On Mac OS:
pip install -U pip setuptools
On Windows:
python -m pip install -U pip setuptools
Second step #2
Make sure you have made it accessible (make it available in environmental variables)
On Linux
export PATH="INSTALLATIONDIRECTORY:$PATH"
On Mac OS
Sorry, I don't know.
On Windows
Open the Start Search, type in “env”, and choose “Edit the system environment variables”
Click the “Environment Variable” button.
Set the environment variables as needed. The New button adds an additional variable.
Dismiss all of the dialogs by choosing “OK”. Your changes are saved!
The distribute package provides a Python 3-compatible version of setuptools: http://pypi.python.org/pypi/distribute
Also, use pip to install the modules. It automatically finds dependencies and installs them for you.
It works just fine for me with your package:
[~] pip --version
pip 1.2.1 from /usr/lib/python3.3/site-packages (python 3.3)
[~] sudo pip install ansicolors
Downloading/unpacking ansicolors
Downloading ansicolors-1.0.2.tar.gz
Running setup.py egg_info for package ansicolors
Installing collected packages: ansicolors
Running setup.py install for ansicolors
Successfully installed ansicolors
Cleaning up...
[~]
this is how my problem was solved => pip3 install setuptools-rust
If you want to check your list => pip3 list
i faced this problem while trying to install elastalert2
System informations
CentOS Linux release 7.9.2009 (Core)
Python 3.6.8
pip 21.3.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
I ran into this problem when my pip requirements.txt file contained an editable library that was built using poetry and contained a pyproject.toml file. Following the documentation for setuptools, my solution was to add setuptools to the build-system requirements in the pyproject.toml file as follows:
[build-system]
requires = ["poetry-core>=1.0.0", "setuptools"]
build-backend = "poetry.core.masonry.api"
If pip isn't installed, like for example if it's coming from the Deadsnakes PPA, or a Docker environment, the best way to fix this error is by bootstrapping it by running
python -m ensurepip
Windows 7:
I have given a complete solution here for Python Selenium WebDriver:
Setup easy install (Windows - simplified)
download ez.setup.py (https://bootstrap.pypa.io/ez_setup.py) from 'https://pypi.python.org/pypi/setuptools'
move ez.setup.py to C:\Python27\
open cmd prompt
cd C:\Python27\
C:\Python27\python.exe ez.setup.py install
I ran sudo python setup.py build_ext -i and it failed with No module named setuptools.
I solved it with this command:
<i>sudo apt-get install python-setuptools</i>
A few years ago I inherited a Python (2.7.1) project running under Django-1.2.3 and now was asked to enhance it with QR possibilities. I got the same problem and did not find pip or apt-get either. So I solved it in a totally different, but easy way.
I /bin/vi-ed the setup.py and changed the line
"from setuptools import setup"
into:
"from distutils.core import setup"
The PyPA recommended tool for installing and managing Python packages is pip. pip is included with Python 3.4 (PEP 453), but for older versions here's how to install it (on Windows):
Download https://bootstrap.pypa.io/get-pip.py
>c:\Python33\python.exe get-pip.py
Downloading/unpacking pip
Downloading/unpacking setuptools
Installing collected packages: pip, setuptools
Successfully installed pip setuptools
Cleaning up...
>c:\Python33\Scripts\pip.exe install pymysql
Downloading/unpacking pymysql
Installing collected packages: pymysql
Successfully installed pymysql
Cleaning up...
On macOS, if you have homebrew installed, simply run:
brew install rust
If you still find this issue, try this:
python3 -m pip install scrapy --upgrade --force --user
While trying to install socketIO I had the same issue. At my system (Windows 11) setupTools were there twice. At C:\Program Files\Python310\Lib\site-packages\ and at C:\Users\user\AppData\Roaming\Python\Python310\site-packages\
Had to uninstall one of them.
Working on Debian, sometime it can be because of older pip version. Therefore, update pip>
python -m pip install -U pip
I had such a problem to install pyunicorn. I wanted to install it on Google Colab. I tried installing pyunicorn directly from Github and it worked for me. For example in my case it was like this:
pip install git+https://github.com/pik-copan/pyunicorn.git#egg=pyunicorn

easy_install gets wrong pip version

I have been following the instructions on http://docs.python-guide.org/en/latest/starting/install/osx/ but for some reason this is not going as I believe it would be expected.
I have python 2.7 running by default but had to get easy_install up-to-date by following the instructions on: https://superuser.com/questions/256717/easy-install-the-wrong-version-of-python-modules-mac-os and link it from /usr/local/bin/share to /usr/local/bin. It seems to be working fine.
The problem is that now when I install pip it seems to install to 2.6 and not 2.7.
darky:~ user$ easy_install --upgrade pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Reading http://www.pip-installer.org
Best match: pip 1.1
Processing pip-1.1-py2.6.egg
pip 1.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip-2.6 script to /usr/local/bin
Using /Library/Python/2.6/site-packages/pip-1.1-py2.6.egg
Processing dependencies for pip
Finished processing dependencies for pip
After the comments from MartijnPieters this problem NO LONGER persists
darky:~ user$ /usr/local/share/python/easy_install-2.7 pip
Searching for pip
Best match: pip 1.1
Processing pip-1.1-py2.7.egg
pip 1.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/share/python
Installing pip-2.7 script to /usr/local/share/python
Using /usr/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
darky:~ user$ pip install virtualenv --upgrade
Requirement already up-to-date: virtualenv in /Library/Python/2.6/site-packages
Cleaning up...
But pip still creates environments with python-2.6. So I have to point it to the proper pyhton interpreter.
darky:pytravisci pedrorodrigues$ virtualenv --python=/usr/local/bin/python2.7 ENV
Running virtualenv with interpreter /usr/local/bin/python2.7
New python executable in ENV/bin/python
Installing setuptools............................done.
Installing pip...............done.
You can use
easy_install-2.7
or if you don't have that alias:
python2.7 -m easy_install <stuff>
For pip:
pip2.7

Categories

Resources