pip 24.1.1 doesn't like console
when I update pip to 24.1.1 it doesn't like console anymore.
WARNING: Error parsing dependencies of console: Invalid version: 'Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000'
pip says this is a valid warning
and you can no longer install console
#pip install console
Collecting console
Using cached console-0.9907-py2.py3-none-any.whl.metadata (17 kB)
ERROR: Exception:
...
raise InvalidVersion(f"Invalid version: '{version}'")
pip._vendor.packaging.version.InvalidVersion: Invalid version: 'Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000'
(copied for convenience.)
Believe the error it's coming from this in setup.py:
install_requires = (
'colorama; os_name == "nt" and platform_version < "10.0.10586" ',
)
- I checked on Win/Lin/Mac and only on Windows does
platform.version()return a version-like string. I think that's the root issue. A broken or at least inconsistentplatform.version()result. Other available environment selectors are not sufficient to do this job.
(The job being to install colorama if using an older Windows 10 that doesn't support ANSI escape chars.)
-
This environment selector selects
os_name == "nt"first, so on non-NT environments it should finish there and not go on. This is standard boolean logic, if it needs to run both tests when not necessary that's another bug/enhancement to be done. -
Your pip/setuptools version parser can't handle real world output from platform.version. Setuptools shouldn't be strict here until platform or selectors can be fixed/redesigned.
I can remove this check, but it used to work. So in my opinion is a regression on their side.
Is there any update on this issue? I've had to essentially just copy all of the scripts from this package into almost all of my projects until now.
@SomeGuyNamedJJ ... there's nothing to update here unfortunately. It is their bug, as far as I can tell.
If you don't use Windows you can clone the repo and comment this line here:
https://github.com/mixmastamyk/console/blob/master/setup.py#L17
Then pip install . or run setup.py. Or you could downgrade pip until they fix it.
This is the root issue I think:
https://github.com/pypa/packaging/issues/774
@mixmastamyk I did try to do what you suggested a while ago, but just running setup.py caused some wierd behavior where the entire thing just moved itself into a subfolder, but I had no idea that you could use pip to install from somewhere locally, I will try that, but obviously it is not a permanent fix.
Edit: As for downgrading pip, there's no point in me doing that, as I use Arch, so pretty much everything gets updated at once, and I'd have to specifically add an exception for pip every time I update (typically weekly)
I commented at the issue linked above and it seems to have started a snowball of discussion. Maybe they will fix it?
Pip can manage itself, might be better to let it. However distros often let you pin an old version. Whichever way is best for you.
I confirm - I tried (just now, because of issues due to PEP 668) pipx. The console package evidently makes it crash
File "/home/user/.local/pipx/shared/lib/python3.10/site-packages/pip/_vendor/packaging/version.py", line 202, in __init__
raise InvalidVersion(f"Invalid version: {version!r}")
pip._vendor.packaging.version.InvalidVersion: Invalid version: '#40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2'
'/home/user/.local/pipx/venvs/spesh/bin/python -m pip install --pre --upgrade spesh -q' failed
Thank you for looking at this topic, I like console very much
May be something with PEP440 numbering? Or metadata in setup.py?
The issue is that they broke pip (as described above) and aren't inclined to fix it. There are some fiddly work arounds above but I recently found a better one—move to uv/uvx. It really works, and its developers are responsive:
https://docs.astral.sh/uv/
(Not mentioned there but it is also installable via dnf in Fedora)
⏵ uv init new
Initialized project `new` at `.../new`
⏵ cd new/
⏵ uv add console
Using CPython 3.13.2 interpreter at: /usr/bin/python3.13
Creating virtual environment at: .venv
Resolved 6 packages in 126ms
Installed 2 packages in 3ms
+ console==0.9911
+ ezenv==0.92
⏵ source .venv/bin/activate.fish
(new) ⏵ python
Python 3.13.2 (...) on linux
>>> from console import fg, bg, fx
>>> print(fg.green('hello world'))
hello world # green
not pointing fingers here but a year+ later this is still broken. I recognize where the source of the problem is (PIP) but dismissing it as the predominant python package installer feels a smidge short sighted to me.
ya know what they say about everyone having an opinion... wanted or not you now have mine.
Got it. I gave up on pypa a while ago, moved to uv, and have been very happy with it.
It's not clear to me how many people use this library besides myself since I've never advertised it. Do many people want to use it with pip? Not able to upgrade to uv, for various reasons?
here's your audience: https://pypistats.org/packages/console
I am but one :)
My own usage is for an unreleased console driven test app I use as a test harness for a library I maintain.... and it's limited to a single function wait_key
while True:
key = wait_key()
if key == "\x1b":
special = True
continue
if special:
if key == "[": continue
if key == "C": # right arrow
print("\rmove right\r")
if key == "D": # left arrow
print("\rmove left\r")
special = False
continue
if not special and key == "\r":
print("\r")
if key == "?":
print("\r\nCommands:\r\n")
print(" ? = this list\r")
print(" b = bed target temperature\r")
print(" c = chamber target temperature\r")
print(" d = dump printer json object\r")
print(" g = send gcode command\r")
print(" f = fan speed (in percent)\r")
print(" l = toggle light\r")
print(" o = print options\r")
print(" p = print 3MF file\r")
print(" q = quit\r")
print(" Q = restart without exiting")
print(" r = request full data refresh\r")
print(" s = change filament / spool\r")
print(" S = change speed (1 to 4)\r")
print(" t = tool target temperature\r")
print(" u = unload filament / spool\r")
print(" v = toggle verbose reporting\r")
print(" w = wifi signal strength\r")
print(" X = extrustion calibration\r")
print(" x = set extrustion calibration results\r")
print(" ! = abort job\r")
print(" ~ = toggle subscription\n\r")
so bringing in a completely different package installer breaks my workflow. Right now I'm froze on pip 24.1 hoping this magically gets fixed.
you can further get a feel for pip vs uv too
https://pypistats.org/packages/pip https://pypistats.org/packages/uv
pip leads by about 6 to 1 usage wise.
I'll be quiet now. appreciate the convenience of the package you provide regardless.
Hmm, wonder how many of those downloading console are bots?
Also, I get uv from my linux distribution and some use cargo/rustup etc. Some might get pip from distros as well. So not sure how accurate that proportion of downloads is.
Interestingly this is on HN today:
I guess I could disable the environment marker in setup now that Windows 10 is going EOL. By another coincidence that happens tomorrow. Maybe the universe is trying to tell me something.
(To be honest this is not the outcome I expected, that pypa would break pip and then just sit there and do nothing for over a year/indefinitely.)
I use macOS as my development ABI / runtime.
one would think pypi would be pretty legit stats wise. bots are probably in the low hundreds per month but I ack it is possibly proportional to the popularity of the library.
I'm also going to take a leap here and assume CI is Continuous Integration -- aka enterprise / non consumer / non human driven builds. I'd be just as curious to understand better how they determined uv was "winning" lol as CI is managed by a large range of tools / solutions / integrations.
I 100% agree about the pip situation. It has historically been frustrating for a lot of different groups.
should mention I am also heavily invested in pyenv and virtualenvwrapper
I made an update to remove the marker and pushed a prerelease build. To install it use something like:
pip install -U --pre console
Would like to know if it works for you.
Bueller?
will take a look... was not expecting immediate relief!!! woohoo !!!
worked like a charm
(bpm) shell@shells-16mbp ~ % python -m pip install --upgrade pip
Requirement already satisfied: pip in ./.virtualenvs/bpm/lib/python3.12/site-packages (24.0)
Collecting pip
Downloading pip-25.2-py3-none-any.whl.metadata (4.7 kB)
Downloading pip-25.2-py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 9.1 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 24.0
Uninstalling pip-24.0:
Successfully uninstalled pip-24.0
Successfully installed pip-25.2
(bpm) shell@shells-16mbp ~ % pip install -U --pre console
Collecting console
Downloading console-0.9912b1-py3-none-any.whl.metadata (18 kB)
Requirement already satisfied: ezenv>=0.92 in ./.virtualenvs/bpm/lib/python3.12/site-packages (from console) (0.92)
Downloading console-0.9912b1-py3-none-any.whl (96 kB)
Installing collected packages: console
Successfully installed console-0.9912b1
(bpm) shell@shells-16mbp ~ % GitHub/bambu-mqtt/bambu-mqtt.py
Model #: A1
restoring chamber target to [0.0]
printer firmware: [] serial #: [xxx]
ams firmware: []
tool=[23.8/0.0] bed=[22.3/0.0] chamber=[24.7/0.0] fan=[0] print=[FINISH] speed=[2] light=[off]
stg_cur=[] file=[] layers=[231] layer=[231] %=[100] eta=[0 min] spool=[255 (Unloaded)]
buildplate_marker_detector=[True]
printer firmware: [01.05.00.00] serial #: [xxx]
ams firmware: [00.00.07.94]
tool=[23.8/0.0] bed=[22.3/0.0] chamber=[24.7/0.0] fan=[0] print=[FINISH] speed=[2] light=[off]
stg_cur=[] file=[] layers=[231] layer=[231] %=[100] eta=[0 min] spool=[255 (Unloaded)]
buildplate_marker_detector=[True]
Commands:
? = this list
b = bed target temperature
c = chamber target temperature
d = dump printer json object
g = send gcode command
f = fan speed (in percent)
l = toggle light
o = print options
p = print 3MF file
q = quit
Q = restart without exiting
r = request full data refresh
s = change filament / spool
S = change speed (1 to 4)
t = tool target temperature
u = unload filament / spool
v = toggle verbose reporting
w = wifi signal strength
X = extrustion calibration
x = set extrustion calibration results
! = abort job
~ = toggle subscription
P = toggle buildplate_marker_detector
Ok, well with Windows 10 EOL there is no reason for the colorama package any longer. So might as well remove it. The irony is that line only broke it on Linux. I'll have a regular release out soon.
Fixed with console version 0.9912.