Can't install old versions with pip anymore - python

I'n using pip 1.5.1 which worked fine up until today.
Now, I'm trying to install a requirements.txt in a fresh virtualenv, and for many packages it can no longer find specific old version for most packages.
$ pip install django-endless-pagination==1.1
Downloading/unpacking django-endless-pagination==1.1
Could not find a version that satisfies the requirement django-endless-pagination==1.1 (from versions: 2.0)
Some externally hosted files were ignored (use --allow-external to allow).
Cleaning up...
No distributions matching the version for django-endless-pagination==1.1
What do I need to do to get this to work again? Upgrading my app to use all the latest versions of all its packages is out of the question.
Update:
This works fine in pip 1.4.1. It's the newer version of pip that's causing it to fail.

From PIP 1.5 changelog:
BACKWARD INCOMPATIBLE
pip no longer will scrape insecure external urls by default nor will it install externally hosted files by
default. Users may opt into installing externally hosted or insecure
files or urls using --allow-external PROJECT and --allow-unverified
PROJECT
So in this case following ought to work the same way as old PIP:
pip install django-endless-pagination==1.1 \
--allow-all-external --allow-unverified django-endless-pagination
(There is no --allow-all-unverified, each unverified project name must be specified)
In case of using requirements.txt, it should be specified like this:
--allow-external django-endless-pagination
--allow-unverified django-endless-pagination
django-endless-pagination==1.1

In this case, you can use the URL of the appropriate zip file as input to pip install::
pip install https://github.com/frankban/django-endless-pagination/archive/v1.1.zip
Of course, not every package will have such a URL available, but most do.
I've occasionally used this to install the latest-greatest master, since in some cases the cheeseshop didn't have Python 3 ready packages yet.

Because the version on PyPI is 2.0 and pip now tries to honor the fact that maintainer wants you to use given version.

Related

Python3 Magic for a Django project

I need the python-magic package for a Django project. However, I found out that since I am using python3, I need the python3-magic package, which I can either get using pip3 or using apt-get.
I am a macOS user, so I don't have an apt-get, and I cannot install the package using pip3. It gives me the following error when I type: pip3 install python3-magic.
ERROR: Could not find a version that satisfies the requirement python3-magic (from versions: none)
ERROR: No matching distribution found for python3-magic
Is there any way I can get this package for my Django project? No matter what I do, the package appears uninstalled on my VS Code.
If you install this through pip3, the name of the package is python-magicĀ [PyPi], not python3-magic, so:
pip3 install python-magic
If you use apt-get, you can work with python3-magic and python-magic. These are not links to a Python package, but in essence intallations scripts that will work with pip3 and pip respectively. See for example the files of the python3-magic packageĀ [ubuntu-packages].

Cant pip install from freeze

I have just installed a bunch of packages to use MySQL on python, but I'm not sure which one did the trick (whichever it was, only worked after a reboot).
Now I'm trying to use it on a virtualenv, so I created a requirements.txt with pip freeze on my local machine, then, I created a virtualenv and tried pip install -r requirements.txt. However, can't install any of the packages, and the error is:
Could not find a version that satisfies the requirement mysql-connector-python<=2.0.4 (from -r myvi/requirements.txt (line 1)) (from versions: )
No matching distribution found for mysql-connector-python<=2.0.4 (from -r myvi/requirements.txt (line 1))
Tried editing the file manually, but whatever the first line is, always report the same error.
Googling the subject, I've only found solutions that are particular to the packages, but I get errors for regardless of the package. Why is this happening?
EDIT: I thought that all the packages were raising error, but only some of them are. Namely:
adium-theme-ubuntu==0.3.4
mysql-connector-python==2.0.4
Pyste==0.9.10
unity-lens-photos==1.0
I thought that if it was built by pip freeze , it would be possible to pip install it.
I don't know how you installed mysql-connector-python before, but its PyPI page doesn't list any downloadable files for any of its versions, so you can't install it with pip (at least, not with a plain pip install mysql-connector-python==2.0.4 or the like). Try just deleting the mysql-connector-python line from your requirements.txt file.
The other packages you've mentioned (adium-theme-ubuntu, Pyste, and unity-lens-photos) don't even exist on PyPI, so pip install definitely won't work for them.

Python pip install mysql-connector-python 2.0.1 fails

