dazzling-judge-67245
07/07/2025, 9:00 PMjolly-florist-66728
07/07/2025, 9:00 PMpyflyte run --remote
, the code archive is extracted to the WORKDIR, so your custom modules must be discoverable from there. There is no official Nix-specific guide, so you may need to adapt the Docker-based instructions to your Nix environment.
Would you like more detail on how to set up the WORKDIR, PYTHONPATH, and Flyte registration commands for your use case?
Sources:
- the Flyte docs
- community discussions 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.dazzling-judge-67245
07/07/2025, 9:23 PMjolly-florist-66728
07/07/2025, 9:23 PMWORKDIR /root
ENV PYTHONPATH=/root:/path/to/your/modules:$PYTHONPATH
If using Nix, ensure the entrypoint shell or wrapper script sets PYTHONPATH accordingly.
3. Register and run with Flyte: When you use pyflyte run --remote
or pyflyte register
, Flyte will package your code and extract it to the WORKDIR in the container. Your modules must be importable from that location. If your modules are in a subdirectory (e.g., src/), either add that to PYTHONPATH or use absolute imports in your code.
4. Troubleshooting: If you get ModuleNotFoundError, check the container at runtime to verify the modules are present and PYTHONPATH is set. You can do this by running an interactive shell in the container and trying to import your modules manually.
Here’s a minimal Dockerfile-style example (adapt for Nix as needed):
FROM python:3.11-slim
WORKDIR /root
COPY . /root
ENV PYTHONPATH=/root:/root/src:$PYTHONPATH
RUN pip install flytekit # Or use Nix to install
For Nix, you might use a shell.nix or default.nix that sets up the environment, and a wrapper script to launch with the correct PYTHONPATH.
Would you like a more detailed Nix expression or help debugging a specific error message?
Sources:
- community discussions 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.dazzling-judge-67245
07/07/2025, 9:53 PMpyflyte-fast-execute --additional-distribution <s3://my-s3-bucket/my-project/development/EGWMREC3XQD5CU7KQUZIBUFMJQ======/fastcdc0ed62711cf79d38ff43a779d24b11.tar.gz> --dest-dir . -- pyflyte-execute --inputs <s3://my-s3-bucket/metadata/propeller/my-project-development-apg5ctcpsf7tml9sc48z/load-preset/data/inputs.pb> --output-prefix <s3://my-s3-bucket/metadata/propeller/my-project-development-apg5ctcpsf7tml9sc48z/load-preset/data/0> --raw-output-data-prefix <s3://my-s3-bucket/data/qw/apg5ctcpsf7tml9sc48z-load-preset-0> --checkpoint-path <s3://my-s3-bucket/data/qw/apg5ctcpsf7tml9sc48z-load-preset-0/_flytecheckpoints> --prev-checkpoint "" --resolver flytekit.core.python_auto_container.default_task_resolver -- task-module workflow.compile_llm task-name load_preset
However if I run pyflyte-fast-execute --additional-distribution <s3://my-s3-bucket/my-project/development/EGWMREC3XQD5CU7KQUZIBUFMJQ======/fastcdc0ed62711cf79d38ff43a779d24b11.tar.gz> --dest-dir .
and then separately run pyflyte-execute --inputs <s3://my-s3-bucket/metadata/propeller/my-project-development-apg5ctcpsf7tml9sc48z/load-preset/data/inputs.pb> --output-prefix <s3://my-s3-bucket/metadata/propeller/my-project-development-apg5ctcpsf7tml9sc48z/load-preset/data/0> --raw-output-data-prefix <s3://my-s3-bucket/data/qw/apg5ctcpsf7tml9sc48z-load-preset-0> --checkpoint-path <s3://my-s3-bucket/data/qw/apg5ctcpsf7tml9sc48z-load-preset-0/_flytecheckpoints> --prev-checkpoint "" --resolver flytekit.core.python_auto_container.default_task_resolver -- task-module workflow.compile_llm task-name load_preset
it works. So running it inside the --
somehow loses the correct path.jolly-florist-66728
07/07/2025, 9:53 PMpyflyte-fast-execute
sets up the environment for the subprocess it launches. When you run pyflyte-fast-execute --additional-distribution ... --dest-dir . -- pyflyte-execute ...
, the code archive is extracted and the subprocess is launched with an updated PYTHONPATH that includes the destination directory. However, if your Nix environment or container setup does not propagate the PYTHONPATH correctly to the subprocess, your modules may not be importable. Running the two commands separately works because your shell session retains the correct environment after extraction.
According to the Flyte documentation and community discussions, you must ensure that the extracted code directory is on the PYTHONPATH at the time pyflyte-execute
runs. If your Nix shell or entrypoint script resets or overrides PYTHONPATH, the subprocess may not see the extracted modules. You may need to explicitly set PYTHONPATH in your container or wrapper script to include the extraction directory (e.g., .
or /root
), or adjust your Nix build to respect the environment variable propagation.
Would you like more detail on how to ensure PYTHONPATH is set correctly in this context?
Sources:
- the Flyte documentation
- community discussions 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.dazzling-judge-67245
07/07/2025, 10:18 PM/nix/store/4qa2jr1apqzncvd2myhxxzh2yvvp5268-python3.10-protobuf-5.28.3/lib/python3.10/site-packages
via site.addsitedir
in the nix wrapper for pyflyte-execute
causes google.api
to not be importable.jolly-florist-66728
07/07/2025, 10:18 PMsite-packages
via site.addsitedir
in a wrapper for pyflyte-execute
could interfere with importing modules like google.api
. However, your observation suggests that manipulating site-packages
in this way may disrupt Python's import resolution, especially with namespace packages such as google.api
, which can be sensitive to the order and method by which directories are added to sys.path
. If possible, please provide more details about your Nix environment, the exact wrapper script, and how your Python environment is being constructed, as this context can help pinpoint the issue. If this doesn't help, please reach out to the Flyte support team for further assistance. 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.dazzling-judge-67245
07/07/2025, 10:22 PMjolly-florist-66728
07/07/2025, 10:22 PM