setuptools: [BUG] KeyError: 'unix_user' with setuptools 60.0.0

setuptools version

setuptools-60.0.0

Python version

Python 3.9

OS

Ubuntu 18.04

Additional environment information

No response

Description

Getting this error with setuptools 60.0.0

Traceback (most recent call last): File “<string>”, line 1, in <module> File “/tmpfs/src/github/jax/setup.py”, line 31, in <module> setup( File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/init.py”, line 153, in setup return distutils.core.setup(**attrs) File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/core.py”, line 148, in setup return run_commands(dist) File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/core.py”, line 163, in run_commands dist.run_commands() File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/dist.py”, line 967, in run_commands self.run_command(cmd) File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/dist.py”, line 985, in run_command cmd_obj.ensure_finalized() File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py”, line 107, in ensure_finalized self.finalize_options() File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/command/develop.py”, line 52, in finalize_options easy_install.finalize_options(self) File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/command/easy_install.py”, line 263, in finalize_options self._fix_install_dir_for_user_site() File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/command/easy_install.py”, line 375, in _fix_install_dir_for_user_site self.select_scheme(scheme_name) File “/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/command/easy_install.py”, line 716, in select_scheme scheme = INSTALL_SCHEMES[name] KeyError: ‘unix_user’ ---------------------------------------- ERROR: Command errored out with exit status 1: /usr/local/bin/python3.9 -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmpfs/src/github/jax/setup.py’“'”‘; file=’“'”‘/tmpfs/src/github/jax/setup.py’“'”‘;f = getattr(tokenize, ‘"’“‘open’”’“‘, open)(file) if os.path.exists(file) else io.StringIO(’”‘“‘from setuptools import setup; setup()’”’“‘);code = f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ develop --no-deps --user --prefix= Check the logs for full command output.

Expected behavior

The Error should not happen. It was working fine with setuptools 59.8.0

How to Reproduce

  1. git clone https://github.com/google/jax.git
  2. cd jax
  3. python3.9 -m pip install -e .

Make sure the setuptools version in 60.0.0

Output

Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmpfs/src/github/jax/setup.py", line 31, in <module>
        setup(
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup
        return run_commands(dist)
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
        dist.run_commands()
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
        self.run_command(cmd)
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 985, in run_command
        cmd_obj.ensure_finalized()
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/command/develop.py", line 52, in finalize_options
        easy_install.finalize_options(self)
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 263, in finalize_options
        self._fix_install_dir_for_user_site()
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 375, in _fix_install_dir_for_user_site
        self.select_scheme(scheme_name)
      File "/home/kbuilder/.local/lib/python3.9/site-packages/setuptools/command/easy_install.py", line 716, in select_scheme
        scheme = INSTALL_SCHEMES[name]
    KeyError: 'unix_user'
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmpfs/src/github/jax/setup.py'"'"'; __file__='"'"'/tmpfs/src/github/jax/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output.

Code of Conduct

  • I agree to follow the PSF Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I still have this problem on Ubuntu 22.04 with Python 3.10 and setuptools 63.2.0 installed. Is that normal?

Edit: I tried a lot of different versions of setuptools: 59,60,61,63 and none works. It works when using python3 setup.py develop --user instead of python3 -m pip install --user --editable.

Note that I also have to use the site.ENABLE_USER_SITE = "--user" in sys.argv[1:] workaround described in this pip issue. It seems to me like installing a development version becomes increasingly impossible.

Obtaining file:///projects/ratarmount/worktrees/1/core
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Installing collected packages: ratarmountcore
  Running setup.py develop for ratarmountcore
    error: subprocess-exited-with-error
    
    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [29 lines of output]
        running develop
        /usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
          warnings.warn(
        Traceback (most recent call last):
          File "<string>", line 2, in <module>
          File "<pip-setuptools-caller>", line 34, in <module>
          File "/projects/ratarmount/worktrees/1/core/setup.py", line 11, in <module>
            setup()
          File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
            return distutils.core.setup(**attrs)
          File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 148, in setup
            return run_commands(dist)
          File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 163, in run_commands
            dist.run_commands()
          File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 967, in run_commands
            self.run_command(cmd)
          File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 985, in run_command
            cmd_obj.ensure_finalized()
          File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
            self.finalize_options()
          File "/usr/lib/python3/dist-packages/setuptools/command/develop.py", line 52, in finalize_options
            easy_install.finalize_options(self)
          File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 270, in finalize_options
            self._fix_install_dir_for_user_site()
          File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 400, in _fix_install_dir_for_user_site
            self.select_scheme(scheme_name)
          File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 741, in select_scheme
            scheme = INSTALL_SCHEMES[name]
        KeyError: 'unix_user'
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [29 lines of output]
    running develop
    /usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "/projects/ratarmount/worktrees/1/core/setup.py", line 11, in <module>
        setup()
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 148, in setup
        return run_commands(dist)
      File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 163, in run_commands
        dist.run_commands()
      File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 967, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 985, in run_command
        cmd_obj.ensure_finalized()
      File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/usr/lib/python3/dist-packages/setuptools/command/develop.py", line 52, in finalize_options
        easy_install.finalize_options(self)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 270, in finalize_options
        self._fix_install_dir_for_user_site()
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 400, in _fix_install_dir_for_user_site
        self.select_scheme(scheme_name)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 741, in select_scheme
        scheme = INSTALL_SCHEMES[name]
    KeyError: 'unix_user'
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.