pip{version} install --upgrade pip - python-2.7

I have multiple versions of pip and python on my CentOS. When I type pip2.7 install --upgrade pip it becomes clear that pip2.7 is trying to upgrade a different version of pip as the path to the pip it is trying to upgrade is not the same as the path yielded by which pip2.7
How do I make pip upgrade the proper pip and not the 2.6 pip?

I resolved this by upgrading pip, making my 2.6 pip utilize python 2.7 instead. For whatever reason, both pip and pip2.7 were upgraded. Then I reinstalled pip using yum package manager so it is now 2.6

Related

can't upgrade pip to 9.0.1 ubuntu 16.04

I tried the following command so many times without luck:
sudo -H pip install -U pip
Here is the output:
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.1
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
My pip is still at version 8.1.1
pip --version
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
What is going on? Why the upgrade option didn't work?
pip install installs everything into /usr/local/lib/python2.7/dist-packages/.
Your new pip is now /usr/local/bin/pip. Add /usr/local/bin before /usr/bin in your PATH and verify that the new pip is being run with pip --version.
Upd. We finally found the culprit of the problem — /usr/lib/python2.7/dist-packages/easy-install.pth contains wrong line /usr/lib/python2.7/dist-packages. Remove it.

cannot find easy_install after updating setuptools

On a AWS machine, I updated pip to version 9.0.1 with
sudo -H pip install --upgrade pip
and then updated setuptools from 12.2 to 36.2.2 doing :
pip install -U setuptools
But now I can't use easy_install anymore, it says
-bash: /usr/bin/easy_install: No such file or directory
I saw that there is only easy_install-3.4 in /usr/bin, how can I retrieve easy_install?
My problem is that I wanted to create a .egg file and apparently with the old version of setuptools it was not created correctly so when I was installing it via easy_install I couldn't import the package in Python ('no module named xxx').
I am using Python 2.7
Thanks

pip command by default using python 3...how to change it to python 2?

I am using macOS Sierra 10.12 and after I upgraded my OS I can no longer install packages for python 3 using pip. Before I used to use pip for python2 and pip3 for python 3 as I have both versions of Python. But now I can no longer use pip to install libraries for python2.
Can anyone help me how can I change my default pip installer to python2? So that I can just use pip install in order to install for python 2.
For your information - when I only type python on terminal it says my default is python 2.7.
on running
which pip
I got /usr/local/bin/pip
Which meant it was pointing to pip2
To change default pip to pip3, run
sudo ln -s /usr/local/bin/pip3 /usr/local/bin/pip
install pip for Python2.7 with easy_install:
sudo easy_install-2.7 pip
now you can use pip for the same specific version of Python:
sudo pip2.7 install BeautifulSoup

pip not upgrading packages, installs older versions

I am trying to upgrade certain packages installed at the global(root) level at my user level. Whenever i try to upgrade the package with pip, it simply re-installs the already existing version at the user level.
For example,
$pip install boto --user --upgrade
Collecting boto
Using cached boto-2.42.0-py2.py3-none-any.whl
Installing collected packages: boto
Successfully installed boto-2.9.5
pip downloads boto-2.42 but installs 2.9.5.
I am not sure why this is happening. Any help would be appreciated?
I am using pip 8.1.2
reply to #Evert
The output from pip for pip install boto --user --ignore-installed is
Collecting boto
Using cached boto-2.42.0-py2.py3-none-any.whl
Installing collected packages: boto
Successfully installed boto-2.9.5
Note, pip collects the most recent package but falls back to the old package when installing. I cant seem to understand why this happens. The above works correctly in my other machines but not this. I even tried re-installing pip but it wont work
pip install boto --user --ignore-installed
Try to force a reinstall of the desired package:
pip install --user -U --force-reinstall boto

Installing MySQL-python for Django

I've just learned how to use virtualenv and I installed Django 1.4.5. I'm assuming that the virtualenv created a clean slate for me to work on so with the Django 1.4.5 installed, I copied all my previous files into the virtualenv environment.
I tried to run the server but I get an error saying "no module named MySQLdb". I think this means that I forgot to install MySQL-python. I tried to install it via
pip install MySQL-python
But I get this error
Downloading/unpacking MySQL-python
Running setup.py egg_info for package MySQL-python
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24 (/home/bradford/Development/Django/django_1.4.5/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg))
Complete output from command python setup.py egg_info:
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24 (/home/bradford/Development/Django/django_1.4.5/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg))
----------------------------------------
Command python setup.py egg_info failed with error code 2 in /home/bradford/Development/Django/django_1.4.5/build/MySQL-python
Not quite sure how to go about fixing this problem =/ any help much appreciated!
I recently had exactly this issue (just not in relation to Django). In my case I am developing on Ubuntu 12.04 using the default pip and distribute versions, which are basically a little out of date for MySQL-python.
Because you are working in an isolated virtualenv, you can safely follow the suggested instruction without affecting your Python installation.
So you can...
workon your_virtualenv #activate your virtualenv, you do use virtualenvwrapper, right?
easy_install -U distribute #update distribute on your virtualenv
pip install MySQL-python #install your package
If for some reason upgrading distribute is not an option, you could try installing an older version of MySQL-python as follows (you'd have to check this version is compatible with your version of Django):
pip install MySQL-python==x.y.z #where x.y.z is the version you want
Spent an hour looking through stackoverflow. Evntually found answer in the other question. This is what saved me:
sudo apt-get install libmysqlclient-dev
mysql_config goes with the package.
When doing in a virtualenv :
pip install MySQL-python
I got
EnvironmentError: mysql_config not found
To install mysql_config, as Artem Fedosov said, first install
sudo apt-get install libmysqlclient-dev
then everything works fine in virtualenv
MySQL driver for Python (mysql-python) needs libmysqlclient-dev. You can get it with:
sudo apt-get update
sudo apt-get install libmysqlclient-dev
If python-dev is not installed, you may have to install it too:
sudo apt-get install python-dev
Now you can install MySQL driver:
pip install mysql-python
Here is a more detailed documentation for MySQL in Django:
http://codex.themedelta.com/how-to-install-django-with-mysql-in-a-virtualenv-on-linux/
I had to do this:
pip install mysql-python
inside the virtualenv
The commands are always run in ubuntu:
easy_install -U distribute
later
sudo apt-get install libmysqlclient-dev
and finally
pip install MySQL-python
The suggested solutions didn't work out for me, because I still got compilation errors after running
`$ sudo apt-get install libmysqlclient-dev`
so I had to run
apt-get install python-dev
Then everything worked fine for me with
apt-get install python-dev
Try this:
Version Python 2.7
MySQL-python package, you should use either MySQL_python‑1.2.5‑cp27‑none‑win32.whl or
MySQL_python‑1.2.5‑cp27‑none‑win_amd64.whl depending on whether you have installed 32-bit or 64-bit Python.
pip install MySQL_python‑1.2.5‑cp27‑none‑win32.whl
if you are using mysqlclient package, then use
mysqlclient‑1.4.6‑cp27‑cp27m‑win32.whl or
mysqlclient‑1.4.6‑cp27‑cp27m‑win_amd64.whl
pip install mysqlclient‑1.4.6‑cp27‑cp27m‑win32.whl
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient