I use a flake to manage a rust project augmented with some helper utilities written in Python.
Some time ago a glitch appeared (which I put up with until now, because of lack of time to try to deal with it). When running nix develop
or (more realistically) using direnv
to automatically activate the development environment, the following message appears:
> nix develop
Executing setuptoolsShellHook
Obtaining file:///tmp/silence-nix-error
Preparing metadata (setup.py) ... done
Installing collected packages: mre-python-utils
Running setup.py develop for mre-python-utils
Successfully installed mre-python-utils-0.1.0
--- Logging error ---
Traceback (most recent call last):
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/utils/logging.py", line 177, in emit
self.console.print(renderable, overflow="ignore", crop=False, style=style)
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_vendor/rich/console.py", line 1752, in print
extend(render(renderable, render_options))
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_vendor/rich/console.py", line 1390, in render
for render_output in iter_render:
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
for line in lines:
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_vendor/rich/segment.py", line 245, in split_lines
for segment in segments:
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_vendor/rich/console.py", line 1368, in render
renderable = rich_cast(renderable)
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
renderable = cast_method()
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
pip_cmd = get_best_invocation_for_this_pip()
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/utils/entrypoints.py", line 58, in get_best_invocation_for_this_pip
if found_executable and os.path.samefile(
File "/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/lib/python3.10/genericpath.py", line 101, in samefile
s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/bin/pip'
Call stack:
File "/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/__main__.py", line 31, in <module>
sys.exit(_main())
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/cli/main.py", line 70, in main
return command.main(cmd_args)
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 101, in main
return self._main(args)
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
self.handle_pip_version_check(options)
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 148, in handle_pip_version_check
pip_self_version_check(session, options)
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/self_outdated_check.py", line 237, in pip_self_version_check
logger.info("[present-rich] %s", upgrade_prompt)
File "/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/lib/python3.10/logging/__init__.py", line 1477, in info
self._log(INFO, msg, args, **kwargs)
File "/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/lib/python3.10/logging/__init__.py", line 1624, in _log
self.handle(record)
File "/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/lib/python3.10/logging/__init__.py", line 1634, in handle
self.callHandlers(record)
File "/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
hdlr.handle(record)
File "/nix/store/5h37mbgq680473y6q4n0hgrvc4c373b8-python3-3.10.8/lib/python3.10/logging/__init__.py", line 968, in handle
self.emit(record)
File "/nix/store/sgjh2har3c64yvs7swzx3k20a47z7x6h-python3.10-pip-22.1.2/lib/python3.10/site-packages/pip/_internal/utils/logging.py", line 179, in emit
self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.1.2', new='23.1.2'),)
Finished executing setuptoolsShellHook
Note that, despite all the noise, the command actually succeeds. However, it does prevent direnv from caching the result. The noise and lack of caching severely degrade the developer experience.
I’ve been banging my head against this wall for a while without getting any closer to understanding what is going on.
Given that nix develop
claims to be "running setup.py develop
", I have tried to run the latter manually, only to get
error: invalid command 'develop'
How can I get rid of this irksome glitch?