Coder Social home page Coder Social logo

achillesrasquinha / pipupgrade Goto Github PK

View Code? Open in Web Editor NEW
574.0 7.0 27.0 2.61 GB

🗽 Like yarn outdated/upgrade, but for pip. Upgrade all your pip packages and automate your Python Dependency Management.

Home Page: https://git.io/pipupgrade

License: MIT License

Makefile 6.34% Python 93.13% Shell 0.10% Dockerfile 0.42%
pip python upgrade command-line cli update pypi package-manager version

pipupgrade's Introduction

pipupgrade

The missing command for pip

Table of Contents

Features

  • Updates system packages and local packages.
  • Discovers packages present within multiple Python Environments.
  • Updates packages mentioned within a requirements.txt file (Also pins up-to-date versions if mentioned).
  • Smart requirements.txt detector.
  • Pipfile support.
  • Detects semantic version to avoid updates that break changes. Also ensures to avoid child dependencies that break changes.
  • View Dependency Graph.
  • Parallel updates (blazingly fast).
  • Python 2.7+ and Python 3.4+ compatible. Also pip 9+, pip 10+, pip 18+ and pip 19.0.1+ compatible.
  • Automate your Dependencies by installing pipupgrade in your CI workflow.
  • Zero Dependencies!

Quick Start

$ pip install pipupgrade

Check out installation for more details.

Usage

Basic Usage

That's basically it! Run the help for more details...

$ pipupgrade --help
usage: pipupgrade [--pip-path PIP_PATH] [-y] [-c]
                  [--upgrade-type {major,minor,patch} [{major,minor,patch} ...]]
                  [-l] [-f {table,tree,json,yaml}] [-a] [--pip] [-s]
                  [-r REQUIREMENTS] [--pipfile PIPFILE] [-i] [-p PROJECT]
                  [--git-username GIT_USERNAME] [--git-email GIT_EMAIL]
                  [--pull-request] [--github-access-token GITHUB_ACCESS_TOKEN]
                  [--github-reponame GITHUB_REPONAME]
                  [--github-username GITHUB_USERNAME]
                  [--target-branch TARGET_BRANCH] [-j JOBS] [-u]
                  [--no-included-requirements] [--no-cache] [-o OUTPUT]
                  [--ignore-error] [--force] [--no-color] [-V] [-v] [-h]
                  [packages [packages ...]]

pipupgrade (v VERSION)

UPGRADE ALL THE PIP PACKAGES!

positional arguments:
  packages              Packages to Upgrade. (default: None)

optional arguments:
  --ignore IGNORE       Ignore packages to upgrade. (default: None)
  --pip-path PIP_PATH   Path to pip executable to be used. (default: None)
  -y, --yes             Confirm for all dialogs. (default: 0)
  -c, --check           Perform a dry-run, avoid updating packages. (default:
                        0)
  --upgrade-type {major,minor,patch} [{major,minor,patch} ...]
                        Upgrade Type (default: ['minor', 'patch'])
  -l, --latest          Update all packages to latest. (default: 0)
  -f {table,tree,json,yaml}, --format {table,tree,json,yaml}
                        Display packages format. (default: table)
  -a, --all             List all packages. (default: 0)
  --pip                 Update pip. (default: 0)
  -s, --self            Update pipupgrade. (default: False)
  -r REQUIREMENTS, --requirements REQUIREMENTS
                        Path(s) to requirements.txt file. (default: None)
  --pipfile PIPFILE     Path(s) to Pipfile (default: None)
  -i, --interactive     Interactive Mode. (default: 0)
  -p PROJECT, --project PROJECT
                        Path(s) to Project (default: None)
  --git-username GIT_USERNAME
                        Git Username (default: None)
  --git-email GIT_EMAIL
                        Git Email (default: None)
  --pull-request        Perform a Pull Request. (default: False)
  --github-access-token GITHUB_ACCESS_TOKEN
                        GitHub Access Token (default: None)
  --github-reponame GITHUB_REPONAME
                        Target GitHub Repository Name (default: None)
  --github-username GITHUB_USERNAME
                        Target GitHub Username (default: None)
  --target-branch TARGET_BRANCH
                        Target Branch (default: master)
  -j JOBS, --jobs JOBS  Number of Jobs to be used. (default: 4)
  -u, --user            Install to the Python user install directory for
                        environment variables and user configuration.
                        (default: 0)
  --no-included-requirements
                        Avoid updating included requirements. (default: 0)
  --no-cache            Avoid fetching latest updates from PyPI server.
                        (default: 0)
  -o OUTPUT, --output OUTPUT
                        Print Output to File. (default: None)
  --ignore-error        Ignore Error in case of upgrade failure. (default: 0)
  --force               Force search for files within a project. (default: 0)
  --no-color            Avoid colored output. (default: 0)
  -V, --verbose         Display verbose output. (default: False)
  -v, --version         Show pipupgrade's version number and exit.
  -h, --help            Show this help message and exit.

Docker

Using pipupgrade's Docker Image to generate a Pull Request can be done as follows:

$ docker run \
    -e "PIPUPGRADE_GIT_USERNAME=<YOUR_GIT_USERNAME>" \
    -e "PIPUPGRADE_GIT_EMAIL=<YOUR_GIT_EMAIL>" \
    -e "PIPUPGRADE_GITHUB_REPONAME=<YOUR_GIT_REPONAME>" \
    -e "PIPUPGRADE_GITHUB_USERNAME=<YOUR_GIT_USERNAME>" \
    --rm \
    -it \
    -v $(pwd):/path/to/project \
      achillesrasquinha/pipupgrade \
        --project /path/to/project \
        --pull-request \
        --force \
        --yes \
        --verbose

Similar Packages

pipupgrade attempts to provide an all-in-one solution as compared to the following packages:

Known Issues

License

This repository has been released under the MIT License.


Made with ❤️ using boilpy.

pipupgrade's People

Contributors

achillesrasquinha avatar cyrusyip avatar furbeck avatar jamesmcguigan avatar max-nicholson avatar semantic-release-bot avatar shidevil avatar vmlaguna avatar zombiepigdragon 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  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  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  avatar  avatar  avatar  avatar  avatar

pipupgrade's Issues

Stuck at "Checking..." forever

pipupgrade uses pip to check for outdated packages (pip list --outdated) to be precise. This causes pip to enter into an infinite loop for some reason (pip issue).

If you're on macOS, try deleting the pip cache.

$ rm -rf ~/Library/Caches/pip

else

$ rm -rf ~/.cache/pip

'--user' flag and sudo with pipupgrade

I tried to use pipupgrade but got an error saying I was required to use the --user flag due to restricted permissions.
I tried using sudo, but got an error message saying command was not found with sudo (Obviously some other issue there).

I could not recreate the error but will update if I get it again. In either case it would be cool to be able to add some pip arguments when running pipupgrade.

[android] posix semaphores unavailable (pipupgrade crashes)

Hello!

Summary

It looks like pipupgrade will not run on Android (at all?) as POSIX semaphores are not enabled (I haven't tested all Android versions/device combinations - it's very possible that on x86 Android devices this might work.)

Because of the lack of POSIX Semaphores, pipupgrade will not run at all - see trace below. The two examples are (1) running on Termux, where their package build of python3 specifically disables POSIX semaphores on build (because, I presume, it's not an available function)... and also of "archlinux running in a proot on Termux for Android" (basically a chroot of Archlinux). This also fails because, ultimately, Semaphores are just not available (the displayed error is different - the Termux python was compiled without POSIX Semaphores and the Arch version was compiled with -- the Arch version tries but gets a permission denied - end result is the same: it doesn't work.)

Thoughts

I haven't had a chance to go through pipupgrade's code fully - however the issue is definitely related to using multiprocessing:

# imports - standard imports
from contextlib import contextmanager
import multiprocessing as mp
@contextmanager
def pool(*args, **kwargs):
pool = mp.Pool(*args, **kwargs)
yield pool
pool.terminate()

Arguably, Python itself should probably "fail" more elegantly in these cases (e.g. it determines that Semaphores aren't available on the platform it's running on, generates a warning, and then finds another method to run the code ... but then there's a whole argument of doing something in a way that the programmer didn't explicitly ask for...)

Potential Solution