In developing a Django application, I used the following command to install MySQL (python3):
(Venv)$ pip3 install mysql-connector-python --allow-external mysql-connector-python
The installation was sucessful, and pip3 freeze > requirements.txt shows that mysql-connector-python==2.0.1 was installed.
However, in the production environment, pip3 install -r requirements.txt produced the following error message.
Downloading/unpacking mysql-connector-python==2.0.1 (from -r requirements.txt (line 6))
Could not find any downloads that satisfy the requirement mysql-connector-python==2.0.1 (from -r requirements.txt (line 6))
Is this a bug?
There is an outstanding bug with the way it is packaged on PIP.
here are the details: http://bugs.mysql.com/bug.php?id=76063
You can use following commands to install mysql-connector as mentioned on same link :
wget https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.3.zip
unzip mysql-connector-python-2.0.3.zip
cd mysql-connector-python-2.0.3
python setup.py install
pip can not install mysql-python-connector due to an error on the part of its package maintainers. Here is the relevant issue filed against that package's bug tracker. Although technically it should be installable with
pip install --allow-external mysql-connector-python --allow-unverified mysql-connector-python mysql-connector-python
this does not work if the package maintainers fail to correctly register the external URLs to PyPI.
Note that PyMySQL appears to be a complete drop-in replacement, as a pure-Python MySQL driver that implements the Python DB API 2.0 specification. Additionally, PyMySQL appears to be actively maintained, uploaded to PyPI (as opposed to hosted on external URLs), and is under the more generous MIT license (as opposed to the GPLv2 license).
Try this if you do not want to install manually:
sudo pip3 install --extra-index-url https://pypi.python.org/pypi/mysql-connector-python/2.0.4 mysql-connector-python
Works for me on Debian Jessie.

"pip install line_profiler" fails

I type
sudo pip install "line_profiler"
and I get
Downloading/unpacking line-profiler
Could not find a version that satisfies the requirement line-profiler (from versions: 1.0b1, 1.0b2, 1.0b3)
Cleaning up...
No distributions matching the version for line-profiler
Storing debug log for failure in /home/milia/.pip/pip.log
When I search for line_profile using
sudo pip search "line_profiler"
I get:
django-debug-toolbar-line-profiler - A panel for django-debug-toolbar that integrates
information from line_profiler
line_profiler - Line-by-line profiler.
tracerbullet - A line-by-line profiler that doesn't suck.
Somehow the underscore gets turned to "-". How can I bypass that?
The problem is not in the fact that pip converts _ into the - to meet the package naming requirements, but the thing is: the package is in beta state, there is no stable package versions. In other words, there are only beta package version links available on the package PyPI page. As you see, pip sees it:
Could not find a version that satisfies the requirement line-profiler (from versions: 1.0b1, 1.0b2, 1.0b3)
According to the Pre-release Versions documentation page:
Starting with v1.4, pip will only install stable versions as specified
by PEP426 by default. If a version cannot be parsed as a compliant
PEP426 version then it is assumed to be a pre-release.
Pass --pre argument to the pip install:
--pre
Include pre-release and development versions. By default, pip only finds stable versions.
sudo pip install --pre line_profiler
Or, install a specific version:
sudo pip install line_profiler==1.0b3
I installed miniconda and run these:
$ conda install -c anaconda line_profiler

pip could not install asyncmongo

I'm very new in Python and need to install asyncmongo package for my environment. But when I
excuting pip install asyncmongo it fails with the following error.
C:\git\project>pip install asyncmongo
Downloading/unpacking asyncmongo
Could not find any downloads that satisfy the requirement asyncmongo
Some externally hosted files were ignored (use --allow-external asyncmongo to allow).
Cleaning up...
No distributions at all found for asyncmongo
Storing debug log for failure in C:\Users\Name\pip\pip.log
What I'm doing wrong?
I had the same issue just now (guessing that the library you're trying to install doesn't have a distribution up on the repository which pip is using). Instead, install the easy_install utility and do:
easy_install asyncmongo
Also, as a side note, I'd recommend using virtualenv and virtualenvwrapper which comes with pip/easy_install.
They segregate your python installs and it is basically like using a python install for every project you work on instead of sharing it globally. It includes both pip and easy_install which is useful because when I can't find something with pip or if the pip install fails, I'm usually able to find it with easy_install.
I found the solution. The problem was caused because of asyncmongo 1.2.2 sources was hasted on the amazon file server, so in that case pip should be invoked with additional flags (--allow-external packagename and --allow-unverified packagename) so to install it properly follwing command should be executed:
pip install --allow-external asyncmongo --allow-unverified asyncmongo asyncmongo
You are on Windows platform and pip is not as great for Windows as for Linux or Mac. easy_install has some some advantages on Windows, such as installing a precompiled .exe binary.
On a different note, you may consider using motor instead of asyncmongo. It is newer and looks more elegant.

Categories

Resources