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

[Bug]: ModuleNotFoundError: No module named 'yaml' when hier_config==3.0.0 #304

Open
1 task done
jpkrajewski opened this issue Nov 21, 2024 · 1 comment
Open
1 task done
Assignees
Labels
dependency-problem This issue seems to be in a ciscoconfparse dependency difficulty-easy

Comments

@jpkrajewski
Copy link

Contact Details

[email protected]

What happened?

The package hier-config==3.0.0 does not include the yaml module as part of its dependencies. Therefore, the responsibility for installing PyYAML (the package providing the yaml module) lies with ciscoconfparse, which should declare it as a dependency and ensure it gets installed automatically.

from ciscoconfparse import CiscoConfParse
Traceback (most recent call last):
  File "/home/jakub/private/test/main.py", line 1, in <module>
    from ciscoconfparse import CiscoConfParse
  File "/home/jakub/private/test/.venv/lib/python3.11/site-packages/ciscoconfparse/__init__.py", line 30, in <module>
    from ciscoconfparse.ciscoconfparse import *
  File "/home/jakub/private/test/.venv/lib/python3.11/site-packages/ciscoconfparse/ciscoconfparse.py", line 48, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

CiscoConfParse Version

1.9.51

What Operating System are you using?

Linux - Debian, Ubuntu, CentOS, RHEL or others

What Python version(s) have this problem?

Python 3.10, Other (please specify)

Show us how to reproduce the problem. Please tell us if the problem is specific to certain inputs or situations.

pip install ciscoconfparse

Python tracebacks

Traceback (most recent call last):
  File "/home/jakub/private/test/main.py", line 1, in <module>
    from ciscoconfparse import CiscoConfParse
  File "/home/jakub/private/test/.venv/lib/python3.11/site-packages/ciscoconfparse/__init__.py", line 30, in <module>
    from ciscoconfparse.ciscoconfparse import *
  File "/home/jakub/private/test/.venv/lib/python3.11/site-packages/ciscoconfparse/ciscoconfparse.py", line 48, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

Relevant log output

Package           Version
----------------- -------
annotated-types   0.7.0
ciscoconfparse    1.9.51
Deprecated        1.2.15
dnspython         2.7.0
hier-config       3.0.0
loguru            0.7.2
passlib           1.7.4
pip               24.0
pydantic          2.10.0
pydantic_core     2.27.0
setuptools        65.5.0
toml              0.10.2
typing_extensions 4.12.2
wrapt             1.16.0

Code of Conduct

@mpenning
Copy link
Owner

mpenning commented Nov 21, 2024

This happened because I mistakenly assumed that hier_config==2.2.3 would keep using PyYAML, but they didn't starting in version 3.0.0.

Fix:

  • Use ciscoconfparse==1.9.52

Workaround for ciscoconfparse < 1.9.52:

  • manually install PyYAML or hier_config==2.2.3
  • then pip install ciscoconfparse.

If your package depends on ciscoconfparse < 1.9.52, you'll have to manually declare PyYAML or hier_config==2.2.3 in your dependencies.

NOTE ciscoconfparse is end of life; it will get no more releases.

@mpenning mpenning added dependency-problem This issue seems to be in a ciscoconfparse dependency difficulty-easy and removed bug labels Nov 21, 2024
@mpenning mpenning self-assigned this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency-problem This issue seems to be in a ciscoconfparse dependency difficulty-easy
Projects
None yet
Development

No branches or pull requests

2 participants