Skip to content

Python pip-installed packages not available in polyglot environment #1773

@akapug

Description

@akapug

Issue

Pip-installed Python packages (e.g., LangChain) are not available when importing Python modules from TypeScript in Elide's polyglot environment.

Environment

  • Elide Version: v1.0.0-beta11-rc1
  • OS: Linux
  • Python Version: 3.13

Expected Behavior

TypeScript should be able to import Python modules that use pip-installed packages, as polyglot integration is a core feature of Elide.

Actual Behavior

ModuleNotFoundError("No module named 'langchain_core'")

Minimal Reproduction

Setup

pip install langchain-core

Python module (minimal-repro.py)

try:
    from elide import bind
except ImportError:
    def bind(func):
        return func

import json

# Standard library works
@bind
def test_stdlib():
    return json.dumps({"status": "ok"})

# Pip package fails
try:
    from langchain_core.messages import HumanMessage
    
    @bind
    def test_langchain():
        msg = HumanMessage(content="Hello")
        return json.dumps({"status": "ok", "message": msg.content})
except ImportError as e:
    @bind
    def test_langchain():
        return json.dumps({"status": "error", "message": str(e)})

TypeScript import (minimal-repro.ts)

const py = await import("./minimal-repro.py");
console.log(py.test_stdlib());  // ✅ Works
console.log(py.test_langchain());  // ❌ Fails

Test Results

Python standalone (works):

$ python3 minimal-repro.py
LangChain available: True
{"status": "ok", "message": "Hello"}

Elide polyglot (fails):

$ elide minimal-repro.ts
LangChain available: False
{"status": "error", "message": "No module named 'langchain_core'"}

Analysis

  • ✅ Python standard library imports work in Elide
  • ✅ Python standalone can import pip packages
  • ❌ Elide's Python environment cannot find pip-installed packages
  • ❌ TypeScript cannot import Python modules with pip dependencies

Impact

This blocks polyglot integration for any Python code using external packages, which is critical for:

  • AI/ML applications (LangChain, TensorFlow, PyTorch)
  • Data science (pandas, numpy, scipy)
  • Web frameworks (FastAPI, Flask)
  • Any real-world Python application

Current Workaround

Running Python code in a separate process instead of using Elide's polyglot capabilities, which defeats the purpose of using Elide.

Full Reproduction

Complete minimal reproduction case available at: https://github.com/akapug/elide-michelin/tree/main/bug-report


Note: This issue was discovered while building an AI app generator (Michelin) that uses LangChain for the AI agent. The CEO mentioned that LangChain should work in Elide Python, so this appears to be a bug rather than a limitation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions