Skip to content

conda venv not recognized by ngen #572

@RY4GIT

Description

@RY4GIT

We (@RY4GIT and @taddyb) attempted to integrate our own Python model into NGen using the BMI Python. However, we encountered the following issues.

Current behavior

  • Python virtual environment not recognized or found in ngen. It seems that the variable VIRTUAL_ENV needs to be defined, but we couldn't find where in ngen codebase defines it (see the screenshot)
    image

Expected behavior

  • Python virtual environment recognized and set in ngen

Steps to replicate behavior

  1. Git clone the Python model of interest
    git clone https://github.com/NWC-CUAHSI-Summer-Institute/cfe_py/tree/add-bmi2
  2. Build python environment using cfe_py/environment.yml
    conda env create -f environment.yml
  3. Activate the venv conda activate cfe
  4. Build the ngen following this instruction. Before running the building code (cmake -B /ngen -S . && cmake --build . --target ngen), turn on the debugging option using target_compile_options (ngen PUBLIC -g) in the root CMakeList.txt, as described here
  5. Run the ngen ./ngen, and it prints the following. You can see the issue described in the current behavior, where VIRTUAL_ENV is not set. I also tried building ngen outside of venv (i.e., conda base), but it was the same.
Build Info:
  NGen version: 0.1.0
  Python active
    Embedded interpreter version: 3.10.12

Python Environment Info:
  VIRTUAL_ENV environment variable: (not set)
  Discovered venv: None
  System paths:

    /home/flipl/miniconda3/lib/python310.zip
    /home/flipl/miniconda3/lib/python3.10
    /home/flipl/miniconda3/lib/python3.10/lib-dynload
    /home/flipl/.local/lib/python3.10/site-packages
    /home/flipl/miniconda3/lib/python3.10/site-packages
    /home/flipl/cfe_py

Some other info

  • OS: WSL on Windows 11
  • NGen version: 0.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions