posit-dev / posit-dev/positron

reticulate integration fails with `ModuleNotFoundError: No module named 'positron_ipykernel'` for conda/mamba environments (works for venv)

Open
#14,907 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: reticulate enhancement lang: r support
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 11h
Merged PRs (30d)
206

Description

System details:

Positron and OS details:

Positron Version: 2026.07.1 (user setup) build 5
Code - OSS Version: 1.118.0
Commit: d3cdd608df5afa3378c24c9a9c81b01fe1433a87
Date: 2026-07-08T19:52:09-06:00
Electron: 39.8.8
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.19045

Session details:

R 4.6.1, Python 3.10.12 (system), Python 3.12.13 (conda env)
Reticulate version 1.46.0
Quarto version 1.9.38

Describe the issue:

Positron's reticulate integration fails to start the Python session for conda/mamba environments, exiting immediately with ModuleNotFoundError: No module named 'positron_ipykernel'. The identical flow works for a venv on the same machine. This makes the managed "Python (reticulate)" console unusable with conda environments.

Steps to reproduce the issue:

  1. Create a fresh conda/mamba environment:
    mamba create -n testenv python=3.10
    
  2. In Positron, open a .qmd file and run:
    library(reticulate)
    use_condaenv("testenv", required = TRUE)
    repl_python()
    
  3. Observe that the reticulate Python session fails to start.

For contrast, the same flow against a venv succeeds:

# from a workspace containing a .venv created via `python -m venv .venv`
library(reticulate)
use_virtualenv(".venv", required = TRUE)
repl_python()   # starts normally

Expected or desired behavior:

The "Python (reticulate)" console starts against the conda environment, the same way it does for a venv.

Were there any error messages in the UI, Output panel, or Developer Tools console?

The session exits immediately (exit code 0) with:

Python (reticulate) failed to start up (exit code 0)
Reticulate initialization failed: ModuleNotFoundError: No module named 'positron_ipykernel'
Run `reticulate::py_last_error()` for details.

reticulate::py_last_error() R traceback:

── R Traceback ────────────────────────────────
     ▆
  1. └─.ps.rpc.reticulate_start_kernel(...)
  2.   ├─base::tryCatch(...)
  ...
 11.             └─reticulate::import("positron_ipykernel.positron_ipkernel")
 12.               └─reticulate:::py_module_import(module, convert = convert)

- Open the Developer Tools console by running the `Developer: Toggle Developer Tools` command from the Command Palette
- Open the relevant Output Channel logs by utilizing this guide: https://positron.posit.co/troubleshooting.html

## What I've already tried (all still fail for the conda env)

- Installed `ipykernel` into the conda env (`mamba install -n testenv ipykernel`) — no change; the missing module is `positron_ipykernel`, not `ipykernel`.
- Pinned `ipykernel<7` — no change.
- `use_condaenv("testenv", required = TRUE)` — the original failing path.
- `use_python("/home/<user>/miniforge3/envs/testenv/bin/python", required = TRUE)` — same failure. reticulate appears to still apply conda-style setup because the prefix contains a `conda-meta` folder.
- Confirmed the same machine/WSL works fine with a venv, so this is specifically conda-env vs venv rather than a filesystem/WSL issue (the venv is on `/mnt/d`, the conda env on the native Linux filesystem).

Workaround that does work: setting `positron.reticulate.enabled` to `never` (loses the managed console and Variables pane).

## Hypothesis (may be wrong)

Positron exposes `positron_ipykernel` by adding its bundled kernel directory to the interpreter's search path via `PYTHONPATH`. Conda environment activation seems to rebuild the process environment and drop that `PYTHONPATH` entry, so the bundled module is no longer importable for conda interpreters. venvs don't go through that activation step, so the entry survives — which would explain the venv-vs-conda difference.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at .ps.rpc.reticulate_start_kernel and reproduce the conda/mamba and venv flows described in the issue, then inspect how the Python path is preserved during reticulate initialization. Verify the fix by confirming positron_ipykernel imports and the managed "Python (reticulate)" console starts in the conda environment without regressing venv support.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.