Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompat with packaging==22.0 #121

Closed
tnh8 opened this issue May 25, 2023 · 5 comments
Closed

Incompat with packaging==22.0 #121

tnh8 opened this issue May 25, 2023 · 5 comments

Comments

@tnh8
Copy link

tnh8 commented May 25, 2023

Using:

$ johnnydep --version
johnnydep v1.20.0
pip --version
pip 23.1.2 from C:\Python37\lib\site-packages\pip (python 3.7)
$ python --version
Python 3.7.9

and

trying:

$ johnnydep robotframework-robocop

gives:

2023-05-25 05:51:43 [info     ] init johnnydist                [johnnydep.lib] dist=robotframework-robocop parent=None
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\johnnydep.exe\__main__.py", line 7, in <module>
  File "C:\Python37\lib\site-packages\johnnydep\cli.py", line 94, in main
    recurse=args.recurse,
  File "C:\Python37\lib\site-packages\johnnydep\lib.py", line 303, in serialise
    return tabulate.tabulate(table, headers="keys")
  File "C:\Python37\lib\site-packages\tabulate.py", line 1427, in tabulate
    tabular_data, headers, showindex=showindex
  File "C:\Python37\lib\site-packages\tabulate.py", line 1025, in _normalize_tabular_data
    rows = list(tabular_data)
  File "C:\Python37\lib\site-packages\johnnydep\lib.py", line 343, in gen_table
    for prefix, _fill, dist in anytree.RenderTree(johnnydist):
  File "C:\Python37\lib\site-packages\anytree\render.py", line 282, in __next
    children = node.children
  File "C:\Python37\lib\site-packages\johnnydep\lib.py", line 146, in children
    for dep in self.requires:
  File "C:\Python37\lib\site-packages\johnnydep\lib.py", line 125, in requires
    if req.marker.evaluate(dict(env_data, extra=extra)):
  File "C:\Python37\lib\site-packages\packaging\markers.py", line 241, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "C:\Python37\lib\site-packages\packaging\markers.py", line 150, in _evaluate_markers
    lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key)
  File "C:\Python37\lib\site-packages\packaging\markers.py", line 124, in _normalize
    return tuple(canonicalize_name(v) for v in values)
  File "C:\Python37\lib\site-packages\packaging\markers.py", line 124, in <genexpr>
    return tuple(canonicalize_name(v) for v in values)
  File "C:\Python37\lib\site-packages\packaging\utils.py", line 34, in canonicalize_name
    value = _canonicalize_regex.sub("-", name).lower()
TypeError: expected string or bytes-like object
@wimglenn
Copy link
Owner

I can not reproduce this on Linux. I thought it might be some weirdness about older Python on Windows, but I can not reproduce it there either:

(issue121) C:\Users\wglenn>python --version
Python 3.7.9

(issue121) C:\Users\wglenn>pip --version
pip 23.1.2 from C:\Users\wglenn\AppData\Local\miniconda3\envs\issue121\lib\site-packages\pip (python 3.7)

(issue121) C:\Users\wglenn>johnnydep --version
johnnydep v1.20.0

(issue121) C:\Users\wglenn>johnnydep robotframework-robocop -v0
name                        summary
--------------------------  ----------------------------------------------------------------------------------------
robotframework-robocop      Static code analysis tool (linter) for Robot Framework
├── jinja2<4.0,>=3.0        A very fast and expressive template engine.
│   └── MarkupSafe>=2.0     Safely add untrusted strings to HTML/XML markup.
├── pathspec<0.12,>=0.9     Utility library for gitignore style pattern matching of file paths.
├── python-dateutil>=2.8.2  Extensions to the standard Python datetime module
│   └── six>=1.5            Python 2 and 3 compatibility utilities
├── pytz>=2022.7            World timezone definitions, modern and historical
├── robotframework>=3.2.2   Generic automation framework for acceptance testing and robotic process automation (RPA)
└── tomli>=2.0.0            A lil' TOML parser

Can you make a reproducible example? What's different about your environment?

@wimglenn wimglenn added question Further information is requested awaiting response Needs more information labels May 25, 2023
@tnh8
Copy link
Author

