Python package always trying to install latest version of requirement - python

I'm developing an application based on django==1.7.x.
The problem I have is that the setup.py of one of my dependencies (let's call it foo) specifies Django>=1.3 as one of its requirements, but when such foo is being installed, it tries to install the latest version of django, which as of now is 1.8.3.
I thought that when specifying dependencies like package>=min_version in the setup.py file, pip would see that package is already installed, the installed version suffies the minimum required version and thus respect that installation of package.
Why is pip trying to install the latest version? and how can I force it to respect my current installed version?
Update: FYI, I'm using pip==7.1.0
Update: This only happens when installing manually, like pip install foo==X.Y. When the dependency is in a requirements file and is installed via pip install -r requirements.txt, installed versions of required packages are respected by pip.
Thanks!

Related

pip install --upgrade is installing my "local" version suffixed packages

During development I build and push feature branch versions of my package that look like: 1.2.3+mybranch.
So I'll have packages named 1.2.3, 1.2.3+mybranch and 1.2.4+mybranch, and 1.2.4.
The problem is it seems pip has no problem installing a package with a +suffix when doing a regular pip install --upgrade.
I don't want pip to do that.
Is there a way I can have only release versions installed with pip install --upgrade? I would think pip would do this by default.
I found the answer in a comment here: How to correctly create Python feature branch releases in development? (pip and PEP-440)
I just needed to include a proper pre-release version.
So 1.2.3+mybranch should be 1.2.3-dev0+mybranch. Now pip will ignore my feature branch versions by default because it knows they are pre-releases.

How to only pip install the latest tagged version when using setuptools_scm

I'm using setuptools_scm for version control for a python project.
I'm also using Python 3.10 and am on Windows 10.
My 2nd to last commit is tagged with "v0.1"
At this stage, I installed my package using the line below and got version 0.1 automatically installed:
python -m pip install git+url
My last commit was pushed after I installed my package, but I did not tag it.
However, when I tried to install my package in a different venv, version 0.2.dev1+[key] of my package got installed.
I'm aware that this versioning is the intended behavior of setuptools_scm, but I specifically want only the latest tagged version of my package to be installed when I run
python -m pip install git+url
In this case, I want v0.1 to be automatically installed, not version 0.2.dev1+[key], when installing it for the first time.
I would also like for my package to only be given the outdated status if a new tag is created and not when any commit is pushed. This would be applicable for
python -m pip list --outdated
python -m pip install --update
One obvious work around is
python -m pip install git+url#v0.1
However, this requires knowing what the latest tagged version is.
My question is this:
Is there a way to only be able to install tagged commits of my package instead of also the automatically generated ones from scm?

pip install: trying to install multiple version of same package from private pypi

I've a private pypi, and keep uploading new package framework to that registry.
I want to install the latest package in a virtualenv.
Command used:
pip install -i https://user:pass#registry framework
OUTPUT:
Collecting framework:
... downloads many versions
ERROR: Cannot install framework==0.25.13, framework==0.25.14 and framework==0.26.0 because these package versions have conflicting dependencies.
The conflict is caused by:
framework 0.26.0 depends on toolz<0.12.0 and >=0.11.1
framework 0.25.14 depends on toolz<0.12.0 and >=0.11.1
framework 0.25.13 depends on toolz<0.12.0 and >=0.11.1
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
I want only the latest version to be downloaded. I cannot hard-code version like framework==0.26.0 while pip install because this command is to be used in script and I may need to modify the script everytime a new framework get uploaded.
pip version: pip 21.1.2
The solution that worked for this problem was using --extra-index-url instead of -i
Command to use
pip install --extra-index-url https://user:pass#registry framework

Install packages using pip for updated versions of python

I recently updated from Python 3.5 to Python 3.6 and am trying to use packages that I had previously downloaded, but they are not working for the updated version of Python. When I try to use pip, I use the command "pip install selenium" and get the message "Requirement already satisfied: selenium in /Users/Jeff/anaconda/lib/python3.5/site-packages" How do I add packages to the new version of Python?
First, make sure that your packages do have compatibility with the version of Python you're looking to use.
Next, run pip freeze > requirements.txt in the base directory of your Python project. This puts everything in a readable file to re-install from. If you know of any packages that require a certain version that you'll want to re-install, put package==x.x.x (where package is the package name and x.x.x is the version number) in the list of packages to make sure it downloads the correct version.
Run pip uninstall -r requirements.txt -y to uninstall all packages. Afterwards, run pip install -r requirements.txt.
This allows you to keep packages at the correct version for the ones you assign a version number in requirements.txt, while upgrading all others.

Removing a python module from $pythonpath

Is there any way to 'uninstall' a module from the python path other than removing the files manually?
Pip, easy_install, setuptools etc all have install options, but no remove options!
I'm using Ubuntu 9.10
pip supports uninstall.
pip is able to uninstall most installed packages with
pip uninstall package-name
Known exceptions include pure-distutils packages installed with python setup.py install (such packages leave behind no metadata allowing determination of what files were installed), and script wrappers installed by develop-installs (python setup.py develop).
pip also performs an automatic uninstall of an old version of a package before upgrading to a newer version, so outdated files (and egg-info data) from conflicting versions aren’t left hanging around to cause trouble. The old version of the package is automatically restored if the new version fails to download or install.
See http://pip.openplans.org/

Categories