Giter Club home page Giter Club logo

pip-upgrade's Introduction

pip-upgrade ๐ŸŽ‰

The purpose of pip-upgrade is to be a simple yet robust and reliable tool for upgrading all of your packages while not breaking dependencies.

Installation

pip install pip-upgrade-tool

or

pip install git+https://github.com/realiti4/pip-upgrade.git@master --upgrade

Usage

Just run pip-upgrade in your terminal while virtualenv is active.

$ pip-upgrade
Checking outdated packages...
These packages will be upgraded: ['colorama', 'isort']
Continue? (y/n): y
...
All packages are up to date! ๐ŸŽ‰

Tip: You can use -e to exclude some packages and continue in Continue? (y/n): after seeing which packages are going to be upgraded. This is super useful for packages like gohlke's Numpy+mkl for example. -r to repeat the previous excluded packages. It'll show if there is a saved repeatable action.

These packages will be upgraded: ['hypothesis', 'Pillow', 'pytest', 'setuptools']
(-r, --repeat  :  -e pytest)
Continue? (y/n or -e/-r/--help): -e pytest hypothesis

You can also exclude packages beforehand. Use -e or --exclude. The tool won't upgrade dependency breaking packages already, this is extra for packages that you want to keep it at a version. You can also add packages to config file for this to persist until you remove. This combined with pip-upgrade -y that accepts and skips user prompt can be used for automated environments.

$ pip-upgrade -e numpy pandas

Options

  • pip-upgrade -e Exclude packages you don't want to upgrade. Can take multiple or single value.
  • pip-upgrade -y Accept all upgrades and skip user prompt.
  • pip-upgrade --clean Clear pip's cache.
  • pip-upgrade --local By default locally installed editable packages (installed with pip install -e .) won't be upgraded. Use this option to upgrade everything.
  • pip-upgrade --novenv By default the tool won't work if virtualenv is not active. Use this if you want use it globally and pass the assertion error.
  • pip-upgrade --reset-config Reset config file located in ~/.pipupgrade.ini to it's default.

Permanent Configuration

When pip-upgrade is run for the first time, it will create a file in the user's home directory named .pipupgrade.ini. This file can be manually edited by the user for permanent configuration options. The configuration file current consists of two options under the conf section, exclude and novenv. novenv is false by default, but if set to true, the pip-upgrade command will not require you to be in a virtualenv, which is the same function as the --novenv argument. The second option, exclude, will take the same values as the --exclude argument, but these excluded packages will persist forever until removed.

Contributing

Any contribution is appreciated, please feel free to send pull requests.

pip-upgrade's People

Contributors

realiti4 avatar tabulatejarl8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pip-upgrade's Issues

pycairo does not upgrade

Hi devs,
I'm experienced troubles with pycairo update. The error message is as follows:
...
Updating 1 of 15 packages: pycairo
bpyutils | 2023-07-13 17:32:50,731 | INFO | Executing command: /usr/local/bin/pip install pycairo --no-cache-dir --upgrade
Requirement already satisfied: pycairo in /usr/lib/python3/dist-packages (1.16.2)
Collecting pycairo
Downloading pycairo-1.24.0.tar.gz (344 kB)
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 344.9/344.9 kB 5.3 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pycairo
Building wheel for pycairo (pyproject.toml) ... error
error: subprocess-exited-with-error

ร— Building wheel for pycairo (pyproject.toml) did not run successfully.
โ”‚ exit code: 1
โ•ฐโ”€> [15 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/cairo
copying cairo/init.py -> build/lib.linux-x86_64-cpython-39/cairo
copying cairo/init.pyi -> build/lib.linux-x86_64-cpython-39/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-cpython-39/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycairo
Failed to build pycairo
ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects

Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/pipupgrade/commands/init.py", line 79, in command
return _command(**ARGUMENTS)
File "/usr/local/lib/python3.9/dist-packages/pipupgrade/commands/init.py", line 258, in _command
update_registry(registry, yes = a.yes, user = a.user, check = a.check,
File "/usr/local/lib/python3.9/dist-packages/pipupgrade/commands/helper.py", line 301, in update_registry
_pip.call("install", package.name,
File "/usr/local/lib/python3.9/dist-packages/pipupgrade/_pip.py", line 79, in call
output = popen(*params, output = output, raise_err = raise_err)
File "/usr/local/lib/python3.9/dist-packages/bpyutils/util/system.py", line 126, in popen
raise PopenError(code, command)
bpyutils.exception.PopenError: Command '/usr/local/bin/pip install pycairo --no-cache-dir --upgrade' returned non-zero exit status 1.

An error occured while performing the above command. This could be an issue with
"pipupgrade". Kindly post an issue at https://github.com/achillesrasquinha/pipupgrade/issues

...

Error when running

Here is the end of the log when running pip-upgrade on a Raspberry Pi 4.

Downloading https://files.pythonhosted.org/packages/af/cc/5064a3c25721cd863e6982b87f10fdd91d8bcc62b6f7f36f5231f20d6376/python-augeas-1.1.0.tar.gz (93kB)
100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 102kB 2.5MB/s
Complete output from command python setup.py egg_info:
Failed building wheel for cffi
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/setuptools/installer.py", line 128, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp9975e_k7', '--quiet', 'cffi>=1.0.0']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-q8pq7f8r/python-augeas/setup.py", line 43, in <module>
    test_suite="test.test_augeas",
  File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 160, in setup
    _install_setup_requires(attrs)
  File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 155, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/usr/local/lib/python3.7/dist-packages/setuptools/dist.py", line 698, in fetch_build_eggs
    replace_conflicting=True,
  File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 783, in resolve
    replace_conflicting=replace_conflicting
  File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 1066, in best_match
    return self.obtain(req, installer)
  File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 1078, in obtain
    return installer(requirement)
  File "/usr/local/lib/python3.7/dist-packages/setuptools/dist.py", line 754, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/usr/local/lib/python3.7/dist-packages/setuptools/installer.py", line 130, in fetch_build_egg
    raise DistutilsError(str(e))
distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp9975e_k7', '--quiet', 'cffi>=1.0.0']' returned non-zero exit status 1.

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-q8pq7f8r/python-augeas/
pi@server:~ $

Error while parsing package [ ... ] (skipping)

I am getting this while running pip-upgrade. It is handling the error gracefully, but the update for pytz is being skipped.

Error while parsing package pytz==2023.3 (skipping).
Exception:  Invalid version: '2004d'

wishlist: option to automatically accept the upgrade prompt

g'day. it'd be nice to be able to automatically accept whatever upgrades were found; with version control tracking changes in installed packages it is easy for me to roll back an update that causes troubles. something like --yes that acted as if I said y at the prompt.

KeyError

Hey, I decided to update my packages today, and got a KeyError. Here's the full traceback:

[tabulate@xenon ~]$ pip-upgrade
Checking outdated packages...
Skipping dulwich, warning: Name mismatch. This will be improved. Manually upgrade if needed
Traceback (most recent call last):
  File "/home/tabulate/.local/bin/pip-upgrade", line 8, in <module>
    sys.exit(main())
  File "/home/tabulate/.local/lib/python3.9/site-packages/pip_upgrade/main.py", line 98, in main
    pip_upgrade.get_dependencies()
  File "/home/tabulate/.local/lib/python3.9/site-packages/pip_upgrade/dependencies_base.py", line 35, in get_dependencies
    pkg_store = self.dict[pkg_name]
KeyError: 'Panda3D'

Version: 0.5.1
OS: Manjaro (Linux 5.10.60)

Note: This issue is resolved if I manually upgrade Panda3D.

for information: current false positive with bokeh versus panel

Hi,
pip-upgrade command shows bokeh as possible upgrade candidate but doing this breaks the panel package.
Thanks!

$ pip-upgrade 
Checking outdated packages...
Skipping nmslib, warning: Name mismatch. This will be improved. Manually upgrade if needed
Skipping extract-msg, warning: Name mismatch. This will be improved. Manually upgrade if needed
These packages will be upgraded:  ['bokeh', 'fastcore', 'gcsfs', 'hypothesis', 'pynvml', 'pypdf', 's3fs', 'tensorflow', 'validators', 'whatthepatch', 'zstandard']
Continue? (y/n or -e/-r/--help): n
All packages are up to date! ๐ŸŽ‰

$ pip install -U bokeh
Requirement already satisfied: bokeh in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (3.4.2)
Collecting bokeh
  Using cached bokeh-3.5.0-py3-none-any.whl.metadata (12 kB)
Requirement already satisfied: Jinja2>=2.9 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (3.1.4)
Requirement already satisfied: contourpy>=1.2 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (1.2.1)
Requirement already satisfied: numpy>=1.16 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (1.26.4)
Requirement already satisfied: packaging>=16.8 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (23.2)
Requirement already satisfied: pandas>=1.2 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (2.2.2)
Requirement already satisfied: pillow>=7.1.0 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (10.4.0)
Requirement already satisfied: PyYAML>=3.10 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (6.0.1)
Requirement already satisfied: tornado>=6.2 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (6.4.1)
Requirement already satisfied: xyzservices>=2021.09.1 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from bokeh) (2024.6.0)
Requirement already satisfied: MarkupSafe>=2.0 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from Jinja2>=2.9->bokeh) (2.1.5)
Requirement already satisfied: python-dateutil>=2.8.2 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from pandas>=1.2->bokeh) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from pandas>=1.2->bokeh) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from pandas>=1.2->bokeh) (2024.1)
Requirement already satisfied: six>=1.5 in /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages (from python-dateutil>=2.8.2->pandas>=1.2->bokeh) (1.16.0)
Using cached bokeh-3.5.0-py3-none-any.whl (6.8 MB)
Installing collected packages: bokeh
  Attempting uninstall: bokeh
    Found existing installation: bokeh 3.4.2
    Uninstalling bokeh-3.4.2:
      Successfully uninstalled bokeh-3.4.2
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
panel 1.4.4 requires bokeh<3.5.0,>=3.4.0, but you have bokeh 3.5.0 which is incompatible.
Successfully installed bokeh-3.5.0

$ pip show panel
Name: panel
Version: 1.4.4
Summary: The powerful data exploration & web app framework for Python.
Home-page: http://panel.holoviz.org
Author: HoloViz
Author-email: [email protected]
License: BSD
Location: /srv/backup/local/python3.11_venv/jupyterlab/lib/python3.11/site-packages
Requires: bleach, bokeh, linkify-it-py, markdown, markdown-it-py, mdit-py-plugins, pandas, param, pyviz-comms, requests, tqdm, typing-extensions, xyzservices
Required-by: holoviews

Typing Extensions Issue

Hi, I figured that I'd let you know that there seems to be an issue with upgrading the typing_extensions package that is resolved via manual upgrade

Checking outdated packages...
Traceback (most recent call last):
  File "/home/tabulate/.local/lib/python3.9/site-packages/pip_upgrade/dependencies_base.py", line 36, in get_dependencies
    pkg_store = self.dict[pkg_name]
KeyError: 'typing_extensions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tabulate/.local/bin/pip-upgrade", line 8, in <module>
    sys.exit(main())
  File "/home/tabulate/.local/lib/python3.9/site-packages/pip_upgrade/main.py", line 70, in main
    pip_upgrade.get_dependencies()
  File "/home/tabulate/.local/lib/python3.9/site-packages/pip_upgrade/dependencies_base.py", line 41, in get_dependencies
    raise e
  File "/home/tabulate/.local/lib/python3.9/site-packages/pip_upgrade/dependencies_base.py", line 39, in get_dependencies
    pkg_store = self.dict[pkg_name.lower()]
KeyError: 'typing_extensions'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.