I'm unable to package ruamel.yaml using PyInstaller.
I've used the following simple test case:
from ruamel.yaml import YAML
parser = YAML(typ="safe", pure=True)
print(parser.load("17"))
This works fine when run normally, but produces this exception after being packaged with PyInstaller:
ImportError: cannot import name 'YAML' from 'ruamel.yaml' (/tmp/_MEIsScRyt/ruamel/yaml/__init__.pyc)
I can partially work around this problem by referring to YAML as ruamel.yaml.main.YAML, but various properties are referred to via ruamel.yaml inside the library, and I can't change those.
How can I ensure PyInstaller correctly packages the entire ruamel.yaml package?
I'm using the latest PyInstaller version as installed via pip3, 4.2.dev0.
If you can refer to
ruamel.yaml.main.YAMLbut not toruamel.yaml.YAMLit looks like pyinstaller doesn't correctly installruamel.yaml's__init__.pyas that does:You should check to see if that file is available under subdir
ruamel/yaml.In general you should compare the file hierarchy that PyInstaller produces/stores with the the result of how `ruamel.yaml should be installed, as specified in the documentation:
There are some corrections in the
setup.pyof allruamel.*andruamel.*.*packages to deal with correctly installing these nested namespaced packages. This however is only adjusted for, and tested using,pip. Installers that are not 100% compatible withpipmight make assumptions that are not valid and fail to install correctly.