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.
Related
The albumentations package requires some version of opencv-python. From setup.py:
# If none of packages in first installed, install second package
CHOOSE_INSTALL_REQUIRES = [
(
("opencv-python>=4.1.1", "opencv-contrib-python>=4.1.1", "opencv-contrib-python-headless>=4.1.1"),
"opencv-python-headless>=4.1.1",
)
]
When I pip install, it seems to choose opencv-python-headless, which has a bug that prevents installation. (If you read the bug, it looks like I could install a different version of scikit-build, but that didn't seem to work.)
The workaround is to install a dev version of opencv-python, which I can with this line in requirements.txt:
git+https://github.com/opencv/opencv-python#5de8d66d454c8fd946ae17dcfcb285b16aa6049b
However, while installing albumentations, it decides to still install opencv-python-headless, presumably because the version number (installed from github) doesn't compare well.
How can I install albumentations and have it use my existing opencv-python install?
I installed pip-tools, and compiled the requirements for albumentation, and I've been messing with the file, but pip still follows dependencies for each package.
Can I use pip to install a package directly, without dependencies? Then I could do it one at a time, with the versions I want.
Hi I had a similar problem what have done is:
Install opencv-python using pip install opencv-python==4.5.5
Download albumentations from github
git checkout {albumentations_version} you want to install
Change in albumentations/setup.py opencv-python>=4.1.1 with opencv-python==4.5.5.64
Update pip. pip install pip --upgrade. My version is 22.1.2
pip install albumentations/
At the end i have albumentations 1.1.0 installed with opencv-python==4.5.5 and not the latest version of opencv.
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!
I know I can use
pip --ignore-installed --no-deps
to reinstall a pkg without dependencies; however, if a dependency is missing, it won't get installed anyway. How can I reinstall a pkg and only dependencies that are not installed, but ignore dependencies that have been already installed?
Just for people who stumble across this question later -- If I understand your question correctly, this functionality was added a while ago. I would have to look up when it made it into pip. The upgrade strategy 'only-if-needed' is the current default so that could be left out BUT, as a pythonista, explicit is better than implicit :)
pip install --upgrade --upgrade-strategy only-if-needed <package-name>
Essentially, what this is doing is upgrading the package and it will reinstall dependencies if needed. this will only install missing or outdated dependencies. It will not upgrade dependencies that already satisfy the package requirements even if there is a newer version that also satisfies the package requirments.
You can read more about this functionality in the pip documentation
I have one python package A which has depends on another private package named godot(hosted at bitbucket, and should be accessed by git+ssh protocol). In package A's setup.py, I have following code:
...
install_requires=['godot'],
dependency_links=['git+ssh://git#bitbucket.org/xxx/godot.git#egg=godot']
...
I have two questions here:
Now setuptools 1.4 (latest stable version) does not support 'git+ssh' protocol, only code in the development branch handle this protocol: Python setuptools: How can I list a private repository under install_requires?. I have installed the development version via:
pip install --upgrade --force-reinstall hg+https://bitbucket.org/pypa/setuptools#egg=setuptools
I almost solved this bit, but I wonder If any other approach available? Invoke pip install -r requirements.txt(have git+ssh://git#bitbucket.org/xxx/godot.git#egg=godot list in requirements.txt)?
The second question is name conflict. There is another package on pypi also named godot, So when I install package A using follow command, pip install the godot from pypi index:
pip install git+ssh://git#pypi.corp.com/xxx/A.git#egg=A
How could force pip(setup.py) to install the private godot package, rather than the one on pypi index?
For part 1: you can install packages via pip by specifying as:
$ pip install http://my.package.repo/SomePackage-1.0.4.zip
To keep it simple and avoid spending undue time on it, I would just download the .zip source file and install via pip as above.
See here...
For part 2: pip has a --no-dependencies switch. Add that after installing all the dependencies manually
Hi recently i installed setup tools module and google app engine gives me errors . Is there a way to uninstall setuptool? can any one tell me step by step because i tried hard
The answer depends on how it was installed.
If it was installed using the ubuntu (debian) package manager, try:
sudo apt-get remove --purge python-setuptools
[updated]
If you installed manually, probably the setuptools final location will be something like (adjust for your environment/python version):
/usr/local/lib/python2.6/dist-packages
Just delete the setuptools stuff there.
Lame, I know, but it is your burden for not using the excellent package manager provided by ubuntu: stick to dpkg unless you need bleeding edge stuff. For other python modules installed by setuptools, it provides no "uninstall" feature (but pip does, that is why there is a lot of enthusiasm around virtualenv, pip and yolk).
[2017 update]
It is 2017 and installing Python modules changed a bit:
pip is now the preferred installer program. Starting with Python 3.4, it is included by default with the Python binary installers.
venv is the standard tool for creating virtual environments (semi-isolated Python environments that allow packages to be installed for use by a particular application, rather than being installed system wide), and has been part of Python since Python 3.3. Starting with Python 3.4, it defaults to installing pip into all created virtual environments.
virtualenv is a third party alternative (and predecessor) to venv and if not official it is still very popular because it allows virtual environments to be used on versions of Python prior to 3.4, which either don’t provide venv at all, or aren’t able to automatically install pip into created environments.
easy_install pip
pip uninstall pip setuptools
(pip and setuptools both use the same package formats, but pip has uninstall support. kinda hilarious that installing something is the easiest way to uninstall.)
I was having trouble with the method below because my pip wasn't up to date.
easy_install pip
pip uninstall pip setuptools
After upgrading pip like this:
sudo -H pip install --upgrade pip
I was able to successfully uninstall setuptools like so:
pip uninstall setuptools