ruamel_yaml.constructor.ConstructorError: could not determine a constructor for the tag tag:yaml.org,2002:python/tuple in

ruamel_yaml.constructor.ConstructorError: could not determine a constructor for the tag tag:yaml.org,2002:python/tuple in

It seems that the environment.yml was written at a time when conda used yaml.load but it has since switched to yaml.safe_load:

1.1.1 (2019-03-22)

Remove yaml load warnings by using yaml.safe_load instead of yaml.load.
Fix NoneType object is not iterable error when includes is empty.

You can try to remove !!python/tuple (and also !!python/unicode, that doesnt do anything) from the environment.yml however it is unclear why it is there in the first place, it may give you another error.

What !!python/tuple does it that it instructs YAML to load the following sequence not as list, but as tuple. One reason why one would do that is when the loaded value will be used in a hashed data structure (dict or set), since tuples are hashable while lists arent. However that is usually done when the value is already used an a mapping within the YAML file, which is not the case here.

The reason why you get the error is because yaml.safe_load uses the safe loader, which does not, like the old „dangerous“ loader, call arbitrary constructors (as that is a security problem). Therefore, you cannot load tuples with it.

I ran into the same problem. Removing !!python/tuple and !!python/unicode does not necessarily fix the problem. Theres no need to run it in a conda environment. I pip installed all the packages that are listed in the top of ActivityNet/Crawler/Kinetics/download.py, downloaded ffmpeg using apt -y update && apt -y install ffmpeg, and ran python download.py ./data/kinetics-400_train.csv ./DirName and that worked for me (I also edited the code by adding os.remove(output_filename) in download.py when ffmpeg throws an error).

ruamel_yaml.constructor.ConstructorError: could not determine a constructor for the tag tag:yaml.org,2002:python/tuple in

Leave a Reply

Your email address will not be published.