Skip to content
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

Python doesn't have access to host PATHs in both pure and impure environments #1335

Open
shahinism opened this issue Jul 19, 2024 · 1 comment
Labels
question Further information is requested

Comments

@shahinism
Copy link

Objective:
I am trying to invoke commands available in the host system's path using Python within a specific environment configuration.

Context:
This issue is based on DataChefHQ/inception issue #21, where it was highlighted that Python cannot directly invoke commands available in the host system's path.

Problem:
In my setup, as demonstrated in the image linked below, Python is unable to access system path commands.

Issue Demonstration

Configuration:
Here is my current configuration:

{ pkgs, lib, config, inputs, ... }:

{
  env.GREET = "devenv";
  packages = [ ];
  languages.python.enable = true;
  scripts.hello.exec = "echo hello from $GREET";
}

Attempted Solutions:
I learned that installing git inside the environment (adding to packages list) will resolve the issue. However, I am uncertain if this is the intended approach.

Request for Assistance:
Please confirm if installing (or other similar tools) within the environment is the recommended solution for this issue. Additionally, if there are alternative methods or best practices to allow Python to invoke system path commands within this configuration, I would appreciate your guidance.

Side note: I think, in general, this is a suitable approach, enforcing developers to keep devenv's environment in sink with the code developed. However, observing the strange behavior where Python couldn't access it, but I could do it through CLI within the same environment, and the lack of documentation around it confused me and thought it's better to reach out.

@shahinism shahinism added the question Further information is requested label Jul 19, 2024
@kkiani
Copy link

kkiani commented Sep 24, 2024

I am encountering a similar issue in a Linux environment using PDM. My project has a Python dependency that is fetched from a Git repository, which requires Git to be available. On macOS, everything works as expected. However, on Linux (specifically NixOS and Ubuntu), Python fails to access Git, even though it’s already installed on the host system.

Adding Git to the devenv environment dependencies resolves the issue, but this approach feels redundant, given that Git is already present on the host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants