Pyyaml: Can't install PyYAML with pip if setuptools isn't installed

Created on 24 Sep 2020  路  8Comments  路  Source: yaml/pyyaml

Trying to install PyYAML using pip when setuptools isn't installed results in this:

# python3 -mpip install --user pyyaml
Collecting pyyaml
  Using cached PyYAML-5.3.1.tar.gz (269 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4gsyi4k8/pyyaml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4gsyi4k8/pyyaml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-p9iajmh9
         cwd: /tmp/pip-install-4gsyi4k8/pyyaml/
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Ideally, PyYAML should include a pyproject.toml file declaring build-time dependencies, so that pip can fetch them automatically.

Most helpful comment

I suppose a pyproject.toml file could be added, but why not just install setuptools?

You could say that about any dependency. 馃し Ideally, every project should fetch all of its own dependencies automatically.

All 8 comments

I suppose a pyproject.toml file could be added, but why not just install setuptools?

I suppose a pyproject.toml file could be added, but why not just install setuptools?

You could say that about any dependency. 馃し Ideally, every project should fetch all of its own dependencies automatically.

Most of my projects internally rely on setuptools. Do you have an example pyproject.toml file you could show me?

The 5.4 release will include some packaging updates that start to clean up the distutils/setuptools mess, but due to the age of the Pythons/pips we still support, we can't wholesale switch to a PEP517 (pyproject.toml) build yet. Maybe in 6.0, depending on what Pythons we drop support for, but that's still TBD.

FWIW, you could still include a pyproject.toml, and old pip versions will just ignore it. But that will increase the amount of configurations that need to be tested, so I understand if you don't want to do it.

@nitzmahone what's the alternative to https://github.com/yaml/pyyaml/blob/release/5.4/pyproject.toml for the 5.4 release.

I'd like to at least delay add this file until we have a more comprehensive need for it.

Addressed in #407

I tested it with PyYAML 5.4b2, and it works. Thanks for the fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phihag picture phihag  路  6Comments

sigmavirus24 picture sigmavirus24  路  8Comments

graingert picture graingert  路  7Comments

coldfix picture coldfix  路  8Comments

lucj picture lucj  路  7Comments