Skip to content

Release 3.10.1 (macos/homebrew): ModuleNotFoundError: No module named 'yaml' #887

Closed

Description

@dgrebb

Description

Perhaps virtualenv dependency issue with python 3.12?

Fix

  1. brew tap-new $USER/local-commitizen
  2. brew tap homebrew/core
  3. brew extract --version=3.10.0 commitizen $USER/local-commitizen
  4. HOMEBREW_NO_AUTO_UPDATE=1 brew install $USER/local-commitizen/commitizen@3.10.0 (HOMEBREW_NO_AUTO_UPDATE is personal preference to be unset later)
  5. cz version -> 3.10.0
  6. :)

Steps to reproduce

  1. Install commitizen via homebrew brew install commitizen
  2. Run cz
  3. ModuleNotFoundError: No module named 'yaml'

Current behavior

❯ cz
Traceback (most recent call last):
  File "/opt/homebrew/bin/cz", line 5, in <module>
    from commitizen.cli import main
  File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/__init__.py", line 6, in <module>
    from commitizen.cz.base import BaseCommitizen
  File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/cz/__init__.py", line 10, in <module>
    from commitizen.cz.base import BaseCommitizen
  File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/cz/base.py", line 9, in <module>
    from commitizen.config.base_config import BaseConfig
  File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/config/__init__.py", line 10, in <module>
    from .yaml_config import YAMLConfig
  File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/config/yaml_config.py", line 5, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

Desired behavior

Standard functionality.

Screenshots

No response

Environment

Homebrew Health

(below warning ok as commitizen is no longer from origin)

❯ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some taps are not on the default git origin branch and may not receive
updates. If this is a surprise to you, check out the default branch with:
  git -C $(brew --repo dgrebb/local-commitizen) checkout

Homebrew Details

❯ brew config
HOMEBREW_VERSION: 4.1.15-36-gc0c8a4d
ORIGIN: https://github.com/Homebrew/brew
HEAD: c0c8a4dd4dd19ec16deb429abd50cdf82ea33b27
Last commit: 32 hours ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 16ffa0a31c87d9bdfab5aa8f3d9f031791c12cd6
Core tap last commit: 22 minutes ago
Core tap branch: master
Core tap JSON: 16 Oct 00:47 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.42.0 => /opt/homebrew/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 14.0-arm64
CLT: 15.0.0.0.1.1694021235
Xcode: 15.0
Rosetta 2: false

Python

❯ python3 -c "import platform; print(platform.system())"
Darwin

Mac Specifics

❯ system_profiler SPSoftwareDataType SPHardwareDataType
Software:

    System Software Overview:

      System Version: macOS 14.0 (23A344)
      Kernel Version: Darwin 23.0.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: 
      User Name: 
      Secure Virtual Memory: Enabled
      System Integrity Protection: Disabled
      Time since boot: 1 hour, 18 minutes

Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro18,4
      Model Number: 
      Chip: Apple M1 Max
      Total Number of Cores: 10 (8 performance and 2 efficiency)
      Memory: 64 GB
      System Firmware Version: 10151.1.1
      OS Loader Version: 10151.1.1

Activity

  1. dgrebb commented on Oct 16, 2023

    @dgrebb
    Author

    Thank you for a wonderful project and tool! Hope this helps, and happy to contribute to triage.

  2. self-assigned this
    on Oct 16, 2023
  3. woile commented on Oct 16, 2023

    @woile
    Member

    I'm gonna take a look 👀 💪🏻

  4. added a commit that references this issue on Oct 16, 2023
  5. davidg-datascene commented on Oct 16, 2023

    @davidg-datascene

    After installing pyyaml

    python3 -m pip install pyyaml

    cz version --report
    Traceback (most recent call last):
      File "/opt/homebrew/bin/cz", line 5, in <module>
        from commitizen.cli import main
      File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/cli.py", line 13, in <module>
        from commitizen import commands, config, out, version_schemes
      File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/commands/__init__.py", line 1, in <module>
        from .bump import Bump
      File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/commands/bump.py", line 9, in <module>
        from commitizen import bump, cmd, factory, git, hooks, out
      File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/bump.py", line 11, in <module>
        from commitizen.version_schemes import DEFAULT_SCHEME, Version, VersionScheme
      File "/opt/homebrew/Cellar/commitizen/3.10.1/libexec/lib/python3.12/site-packages/commitizen/version_schemes.py", line 10, in <module>
        from packaging.version import InvalidVersion  # noqa: F401: Rexpose the common exception
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ModuleNotFoundError: No module named 'packaging'
  6. woile commented on Oct 16, 2023

    @woile
    Member

    Did you also have the same error? Did you both try to uninstall and install again?

  7. michaeltinsley commented on Oct 16, 2023

    @michaeltinsley

    I've got this working by running brew reinstall $(brew deps commitizen) commitizen to reinstall the dependencies

  8. davidg-datascene commented on Oct 16, 2023

    @davidg-datascene

    Did you also have the same error? Did you both try to uninstall and install again?

    Yep. But this has worked for me to reinstall the dependencies - thanks

    brew reinstall $(brew deps commitizen) commitizen
  9. pinned this issue on Oct 16, 2023
  10. added a commit that references this issue on Oct 17, 2023
  11. shaun-mills commented on Nov 8, 2023

    @shaun-mills

    I had the same problem with commitizen 3.12.0 after a brew upgrade

    cz commit              
    Traceback (most recent call last):
      File "/usr/local/bin/cz", line 5, in <module>
        from commitizen.cli import main
      File "/usr/local/Cellar/commitizen/3.12.0/libexec/lib/python3.12/site-packages/commitizen/__init__.py", line 6, in <module>
        from commitizen.cz.base import BaseCommitizen
      File "/usr/local/Cellar/commitizen/3.12.0/libexec/lib/python3.12/site-packages/commitizen/cz/__init__.py", line 10, in <module>
        from commitizen.cz.base import BaseCommitizen
      File "/usr/local/Cellar/commitizen/3.12.0/libexec/lib/python3.12/site-packages/commitizen/cz/base.py", line 10, in <module>
        from commitizen.config.base_config import BaseConfig
      File "/usr/local/Cellar/commitizen/3.12.0/libexec/lib/python3.12/site-packages/commitizen/config/__init__.py", line 10, in <module>
        from .yaml_config import YAMLConfig
      File "/usr/local/Cellar/commitizen/3.12.0/libexec/lib/python3.12/site-packages/commitizen/config/yaml_config.py", line 5, in <module>
        import yaml
    ModuleNotFoundError: No module named 'yaml'
    

    Resolution

    #887 (comment)

    I've got this working by running brew reinstall $(brew deps commitizen) commitizen to reinstall the dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions