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

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

Closed
dgrebb opened this issue Oct 16, 2023 · 7 comments
Closed
Assignees

Comments

@dgrebb
Copy link
Sponsor

dgrebb commented Oct 16, 2023

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
@dgrebb
Copy link
Sponsor Author

dgrebb commented Oct 16, 2023

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

@woile woile self-assigned this Oct 16, 2023
@woile
Copy link
Member

woile commented Oct 16, 2023

I'm gonna take a look 👀 💪🏻

woile added a commit that referenced this issue Oct 16, 2023
@davidg-datascene
Copy link

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'

@woile
Copy link
Member

woile commented Oct 16, 2023

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

@michaeltinsley
Copy link

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

@davidg-datascene
Copy link

davidg-datascene commented Oct 16, 2023

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

@woile woile pinned this issue Oct 16, 2023
Lee-W pushed a commit that referenced this issue Oct 17, 2023
@shaun-mills
Copy link

shaun-mills commented Nov 8, 2023

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

@woile woile closed this as completed Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants