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

AttributeError: module 'yaml' has no attribute 'CDumper' #8

Open
zardini123 opened this issue Aug 14, 2020 · 6 comments
Open

AttributeError: module 'yaml' has no attribute 'CDumper' #8

zardini123 opened this issue Aug 14, 2020 · 6 comments
Labels
good first issue Good for newcomers

Comments

@zardini123
Copy link

I am trying to use aamp_to_yml on macOS 10.14 and I got this error:

Traceback (most recent call last):
  File "/usr/local/bin/aamp_to_yml", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/aamp/__main__.py", line 40, in main
    do_aamp_to_yml(input_data, output)
  File "/usr/local/lib/python3.8/site-packages/aamp/__main__.py", line 13, in do_aamp_to_yml
    output.write(aamp.converters.aamp_to_yml(input_data))
  File "/usr/local/lib/python3.8/site-packages/aamp/converters.py", line 9, in aamp_to_yml
    dumper = yaml.CDumper
AttributeError: module 'yaml' has no attribute 'CDumper'
@leoetlino
Copy link
Member

It looks like PyYAML's C module is not available on your system... You may need to install libyaml (via homebrew, maybe?) and then reinstall the PyYAML package to make pip compile and install the C module

@zardini123
Copy link
Author

I installed libyaml via brew, uninstalled pyyaml, reinstalled pyyaml, and its still happening. Thoughts?

@leoetlino
Copy link
Member

Try

LDFLAGS="-L$(brew --prefix)/lib" \
  CFLAGS="-I$(brew --prefix)/include" \
  pip3 install --global-option="--with-libyaml" --force pyyaml

@zardini123
Copy link
Author

zardini123 commented Aug 17, 2020

Perfection. I would really appreciate it if you put this information in the readme for future users. Thanks!

(Or, is there some way to get the library to link without this reinstall?)

@leoetlino leoetlino added the good first issue Good for newcomers label Aug 17, 2020
@tallywiesenberg
Copy link

Hey crew, I've actually run into this same problem on my own project. Two questions:

  • @zardini123 did you encounter this error on an m1 Mac with ARM architecture? I am on an m1 mac and I ran into this bug.
  • @leoetlino Has anyone found a cleaner workaround since? I am looking to provide a workaround for m1 mac users in my documentation.

Thanks!

@leoetlino
Copy link
Member

Have you tested PyYAML 5.4.1 (which is currently the latest version)? If 5.4.1 still isn't built with libyaml then you'll need to ask the PyYAML packagers or maintainers to release binary wheels for macOS with libyaml enabled.

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

No branches or pull requests

3 participants