Python 3.7
> yaml --help Traceback (most recent call last): File "f:\portableapps\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "f:\portableapps\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "F:\PortableApps\Python\Scripts\yaml.exe\__main__.py", line 5, in <module> File "f:\portableapps\python\lib\site-packages\ruamel\yaml\cmd\__main__.py", line 17, in <module> from .yaml_cmd import YAMLCommand File "f:\portableapps\python\lib\site-packages\ruamel\yaml\cmd\yaml_cmd.py", line 17, in <module> from ruamel.yaml import YAML ImportError: cannot import name 'YAML' from 'ruamel.yaml' (f:\portableapps\python\lib\site-packages\ruamel\yaml\__init__.py)
(originally posted on 2018-10-14 at 10:08:14 by Thorsten Kampe <thorstenkampe@bitbucket>)
How did you install ruamel.yaml.cmd? Which version is this? If you install using
pip
it will install/upgraderuamel.yaml
to version 0.15.72 (https://bitbucket.org/ruamel/yaml.cmd/src/6750e051d2f24dffc97e1e9192928268b536d79a/init.py#lines-19)(originally posted on 2018-10-14 at 10:36:58)
This is not a yaml.cmd issue but a yaml issue. I tested it on Linux going back to 1.4.12 and Python 2.7: all show the same error.
(originally posted on 2018-10-14 at 10:54:25 by Thorsten Kampe <thorstenkampe@bitbucket>)
The Ubuntu package (python3-ruamel.yaml) works. I'm trying to figure out the difference between the pip version and the apt-get package.
(originally posted on 2018-10-14 at 10:57:32 by Thorsten Kampe <thorstenkampe@bitbucket>)
Older versions of ruamel.yaml ( < 0.15 ) don't have
YAML
imported intoruamel.yaml.__init__.py
, soruamel.yaml.cmd
cannot find that. That is why I asked for the version, but I realise it was not clear that I needed theruamel.yaml
version number on your windows installation, not theruamel.yaml.cmd
version. You are not using anaconda do you (their stuff is broken).(originally posted on 2018-10-14 at 11:04:12)
it looks like yaml.cmd pulls in the wrong(?) dependencies:
(originally posted on 2018-10-14 at 11:23:47 by Thorsten Kampe <thorstenkampe@bitbucket>)
it actually is a problem with yaml.cmd. Uninstalling yaml.cmd removes the yaml error:
(originally posted on 2018-10-14 at 11:30:10 by Thorsten Kampe <thorstenkampe@bitbucket>)
The issue is the .pth file for yaml.cmd:
(originally posted on 2018-10-14 at 11:34:27 by Thorsten Kampe <thorstenkampe@bitbucket>)
.Confirmed on Windows: after removing the pth file for yaml.cmd, I can run "from ruamel.yaml import YAML" again. But yaml(.exe) still doesn't work because of the missing pth file. Why are those even needed?! The only other package on my machine that uses a pth file is pywin32.
(originally posted on 2018-10-14 at 11:41:39 by Thorsten Kampe <thorstenkampe@bitbucket>)
It looks like pip/distutils/setuptools once more screw up installing and handling namespace packages properly. If you install ruamel.yaml separately things work fine. If you remove the
ruamel.yaml.cmd-0.5.0*
info fromsite-packages
things work so that metadata interferes in some way.(originally posted on 2018-10-14 at 11:42:25)
Those .pth files extend the paths from which python imports, which is only important if you install next to each other.
(originally posted on 2018-10-14 at 11:45:35)
I uploaded a new version of ruamel.yaml.cmd (0.5.1), can you try that one, and if that works close this issue?
(originally posted on 2018-10-14 at 12:38:36)
After upgrading to 0.5.1:
(originally posted on 2018-10-14 at 13:11:06 by Thorsten Kampe <thorstenkampe@bitbucket>)
Sorry for that, I had only tested with
yaml -h
. 0.5.3 should now have that fixed (and tox based testing works as well again)(originally posted on 2018-10-15 at 05:31:02)
(originally posted on 2018-10-15 at 06:34:31)