One solution might be for pipupgrade to detect if instantiating a multiprocessing.Pool() object throws an error and to fall back to single-thread operation (without multiprocessing - or to potentially set an option in multiprocessing - however, I'm not 100% sure that there is even an option that can be set to work around this). As of now, using pipupgrade -j 1 to specify a single thread still throws this error because multiprocessing is still used regardless of the number of jobs set.

Related

This might be related to #40 ... not 100% sure. See some of the Python bugs I've linked to below.

Further Reading

Python Issue 3770 - multiprocessing crashes on systems with HAVE_SEM_OPEN=0
Python Issue 33725 - Python crashing on mac with multiprocessing

Platform Info

  • Android 9/aarch64 (arm64)
  • Python 3.7.5 (Termux) // Python 3.7.4 (Arch On Arm)
  • pipupgrade version: 1.5.2 (latest avaialble on PyPi)

Termux

*~ pipupgrade -c -i*
Checking...
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/synchronize.py", line 28, in <module>
    from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'SemLock' from '_multiprocessing' (/data/data/com.termux/files/usr/lib/python3.7/lib-dynload/_multiprocessing.cpython-37m.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/bin/pipupgrade", line 8, in <module>
    sys.exit(main())
  File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pipupgrade/cli/__init__.py", line 14, in wrapper
    return fn(**params)
  File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pipupgrade/commands/__init__.py", line 112, in command
    with parallel.pool(processes = jobs) as pool:
  File "/data/data/com.termux/files/usr/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/pipupgrade/parallel.py", line 7, in pool
    pool = mp.Pool(*args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/context.py", line 119, in Pool
    context=self.get_context())
  File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/pool.py", line 158, in __init__
    self._setup_queues()
  File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/pool.py", line 251, in _setup_queues
    self._inqueue = self._ctx.SimpleQueue()
  File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/context.py", line 112, in SimpleQueue
    return SimpleQueue(ctx=self.get_context())
  File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/queues.py", line 332, in __init__
    self._rlock = ctx.Lock()
  File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/context.py", line 66, in Lock
    from .synchronize import Lock
  File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/synchronize.py", line 32, in <module>
    " synchronization primitives needed will not" +
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.

Arch proot on Termux

Traceback (most recent call last):
  File "/bin/pipupgrade", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.7/site-packages/pipupgrade/cli/__init__.py", line 14, in wrapper
    return fn(**params)
  File "/usr/lib/python3.7/site-packages/pipupgrade/commands/__init__.py", line 112, in command
    with parallel.pool(processes = jobs) as pool:
  File "/usr/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/usr/lib/python3.7/site-packages/pipupgrade/parallel.py", line 7, in pool
    pool = mp.Pool(*args, **kwargs)
  File "/usr/lib/python3.7/multiprocessing/context.py", line 119, in Pool
    context=self.get_context())
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 158, in __init__
    self._setup_queues()
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 251, in _setup_queues
    self._inqueue = self._ctx.SimpleQueue()
  File "/usr/lib/python3.7/multiprocessing/context.py", line 112, in SimpleQueue
    return SimpleQueue(ctx=self.get_context())
  File "/usr/lib/python3.7/multiprocessing/queues.py", line 332, in __init__
    self._rlock = ctx.Lock()
  File "/usr/lib/python3.7/multiprocessing/context.py", line 67, in Lock
    return Lock(ctx=self.get_context())
  File "/usr/lib/python3.7/multiprocessing/synchronize.py", line 162, in __init__
    SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
  File "/usr/lib/python3.7/multiprocessing/synchronize.py", line 59, in __init__
    unlink_now)
PermissionError: [Errno 13] Permission denied

NameError on python3.5

When launching pipupgrade (on version 1.5.1) on python 3.5, during the import, I have an error with the following stacktrace:

Traceback (most recent call last):
  File ".tox/py35-unit/bin/pipupgrade", line 6, in <module>
    from pipupgrade.__main__ import main
  File ".tox/py35-unit/lib/python3.5/site-packages/pipupgrade/__init__.py", line 7, in <module>
    from pipupgrade.__main__ import main
  File ".tox/py35-unit/lib/python3.5/site-packages/pipupgrade/__main__.py", line 5, in <module>
    from pipupgrade.commands import command as main
  File ".tox/py35-unit/lib/python3.5/site-packages/pipupgrade/commands/__init__.py", line 7, in <module>
    from pipupgrade.model         import Project, Package, Registry
  File ".tox/py35-unit/lib/python3.5/site-packages/pipupgrade/model/__init__.py", line 3, in <module>
    from pipupgrade.model.package  import Package
  File ".tox/py35-unit/lib/python3.5/site-packages/pipupgrade/model/package.py", line 5, in <module>
    from pipupgrade import _pip, request as req, db
  File ".tox/py35-unit/lib/python3.5/site-packages/pipupgrade/_pip.py", line 2, in <module>
    from pipupgrade._compat import iteritems
  File ".tox/py35-unit/lib/python3.5/site-packages/pipupgrade/_compat.py", line 45, in <module>
    ModuleNotFoundError = ModuleNotFoundError
NameError: name 'ModuleNotFoundError' is not defined

I look in the code associated to the version 1.5.1, I cannot found this line (_compat.py)

I workaround this by using the version 1.5.0.

Crashes on invocation

$ pipupgrade
Checking...
Traceback (most recent call last):
  File "/usr/local/bin/pipupgrade", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/cli/__init__.py", line 14, in wrapper
    return fn(**params)
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/commands/__init__.py", line 162, in command
    format = "json", pip_exec = pip_)
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/_pip.py", line 65, in call
    return popen(*params, output = True)
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/util/system.py", line 69, in popen
    raise sp.CalledProcessError(code, command)
subprocess.CalledProcessError: Command 'None list --outdated --format json' returned non-zero exit status 127.

Also happens with no flags and --latest --yes

macOS 10.14.4
Python 3.7.3
pip 19.0.3

pipupgrade: TypeError: unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta'

pipupgrade won't work

$ pipupgrade --check

Checking...
multiprocessing.pool.RemoteTraceback:
"""
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/model/package.py", line 108, in __init__
    time_difference	= res["_updated_at"] + timedelta(seconds = cache_timeout)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta'
"""
$ pipupgrade --self
Checking...
Updating pipupgrade...
pipupgrade upto date.
$ brew info python
python: stable 3.7.6 (bottled), HEAD

Past month pipupgrade was working great. Now it isn't. Maybe the last update has a bug or I'm forgetting to do something?

os.EX_OK and os.EX_NOINPUT constants are not available on Windows

$ pipupgrade.exe
Checking...

Source: Installed Distributions (C:\Python27\Scripts\pip.exe)

Name      Current Version Latest Version Home Page
--------- --------------- -------------- --------------------------
mercurial 5.0             5.0.1          https://mercurial-scm.org/

Do you wish to update 1 package? [Y/n/q]: q
Traceback (most recent call last):
  File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python37\Scripts\pipupgrade.exe\__main__.py", line 9, in <module>
  File "c:\python37\lib\site-packages\pipupgrade\cli\__init__.py", line 14, in wrapper
    return fn(**params)
  File "c:\python37\lib\site-packages\pipupgrade\commands\__init__.py", line 237, in command
    if npackages and (yes or interactive or cli.confirm(query, quit_ = True)):
  File "c:\python37\lib\site-packages\pipupgrade\cli\util.py", line 29, in confirm
    sys.exit(os.EX_OK)
AttributeError: module 'os' has no attribute 'EX_OK'

Docs: https://docs.python.org/3/library/os.html#os.EX_OK

list of packages to update is not that right

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. pipupgrade just give me that list
    image

  2. For the first, there is something strange with versions of packages (the new is less than installed)

  3. If I check with pip it is:
    image

  4. It's really different lists

Expected behavior
For the first: just right list with files to update
For the second: a right version of packages on which update

Desktop (please complete the following information):

  • OS: manjaro

don't install or upgrade from requirements file

Hello!

When I try to install packages from requirements file nothing happens, but in verbose mode, logger writes that the command not found.

for example:

/run/media/metya/08EC9EF35B784597/Projects/FscoreFlask/requirements.txt: row 13: category-encoders==1.3.0: command not found
/run/media/metya/08EC9EF35B784597/Projects/FscoreFlask/requirements.txt: row 23: dash-core-components==0.39.0: command not found
/run/media/metya/08EC9EF35B784597/Projects/FscoreFlask/requirements.txt: row 24: dash-html-components==0.13.2: command not found
/run/media/metya/08EC9EF35B784597/Projects/FscoreFlask/requirements.txt: row 25: dash-renderer==0.15.1: command not found

System: Linux, Manjaro.

and pipupgrade not handle
-e git+http://github.com/somerepos/ and just git+http://github.com/someanotherrepo in a requirements file

ImportError: cannot import name 'get_installed_distributions'

Error: pipupgrade
Traceback (most recent call last):
File "/usr/local/bin/pipupgrade", line 7, in
from pipupgrade.main import main
File "/usr/local/lib/python3.6/site-packages/pipupgrade/main.py", line 5, in
from pipupgrade.commands import command as main
File "/usr/local/lib/python3.6/site-packages/pipupgrade/commands/init.py", line 4, in
from pipupgrade import _pip
File "/usr/local/lib/python3.6/site-packages/pipupgrade/_pip.py", line 7, in
from pip import get_installed_distributions
ImportError: cannot import name 'get_installed_distributions'

Cant run pipupgrade. ModuleNotFoundError: No module named 'ctypes.windll'

ModuleNotFoundError: No module named 'ctypes.windll'