tnh8 commented May 25, 2023

Seems like it is also affecting dependencies:

C:\Users\tnh8>johnnydep johnnydep
2023-05-25 19:01:32 [info     ] init johnnydist                [johnnydep.lib] dist=johnnydep parent=None
2023-05-25 19:01:34 [info     ] init johnnydist                [johnnydep.lib] dist=anytree parent=johnnydep
2023-05-25 19:01:35 [info     ] init johnnydist                [johnnydep.lib] dist=cachetools parent=johnnydep
2023-05-25 19:01:36 [info     ] init johnnydist                [johnnydep.lib] dist=colorama parent=johnnydep
2023-05-25 19:01:37 [info     ] init johnnydist                [johnnydep.lib] dist=importlib-metadata parent=johnnydep
2023-05-25 19:01:38 [info     ] init johnnydist                [johnnydep.lib] dist=oyaml parent=johnnydep
2023-05-25 19:01:40 [info     ] init johnnydist                [johnnydep.lib] dist=packaging>=17 parent=johnnydep
2023-05-25 19:01:41 [info     ] init johnnydist                [johnnydep.lib] dist=pip parent=johnnydep
2023-05-25 19:02:16 [info     ] init johnnydist                [johnnydep.lib] dist=structlog parent=johnnydep
2023-05-25 19:02:17 [info     ] init johnnydist                [johnnydep.lib] dist=tabulate parent=johnnydep
2023-05-25 19:02:18 [info     ] init johnnydist                [johnnydep.lib] dist=toml parent=johnnydep
2023-05-25 19:02:19 [info     ] init johnnydist                [johnnydep.lib] dist=wheel>=0.32.0 parent=johnnydep
2023-05-25 19:02:21 [info     ] init johnnydist                [johnnydep.lib] dist=wimpy parent=johnnydep
2023-05-25 19:02:22 [info     ] init johnnydist                [johnnydep.lib] dist=zipfile38 parent=johnnydep
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\johnnydep.exe\__main__.py", line 7, in <module>
  File "C:\Python37\lib\site-packages\johnnydep\cli.py", line 94, in main
    recurse=args.recurse,
  File "C:\Python37\lib\site-packages\johnnydep\lib.py", line 303, in serialise
    return tabulate.tabulate(table, headers="keys")
  File "C:\Python37\lib\site-packages\tabulate.py", line 1427, in tabulate
    tabular_data, headers, showindex=showindex
  File "C:\Python37\lib\site-packages\tabulate.py", line 1025, in _normalize_tabular_data
    rows = list(tabular_data)
  File "C:\Python37\lib\site-packages\johnnydep\lib.py", line 343, in gen_table
    for prefix, _fill, dist in anytree.RenderTree(johnnydist):
  File "C:\Python37\lib\site-packages\anytree\render.py", line 287, in __next
    for grandchild in self.__next(child, continues + (not is_last, ), level=level):
  File "C:\Python37\lib\site-packages\anytree\render.py", line 282, in __next
    children = node.children
  File "C:\Python37\lib\site-packages\johnnydep\lib.py", line 146, in children
    for dep in self.requires:
  File "C:\Python37\lib\site-packages\johnnydep\lib.py", line 125, in requires
    if req.marker.evaluate(dict(env_data, extra=extra)):
  File "C:\Python37\lib\site-packages\packaging\markers.py", line 241, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "C:\Python37\lib\site-packages\packaging\markers.py", line 150, in _evaluate_markers
    lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key)
  File "C:\Python37\lib\site-packages\packaging\markers.py", line 124, in _normalize
    return tuple(canonicalize_name(v) for v in values)
  File "C:\Python37\lib\site-packages\packaging\markers.py", line 124, in <genexpr>
    return tuple(canonicalize_name(v) for v in values)
  File "C:\Python37\lib\site-packages\packaging\utils.py", line 34, in canonicalize_name
    value = _canonicalize_regex.sub("-", name).lower()
TypeError: expected string or bytes-like object

