Drf-yasg: Issue with ruamel.yaml

Created on 26 Jul 2019  路  4Comments  路  Source: axnsan12/drf-yasg

Getting an issue when trying to build my dockerfile

The error is as follows

 from drf_yasg.views import get_schema_view
  File "/usr/local/lib/python3.7/site-packages/drf_yasg/views.py", line 14, in <module>
    from .renderers import (
  File "/usr/local/lib/python3.7/site-packages/drf_yasg/renderers.py", line 11, in <module>
    from .codecs import VALIDATORS, OpenAPICodecJson, OpenAPICodecYaml
  File "/usr/local/lib/python3.7/site-packages/drf_yasg/codecs.py", line 133, in <module>
    class SaneYamlDumper(yaml.SafeDumper):
AttributeError: module 'ruamel.yaml' has no attribute 'SafeDumper'

I think this could be because the ruamel.yaml library updated yesterday to 0.16.0

I hardcoded the ruamel.yaml dependency to be ruamel.yaml==0.15.X and then my docker container proceeded to build correctly.

I think a fix for now could be updating your base.txt to:
ruamel.yaml>=0.15.34,<0.16.0

Most helpful comment

I'm continuing to see this issue after adding that requrement to my environment. I currently have

ruamel.yaml==0.15.100
ruamel.yaml.clib==0.1.0

Is there any other recommended temporary fix for this?

All 4 comments

Yeah, the reason was as supposed. Thanks a lot!

I'm continuing to see this issue after adding that requrement to my environment. I currently have

ruamel.yaml==0.15.100
ruamel.yaml.clib==0.1.0

Is there any other recommended temporary fix for this?

I also stumbled upon this error.
Removing the python image from docker and rebuilding the container solved the problem.
I've checked the installed packages inside django container and it is working with ruamel.yaml==0.16.0

Seems to have been fixed in later versions of ruamel.yaml (0.16.5 works)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gertjanol picture gertjanol  路  5Comments

agethecoolguy picture agethecoolguy  路  4Comments

marcosgeorgopoulos picture marcosgeorgopoulos  路  4Comments

therefromhere picture therefromhere  路  3Comments

beaugunderson picture beaugunderson  路  5Comments