Traceback (most recent call last):
File "c:\program files\python37\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\program files\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Program Files\Python37\Scripts\pipupgrade.exe_main
.py", line 5, in
File "c:\program files\python37\lib\site-packages\pipupgrade_init
.py", line 7, in
from pipupgrade.main import main
File "c:\program files\python37\lib\site-packages\pipupgrade_main_.py", line 5, in
from pipupgrade.commands import command as main
File "c:\program files\python37\lib\site-packages\pipupgrade\commands_init_.py", line 9, in
from pipupgrade.commands.helper import (
File "c:\program files\python37\lib\site-packages\pipupgrade\commands\helper.py", line 8, in
from pipupgrade.commands.util import cli_format
File "c:\program files\python37\lib\site-packages\pipupgrade\commands\util.py", line 2, in
from pipupgrade.cli.parser import get_args
File "c:\program files\python37\lib\site-packages\pipupgrade\cli_init_.py", line 3, in
from pipupgrade.cli.parser import get_args
File "c:\program files\python37\lib\site-packages\pipupgrade\cli\parser.py", line 25, in
_cli.format(name, _cli.RED),
File "c:\program files\python37\lib\site-packages\pipupgrade\cli\util.py", line 52, in format
kernel32 = import_handler("ctypes.windll.kernel32")
File "c:\program files\python37\lib\site-packages\pipupgrade\util\imports.py", line 18, in import_handler
handler = _HANDLER_REGISTRY[name]
File "c:\program files\python37\lib\site-packages\pipupgrade\util\imports.py", line 8, in missing
module = import(module_name, {}, {}, [handler_name])
ModuleNotFoundError: No module named 'ctypes.windll'

Issue with new --user flag

It seems since the addition of the new '--user' flag, pipupgrade seems to break when it goes to upgrade existing packages.

Color problem

The colored output doesn't work right on Microsoft 10's command prompt. I suggest removing the color formatting.
image

Windows subsystem: Ubuntu error when "pipupgrade --latest --yes"

Printout:

Checking...
Traceback (most recent call last):
  File "/home/can/.local/bin/pipupgrade", line 11, in <module>
    sys.exit(main())
  File "/home/can/.local/lib/python3.6/site-packages/pipupgrade/cli/__init__.py", line 14, in wrapper
    return fn(**params)
  File "/home/can/.local/lib/python3.6/site-packages/pipupgrade/commands/__init__.py", line 178, in command
    format = "json", pip_exec = pip_)
  File "/home/can/.local/lib/python3.6/site-packages/pipupgrade/_pip.py", line 69, in call
    return popen(*params, output = True)
  File "/home/can/.local/lib/python3.6/site-packages/pipupgrade/util/system.py", line 70, in popen
    raise sp.CalledProcessError(code, command)
subprocess.CalledProcessError: Command '/usr/bin/pip3 list --outdated --format json' returned non-zero exit status 2.

Possible missing pip module.

What's the bug all about?

missing pip._internal module, pipupgrade not functioning.

What command led to this issue?

$ Traceback (most recent call last):
  File "/home/florian/.local/bin/pipupgrade", line 5, in <module>
    from pipupgrade.__main__ import main
  File "/home/florian/.local/lib/python3.8/site-packages/pipupgrade/__init__.py", line 7, in <module>
    from pipupgrade.__main__    import main
  File "/home/florian/.local/lib/python3.8/site-packages/pipupgrade/__main__.py", line 5, in <module>
    from pipupgrade.commands import command as main
  File "/home/florian/.local/lib/python3.8/site-packages/pipupgrade/commands/__init__.py", line 9, in <module>
    from pipupgrade.commands.helper import (
  File "/home/florian/.local/lib/python3.8/site-packages/pipupgrade/commands/helper.py", line 7, in <module>
    from pipupgrade.model           import Registry
  File "/home/florian/.local/lib/python3.8/site-packages/pipupgrade/model/__init__.py", line 3, in <module>
    from pipupgrade.model.package  import Package
  File "/home/florian/.local/lib/python3.8/site-packages/pipupgrade/model/package.py", line 9, in <module>
    from pipupgrade       import _pip, semver, request as req, db, log
  File "/home/florian/.local/lib/python3.8/site-packages/pipupgrade/_pip.py", line 25, in <module>
    from pip._internal.req             import parse_requirements
ModuleNotFoundError: No module named 'pip._internal'

Logs

same issue as above.

sqlite3 error on `pipupgrade --latest`

Ran pipupgrade --latest after installing :

Checking...
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "pipupgrade/commands/helper.py", line 109, in get_registry_from_pip
    installed = True, sync = sync)
  File "pipupgrade/model/registry.py", line 13, in __init__
    for p in packages
  File "pipupgrade/model/registry.py", line 13, in <listcomp>
    for p in packages
  File "pipupgrade/model/package.py", line 40, in __init__
    _db = db.get_connection()
  File "pipupgrade/db.py", line 87, in get_connection
    _CONNECTION.query(query)
  File "pipupgrade/db.py", line 49, in query
    cursor.execute(*args, **kwargs)
sqlite3.OperationalError: database is locked
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "pipupgrade", line 8, in <module>
    sys.exit(main())
  File "pipupgrade/cli/__init__.py", line 14, in wrapper
    return fn(**params)
  File "pipupgrade/commands/__init__.py", line 118, in command
    pip_path
  File "multiprocessing/pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "multiprocessing/pool.py", line 657, in get
    raise self._value
sqlite3.OperationalError: database is locked
pip 19.3.1
python 3.7.4
pipupgrade 1.5.2
macOS 10.15.2 (19C57)

Only failed once. Worked on second attempt.

returned non-zero exit status 1

Ran pipupgrade --latest

Python 3.6 on macOS 10.14.6 (18G87)

Traceback (most recent call last):
File "/anaconda3/bin/pipupgrade", line 10, in
sys.exit(main())
File "/anaconda3/lib/python3.6/site-packages/pipupgrade/cli/init.py", line 14, in wrapper
return fn(**params)
File "/anaconda3/lib/python3.6/site-packages/pipupgrade/commands/init.py", line 260, in command
_pip.call("install", package.name, pip_exec = package.source, user = user, quiet = not verbose, no_cache_dir = True, upgrade = True)
File "/anaconda3/lib/python3.6/site-packages/pipupgrade/_pip.py", line 69, in call
return popen(*params, output = True)
File "/anaconda3/lib/python3.6/site-packages/pipupgrade/util/system.py", line 70, in popen
raise sp.CalledProcessError(code, command)
subprocess.CalledProcessError: Command '/anaconda3/bin/pip install normality --quiet --no-cache-dir --upgrade' returned non-zero exit status 1.

Cannot support spaces in path

Hello, I see, pipupgrade cannot run in windows if the path contain spaces:

PS C:\Windows\System32> pipupgrade --latest --yes
�[0;93mChecking...�[0m
Traceback (most recent call last):
  File "c:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python37\Scripts\pipupgrade.exe\__main__.py", line 9, in <module>
  File "c:\program files\python37\lib\site-packages\pipupgrade\cli\__init__.py", line 14, in wrapper
    return fn(**params)
  File "c:\program files\python37\lib\site-packages\pipupgrade\commands\__init__.py", line 178, in command
    format = "json", pip_exec = pip_)
  File "c:\program files\python37\lib\site-packages\pipupgrade\_pip.py", line 69, in call
    return popen(*params, output = True)
  File "c:\program files\python37\lib\site-packages\pipupgrade\util\system.py", line 70, in popen
    raise sp.CalledProcessError(code, command)
subprocess.CalledProcessError: Command 'C:\Program Files\Python37\Scripts\pip.exe list --outdated --format json' returned non-zero exit status 1.

the command pip.exe list run perfect:

PS C:\Windows\System32> pip.exe list --outdated --format json
[{"name": "port-for", "version": "0.3.1", "latest_version": "0.4", "latest_filetype": "wheel"}, {"name": "setuptools", "version": "40.8.0", "latest_version": "41.0.1", "latest_filetype": "wheel"}]

Python version: 3.7.4 x64
Pip version: 19.2.1
pipupgrade version: latest.
image

Skip distutils installed packages?

When I run pipupgrade to upgrade system packages, the first package that comes from my distribution (Debian) breaks the process. Pipupgrade does not skip it and continue, it instead exits, and I don't see any option to ignore such packages. Even in interactive mode, when it tries to upgrade such a package it just exits after, and I have to manually restart it and learn which packages to manually avoid.

Updating X of Y packages: pycairo
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
  ERROR: Complete output from command /usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-eFmxQW/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-BWdFwU --python-tag cp27:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/cairo
  copying cairo/__init__.py -> build/lib.linux-x86_64-2.7/cairo
  copying cairo/__init__.pyi -> build/lib.linux-x86_64-2.7/cairo
  copying cairo/py.typed -> build/lib.linux-x86_64-2.7/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.13.1']' returned non-zero exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pycairo
ERROR: Cannot uninstall 'pycairo'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Traceback (most recent call last):
  File "/usr/local/bin/pipupgrade", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/pipupgrade/cli/__init__.py", line 14, in wrapper
    return fn(**params)
  File "/usr/local/lib/python2.7/dist-packages/pipupgrade/commands/__init__.py", line 204, in command
    _pip.install(package.name, pip_exec = pip_path, user = user, quiet = not verbose, no_cache_dir = True, upgrade = True)
  File "/usr/local/lib/python2.7/dist-packages/pipupgrade/_pip.py", line 63, in install
    popen(*params)
  File "/usr/local/lib/python2.7/dist-packages/pipupgrade/util/system.py", line 59, in popen
    raise sp.CalledProcessError(code, command)
subprocess.CalledProcessError: Command '/usr/local/bin/pip install --upgrade --quiet --no-cache-dir pycairo' returned non-zero exit status 1

pipupgrade fails unless `requests` is installed globally.

Checking...
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/request/__init__.py", line 20, in get
    import requests as req
ModuleNotFoundError: No module named 'requests'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pipupgrade", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/cli/__init__.py", line 14, in wrapper
    return fn(**params)
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/commands/__init__.py", line 177, in command
    package 	 	  = Package(package)
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/model/package.py", line 32, in __init__
    _pypi_info = _get_pypi_info(self.name, raise_err = False) or { }
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/model/package.py", line 6, in _get_pypi_info
    res  = req.get(url)
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/request/__init__.py", line 27, in get
    http_response    = urlopen(url)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 516, in open
    req.timeout = timeout
AttributeError: 'NoneType' object has no attribute 'timeout'

This should be mentioned on the README, or, even better, pulled in on a fresh install.

WIN10 Error

Hi, I just installed pipupgrade and tried running it on Win10 / Python 3.7.3. I have one dependency package that is too new to satisfy the requirements for another package. I did not start to debug this.

PS C:\Uusers\USER\> pipupgrade --latest --yes
c:\users\USER\appdata\local\programs\python\python37\lib\site-packages\requests\__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)
�[0;93mChecking...�[0m
Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\Scripts\pipupgrade-script.py", line 11, in <module>
    load_entry_point('pipupgrade==1.5.0', 'console_scripts', 'pipupgrade')()
  File "c:\users\USER\appdata\local\programs\python\python37\lib\site-packages\pipupgrade\cli\__init__.py", line 14, in wrapper
    return fn(**params)
  File "c:\users\USER\appdata\local\programs\python\python37\lib\site-packages\pipupgrade\commands\__init__.py", line 162, in command
    format = "json", pip_exec = pip_)
  File "c:\users\USER\appdata\local\programs\python\python37\lib\site-packages\pipupgrade\_pip.py", line 65, in call
    return popen(*params, output = True)
  File "c:\users\USER\appdata\local\programs\python\python37\lib\site-packages\pipupgrade\util\system.py", line 69, in popen
    raise sp.CalledProcessError(code, command)
subprocess.CalledProcessError: Command 'None list --outdated --format json' returned non-zero exit status 1.
PS C:\Uusers\USER\>```

pipupgrade 1.6.2 has AssertionError on Windows

I just upgraded pipupgrade to 1.6.2 on Windows 10 (64-bit) running Python 3.8. Issue #39 is still present (fortunately somebody gave how to fix that one). In addition, I now get "AssertionError: group argument must be None for now". From what I can find, this is most likely around parallel/threading but I'm new enough to Python that I can't figure out exactly which call is producing the error.

Edit: I tried downgrading and 1.6.0 and 1.6.1 also have this issue. I had to drop back to 1.5.2 to get pipupgrade working again.

Here is the full traceback...

Traceback (most recent call last): File "c:\users\wilco\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\wilco\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\wilco\AppData\Local\Programs\Python\Python38\Scripts\pipupgrade.exe\__main__.py", line 7, in <module> File "c:\users\wilco\appdata\local\programs\python\python38\lib\site-packages\pipupgrade\cli\__init__.py", line 15, in wrapper return fn(**params) File "c:\users\wilco\appdata\local\programs\python\python38\lib\site-packages\pipupgrade\commands\__init__.py", line 143, in command with parallel.no_daemon_pool(processes = jobs) as pool: File "c:\users\wilco\appdata\local\programs\python\python38\lib\contextlib.py", line 113, in __enter__ return next(self.gen) File "c:\users\wilco\appdata\local\programs\python\python38\lib\site-packages\pipupgrade\parallel.py", line 26, in no_daemon_pool with pool(class_ = NoDaemonProcessPool, *args, **kwargs) as p: File "c:\users\wilco\appdata\local\programs\python\python38\lib\contextlib.py", line 113, in __enter__ return next(self.gen) File "c:\users\wilco\appdata\local\programs\python\python38\lib\site-packages\pipupgrade\parallel.py", line 20, in pool pool = class_(*args, **kwargs) File "c:\users\wilco\appdata\local\programs\python\python38\lib\multiprocessing\pool.py", line 212, in __init__ self._repopulate_pool() File "c:\users\wilco\appdata\local\programs\python\python38\lib\multiprocessing\pool.py", line 303, in _repopulate_pool return self._repopulate_pool_static(self._ctx, self.Process, File "c:\users\wilco\appdata\local\programs\python\python38\lib\multiprocessing\pool.py", line 319, in _repopulate_pool_static w = Process(ctx, target=worker, File "c:\users\wilco\appdata\local\programs\python\python38\lib\multiprocessing\process.py", line 82, in __init__ assert group is None, 'group argument must be None for now' AssertionError: group argument must be None for now

Command returned non zero exit status since pip is not callable (LISTED POTENTIAL FIX)

What's the bug all about?

When running any command that checks the pip packages, I get an error since when running the command pip list --format json it says the module pip is not callable.
This could be fixed by using this instead: /usr/bin/python3 -m pip list --format json

What command led to this issue?

Please type the exact command that led to this issue.

$ pipupgrade -a
OR
$ pipupgrade --check
OR
$ pipupgrade --latest --yes

Logs

Please paste the logs using pipupgrade --verbose

pi@raspberrypi:~/<REDACTED> $ pipupgrade -a --verbose
2020-02-05 13:07:56,317 | INFO | Environment: {'python_version': '3.7.3', 'os': 'Linux-4.19.75-v7l+-armv7l-with-debian-10.1'}
2020-02-05 13:07:56,317 | INFO | Arguments Passed: {'packages': [], 'pip_path': None, 'requirements': None, 'pipfile': None, 'project': None, 'pull_request': False, 'git_username': None, 'git_email': None, 'github_access_token': None, 'github_reponame': None, 'github_username': None, 'target_branch': 'master', 'latest': 0, 'format': 'table', 'all': True, 'pip': 0, 'self': False, 'jobs': 4, 'user': 0, 'check': 0, 'interactive': 0, 'yes': 0, 'no_included_requirements': 0, 'no_cache': 0, 'no_color': 0, 'output': None, 'ignore_error': 0, 'force': 0, 'verbose': True}
Checking...
2020-02-05 13:07:56,322 | INFO | `pip` executables found: ['/usr/bin/pip', '/usr/bin/pip3', '/usr/bin/pip2']
2020-02-05 13:07:56,322 | INFO | Using 4 jobs...
2020-02-05 13:07:56,356 | INFO | Fetching installed packages for /usr/bin/pip...
2020-02-05 13:07:56,356 | INFO | Fetching installed packages for /usr/bin/pip3...
2020-02-05 13:07:56,357 | INFO | Fetching installed packages for /usr/bin/pip2...
2020-02-05 13:07:56,358 | INFO | Executing command: /usr/bin/pip list --format json
2020-02-05 13:07:56,359 | INFO | Executing command: /usr/bin/pip3 list --format json
2020-02-05 13:07:56,359 | INFO | Executing command: /usr/bin/pip2 list --format json
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/home/pi/.local/lib/python3.7/site-packages/pipupgrade/commands/helper.py", line 309, in get_registry_from_pip
    format = "json", pip_exec = pip_path, output = True)
  File "/home/pi/.local/lib/python3.7/site-packages/pipupgrade/_pip.py", line 74, in call
    output = popen(*params, output = output, raise_err = raise_err)
  File "/home/pi/.local/lib/python3.7/site-packages/pipupgrade/util/system.py", line 79, in popen
    raise PopenError(code, command)
pipupgrade.exception.PopenError: Command '/usr/bin/pip3 list --format json' returned non-zero exit status 1.
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pi/.local/bin/pipupgrade", line 10, in <module>
    sys.exit(main())
  File "/home/pi/.local/lib/python3.7/site-packages/pipupgrade/cli/__init__.py", line 15, in wrapper
    return fn(**params)
  File "/home/pi/.local/lib/python3.7/site-packages/pipupgrade/commands/__init__.py", line 168, in command
    pip_path
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
pipupgrade.exception.PopenError: Command '/usr/bin/pip3 list --format json' returned non-zero exit status 1.

MemoryError

On MacOS this command pipupgrade -ly --no-cache-dir --pip-path pip throws following error:

Checking...
multiprocessing.pool.RemoteTraceback:
"""
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipupgrade/model/package.py", line 100, in __init__
    """ % self.name)
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipupgrade/db.py", line 49, in query
    cursor.execute(*args, **kwargs)
MemoryError
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipupgrade/commands/helper.py", line 310, in get_registry_from_pip
    build_dependency_tree = build_dependency_tree, jobs = jobs)
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipupgrade/model/registry.py", line 105, in __init__
    for package in pool.imap_unordered(partial(Package, **args), packages):
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
MemoryError
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/bin/pipupgrade", line 8, in <module>
    sys.exit(main())
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipupgrade/cli/__init__.py", line 15, in wrapper
    return fn(**params)
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pipupgrade/commands/__init__.py", line 156, in command
    pip_path
  File "/Users/michael-heuberger/.pyenv/versions/3.7.3/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
MemoryError

Using pipupgrade v1.6.6 here

Cannot upgrade packages on Mac OS 10.14.x

λ pipupgrade --interactive
Checking...
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/commands/helper.py", line 109, in get_registry_from_pip
    installed = True, sync = sync)
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/model/registry.py", line 13, in __init__
    for p in packages
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/model/registry.py", line 13, in <listcomp>
    for p in packages
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/model/package.py", line 87, in __init__
    self.latest_version = res["latest_version"]
TypeError: list indices must be integers or slices, not str
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/pipupgrade", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/cli/__init__.py", line 14, in wrapper
    return fn(**params)
  File "/usr/local/lib/python3.7/site-packages/pipupgrade/commands/__init__.py", line 118, in command
    pip_path
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
TypeError: list indices must be integers or slices, not str

I've tried removing the pip cache (rm -rf ~/Library/Caches/pip).

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.