Pip installation error

Question:
When installing django, I get An error occurred during configuration: option use-feature: invalid choice: 'content-addressable-pool' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache'). Nothing here seems to work.
Repl link/Link to where the bug appears:
https://replit.com/@NateDhaliwal/learninglog
Screenshots, links, or other helpful context:
I am using the Django project from Python Crash Course 3rd Edition.

Try poetry remove pip

Ah, then this happens:

Package operations: 0 installs, 0 updates, 1 removal

  β€’ Removing pip (23.3.1): Failed

  CalledProcessError

  Command '['pip', 'uninstall', 'pip', '-y']' returned non-zero exit status 1.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522β”‚             # We don't call process.wait() as .__exit__ does that for us.
       523β”‚             raise
       524β”‚         retcode = process.poll()
       525β”‚         if check and retcode:
    β†’  526β”‚             raise CalledProcessError(retcode, process.args,
       527β”‚                                      output=stdout, stderr=stderr)
       528β”‚     return CompletedProcess(process.args, retcode, stdout, stderr)
       529β”‚ 
       530β”‚ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'uninstall', 'pip', '-y'] errored with the following return code 1
  
  Output:
  error: externally-managed-environment
  
  Γ— This environment is externally managed
  ╰─> This command has been disabled as it tries to modify the immutable
      `/nix/store` filesystem.
      
      To use Python with Nix and nixpkgs, have a look at the online documentation:
      <https://nixos.org/manual/nixpkgs/stable/#python>.
  
  note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
  hint: See PEP 668 for the detailed specification.
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519β”‚                 output = ""
      1520β”‚             else:
      1521β”‚                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522β”‚         except CalledProcessError as e:
    β†’ 1523β”‚             raise EnvCommandError(e, input=input_)
      1524β”‚ 
      1525β”‚         return decode(output)
      1526β”‚ 
      1527β”‚     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

Hmm, try:
In pyproject.toml, remove pip dependency.
Then, delete .pythonlibs folder
Then, poetry install

Then this happens:

~/learninglog$ poetry install
Installing dependencies from lock file
Warning: poetry.lock is not consistent with pyproject.toml. You may be getting improper dependencies. Run `poetry lock [--no-update]` to fix it.
~/learninglog$ poetry add django
Using version ^4.2.7 for django

Updating dependencies
Resolving dependencies... (0.3s)

Package operations: 4 installs, 0 updates, 1 removal

  β€’ Removing pip (23.3.1): Failed

  CalledProcessError

  Command '['pip', 'uninstall', 'pip', '-y']' returned non-zero exit status 1.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522β”‚             # We don't call process.wait() as .__exit__ does that for us.
       523β”‚             raise
       524β”‚         retcode = process.poll()
       525β”‚         if check and retcode:
    β†’  526β”‚             raise CalledProcessError(retcode, process.args,
       527β”‚                                      output=stdout, stderr=stderr)
       528β”‚     return CompletedProcess(process.args, retcode, stdout, stderr)
       529β”‚ 
       530β”‚ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'uninstall', 'pip', '-y'] errored with the following return code 1
  
  Output:
  error: externally-managed-environment
  
  Γ— This environment is externally managed
  ╰─> This command has been disabled as it tries to modify the immutable
      `/nix/store` filesystem.
      
      To use Python with Nix and nixpkgs, have a look at the online documentation:
      <https://nixos.org/manual/nixpkgs/stable/#python>.
  
  note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
  hint: See PEP 668 for the detailed specification.
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519β”‚                 output = ""
      1520β”‚             else:
      1521β”‚                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522β”‚         except CalledProcessError as e:
    β†’ 1523β”‚             raise EnvCommandError(e, input=input_)
      1524β”‚ 
      1525β”‚         return decode(output)
      1526β”‚ 
      1527β”‚     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

Why can’t you use Django template?

I could, but it takes up a lot of storage (uses the old Python structure)

Hmm, try removing the pip folders in .pythonlibs/lib/python3.10/site-packages. Then delete poetry.lock, then poetry lock.
If that doesn’t work, maybe the ll_env folder should be deleted.

Did everything, including the ll_env folder, but the same error is there.

Oh, also delete the contents of .pythonlibs/bin

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.