It is on a windows environment with a few older python packages, maybe some of the dependencies are too old or conflicting?

C:\Users\tnh8>pip freeze
aenum==2.2.6
alabaster==0.7.12
anyio==3.6.2
anytree==2.8.0
arrow==1.2.1
asn1crypto==1.5.1
astroid==2.11.5
attrs==22.2.0
autopep8==1.5.7
Babel==2.9.0
bsdiff4==1.2.2
cachetools==5.3.0
cbor==1.0.0
cbor2==5.2.0
certifi==2020.12.5
certvalidator==0.11.1
cffi==1.14.4
chardet==4.0.0
charset-normalizer==3.0.1
click==8.1.3
colorama==0.4.4
configparser==5.3.0
cose==0.9.dev6
crcmod==1.7
cryptography==3.1.1
cycler==0.10.0
delayed-assert==0.3.6
dill==0.3.4
docopt==0.6.2
docutils==0.16
ecdsa==0.16.1
flake8==5.0.4
future==0.18.2
gitlint==0.17.0
gitlint-core==0.17.0
h11==0.12.0
hashin==0.17.0
httpcore==0.14.7
httpx==0.21.1
idna==2.10
imagesize==1.2.0
importlib-metadata==4.2.0
intelhex==2.2.1
isort==5.10.1
Jinja2==3.1.2
johnnydep==1.20.0
kiwisolver==1.2.0
lazy-object-proxy==1.7.1
liccheck==0.8.1
lxml==4.5.1
markdown-it-py==2.2.0
MarkupSafe==2.1.2
matplotlib==3.2.1
mccabe==0.7.0
mdurl==0.1.2
numpy==1.18.5
oscrypto==1.3.0
oyaml==1.0
packaging==22.0
pathspec==0.11.0
Pillow==7.1.2
pip-api==0.0.30
platformdirs==2.5.2
protobuf==3.20.0
psutil==5.9.4
pycodestyle==2.9.1
pycparser==2.20
pycryptodome==3.9.7
pyflakes==2.5.0
Pygments==2.14.0
PyJWT==2.1.0
pylint==2.13.9
pynrfjprog==10.16.0
pyparsing==2.4.7
Pypubsub==4.0.3
pyserial==3.4
python-dateutil==2.8.2
pytz==2022.7.1
pyupgrade==3.3.2
pyusb==1.0.2
pywin32==228
PyYAML==5.3.1
reportportal-client==5.2.5
requests==2.25.1
rfc3986==1.5.0
rich==13.3.2
rich-click==1.4
robotframework==6.0.2
robotframework-reportportal==5.2.1
robotframework-ride==2.0
robotframework-robocop==3.1.1
robotframework-tidy==4.2.1
semantic-version==2.10.0
singledispatchmethod==1.0
six==1.15.0
sniffio==1.3.0
snowballstemmer==2.0.0
Sphinx==3.4.3
sphinx-rtd-theme==0.5.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
sphinxemoji==0.1.8
structlog==23.1.0
style==1.1.0
tabulate==0.8.7
tokenize-rt==5.0.0
toml==0.10.2
tomli==2.0.1
typed-ast==1.5.3
typing_extensions==4.5.0
urllib3==1.26.2
vboxapi==1.0
wimpy==0.6
wrapt==1.14.1
wxPython==4.0.7.post2
yamllint==1.31.0
zipfile38==0.0.3
zipp==3.6.0

@wimglenn
Copy link
Owner

Yes, I think it is due to older packaging v22.0 dependency. Could you try with packaging >= 23 ?

@wimglenn wimglenn removed question Further information is requested awaiting response Needs more information labels May 25, 2023
@wimglenn wimglenn changed the title Handle packages with dash(-) in name Incompat with packaging==22.0 May 25, 2023
@tnh8
Copy link
Author

tnh8 commented May 25, 2023

Yes, installing packaging==23.0 solves both examples I have posted in this thread. Thanks!

Some dependency requirements update needed?

I am satisfied, feel free to close the issue.

@wimglenn
Copy link
Owner

Yes, root cause is pypa/packaging#638 fixed in packaging 23.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants