-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] KeyError: 'unix_user' with setuptools 60.0.0 #2938
Comments
I’ll explore this soon. I suspect the issue is that there is some gap in how the install schemes are resolved on your platform. The quick fix will be to pin to Setuptools <60 or set SETUPTOOLS_USE_DISTUTILS=stdlib as a workaround in the interim. |
I see that the issue is due to |
As a reminder, Edit: I also recognize now that no-one has invoked |
I've been unsuccessful triggering the issue in a virtualenv. It seems the issue is related to the implicit I was able to trigger the issue thus:
|
Fix released as 60.0.1. Please test and report back. |
I'm still showing the bug up here after |
Confirmed. I can replicate the issue on Python 3.9.
Although I'd tested the fix on Python 3.10, it seems there's an additional issue that on Python 3.9, there's no |
60.0.2 is now released with edf116b, which should fix the issue (at least in my testing). Please test and confirm. |
works for me |
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 Note that I also have to use the 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. |
Same Ubuntu 22.04.1(Linux 5.15.0-47-generic) setuptools 65.3.0 Python 3.10.4 pip 22.2.2
import site
import sys
from setuptools import setup
site.ENABLE_USER_SITE = "--user" in sys.argv[1:] # https://github.com/pypa/pip/issues/7953#issuecomment-645133255
setup() pyproject.toml
output pip3 install --user -e .
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Obtaining file:///home/cromarmot/Documents/computer/oiTerminalv2dev
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Installing collected packages: UNKNOWN
Running setup.py develop for UNKNOWN
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 "/home/cromarmot/Documents/computer/oiTerminalv2dev/setup.py", line 6, 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 "/home/cromarmot/Documents/computer/oiTerminalv2dev/setup.py", line 6, 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] |
this link solved for me #3269 (comment) It looks like it using a python3-setuptool from Ubuntu apt instead of pip
|
@CroMarmot Thanks, that makes sense but I would count it as a bug that the system-installed older setuptools has precedence. Also, purging Alternatively, you can setup a venv (do not use the I found yet another workaround mentioned here. So, you would install it like this: But, alas, my original point still stands. The hoops you have to jump through to set up a development version are not amusing. |
it always working correctly in as for it will remove docker run -it --rm ubuntu /bin/bash
apt update && apt install python3 python3-pip -y
useradd -m demouser
su demouser
pip list --outdated
Package Version Latest Type
---------- ------- ------ -----
pip 22.0.2 22.2.2 wheel
setuptools 59.6.0 65.3.0 wheel
pip install --upgrade pip setuptools
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (22.0.2)
Collecting pip
Downloading pip-22.2.2-py3-none-any.whl (2.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 94.0 kB/s eta 0:00:00
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (59.6.0)
Collecting setuptools
Downloading setuptools-65.3.0-py3-none-any.whl (1.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 78.1 kB/s eta 0:00:00
Installing collected packages: setuptools, pip
WARNING: The scripts pip, pip3 and pip3.10 are installed in '/home/demouser/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-22.2.2 setuptools-65.3.0
exit
apt purge python3-pip -y && apt autoremove -y
pip list
bash: pip: command not found
su demouser
export PATH=~/.local/bin:$PATH
pip list
Package Version
---------- -------
pip 22.2.2
setuptools 65.3.0 docker ubuntu version: ubuntu@sha256:20fa2d7bb4de7723f542be5923b06c4d704370f0390e4ae9e1c833c8785644c1 |
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 "", line 1, in
File "/tmpfs/src/github/jax/setup.py", line 31, in
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
git clone https://github.com/google/jax.git
cd jax
python3.9 -m pip install -e .
Make sure the setuptools version in 60.0.0
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: