Pip won't let me upgrade to the latest version of package - python

How can I upgrade to 0.1.20 of ax-platform?
0.1.20 was released yesterday and appears on pypi
I have 0.1.19 and wish to upgrade to 0.1.20
If I run:
pip install --upgrade ax-platform
I just get:
Requirement already satisfied: ax-platform... (0.1.9)
If I uninstall and then install again with the above command or with pip install --upgrade –-no-cache-dir ax-platform “–no-cache-dir” I just get 0.1.19.
pip version 21.0.1
EDIT:
reason is one of the dependencies doesn't support python 3.6

First, try specifying version on command line pip install --upgrade ax-platform==0.1.20. If it doesn't work it means that PIP thinks that this package is not available for your system (combination of Python version, OS version, CPU version, etc).
Second, you may try installing manually, go to this page. There download .whl file. And install it by pip install --upgrade ax_platform-0.1.20-py3-none-any.whl. If for some reason you don't see .whl file download link, here it is.
Also for any PIP package if you want to get .whl file manually, go to pypi project's page (e.g. this), there on upper left of the page (navigation pane) go to "Release History", choose (click) version that you want, then on same navigation pane go to "Download files". There you'll see .whl files download link. You have to choose .whl file that suits your Python/OS/CPU version.
Also if PIP fails for any reason then try adding option --verbose to pip command line, it should help you to see real full reason or explanation of your failure. For example for ax-platform package it shows several debug screens of installing process and shows a message Acceptable python versions are:>=3.7, and you have Python 3.6, so it is definitely a reason of failure. Basically --verbose will help you debug real reason of failure of any pip command.
As it appeared to be that you have Python 3.6 and ax-platform needs Python >= 3.7. So only way to have the newest version of your package is to reinstall Python to 3.7 or newer or to use virtual environments with different versions of Pythons.

Related

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?

How to download matplotlib for python 3.7 in windows 8?

How do you download matplotlib to windows so I can use it with python?
Every other question related to this that I've found on StackOverflow has led to the same problem which is that it keeps giving me the error:
python setup.py egg_info failed with error code 1 in C:\Users\Myname\AppData\Local\Temp\pip-install-9gc765gs\matplotlib\
Things I have tried (from the command prompt):
pip install matplotlib
pip install matplotlib-1.5.0-cp35-none-win_amd64.whl (which is the file I downloaded from SourceForge and is now stored in my computer)
pip install "matplotlib-1.5.0-cp35-none-win_amd64.whl"
python -mpip install -U matplotlib
I even tried tried:
pip install --upgrade setuptools
python -mpip install -U pip
prior to using the other commands to make sure everything was up to date.
Any help would be very appreciated.
Matplotlib has not been officially released for Python 3.7 yet.
As of this writing, a 3.7 version for Mac and Linux has been uploaded to PyPI earlier today, which means the Windows versions are probably coming very soon. pip will probably work after that.
Similarly, no 3.7 compatible versions have been put onto conda-forge or integrated into the main conda repo yet. I'm sure those will be coming in the next couple of weeks.
Until then, maybe installing from source will work?

Downgrading python package installed locally

In the server that work in (as do many other people) the "global" python has a certain version of a package, say 1.0.0.
I recently used pip to upgrade that to 1.0.2 locally for my user with the pip install --user package==1.0.2, which worked. However, now I want to uninstall my locally installed version and remain with the global one.
I've tried pip uninstall --user package==1.0.2, pip uninstall --user package, and a few other options but nothing seems to work. I always get this error:
Usage:
pip <command> [options]
no such option: --user
I also tried pip install --user package=1.0.0 but now I have both versions installed locally and python uses the most recent.
How can I do what I want?
Apparently this cannot be done with pip directly. I ended up solving it just by removing the package from ~/.local/lib/python3.5/site-packages/. A bit more manual than I was hoping I'd have to do.
The --user option for pip seems to have been removed but is still an option with setuptools.
So if you want to use the --user function what you can do is use pip download which will download the .whl file. You then need to extract the file using wheel unpack. I then ran python setup.py install --user (worked for numpy) and it installed the package to my home directory under .local.
I followed the documentation here.

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.

pip refuses to upgrade

I currently have installed pip 8.1.2.
So I want to upgrade it to the latest version (9.0.1) and I execute:
sudo pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 846kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
It seems that it correctly downloads 9.0.1 but then it refuses to uninstall the existing installation (8.1.2)
And then at the end it suggests me to upgrade using the same exact instruction I already provided!
Am I doing anything wrong?
The Ubuntu pip version has been patched to prevent self-upgrades (all installation into system-managed files are prevented, the patch is named hands-off-system-packages.patch). You are supposed to use the Ubuntu packaging system to upgrade instead. The feedback provided could be improved certainly.
As there is no Ubunutu package of pip 9.0.1 available yet for your Ubuntu version, you can't actually upgrade to a newer version this way (there is a version for Zesty however).
A (ugly) work-around is to use easy_install instead:
sudo easy_install -U pip
This works because easy_install has not been booby-trapped to prevent the upgrade. However, this'll replace system managed files with the newer pip version. If your package manager were to re-install the python-pip package, it'll happily overwrite those files and you could in theory end up with a broken installation. Also, easy_install adds more files than the package would, and those extra files could cause issues later down the line, especially when you upgrade python-pip later when a new version is packaged.
If you were to use a virtualenv, you are free to upgrade pip inside that, which works just fine.
If above are not working, please try this it works(I had similar situations and this works):
download get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Run the downloaded file: python get-pip.py
Above uninstalls the old version and install the latest ones.
Reference Link: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
Had a similar issue with pip not wishing to upgrade, though I'm not keen on replacing the package manager's version and as I'm always adding the --user option on installations via pip I figured "what's the harm?" in doing the same with pip on itself.
pip install --user --upgrade pip
It'll only work for one user but for some use cases that is just peachy.

Categories