3

I have a multi-container application managed by a docker-compose.yml file consisting of an ollama, openwebui, and python-dev. I'm working on PyCharm 2025.1.3.1; MacOS Sequoia 15.6.1; Docker 28.1.1, and the containers are running successfully via the docker compose up -d command. My goal is to configure PyCharm to use the Python Interpreter inside my existing, running python-dev container.

Docker Containers

The container is running persistently and I am able to interact with it via a terminal:

Proof I can interact with it

I am using Pycharm's Add Interpreter -> On Docker workflow: using existing image

The introspection runs successfully showing where python exists on the container with a warning, but it finds the running environment so I'm not too concerned about this step:

introspection

However, when I click the "create" button on the final step, the process fails with the error: Python interpreter process exited with a non-zero exit code -1.

the error code

Since the introspection logs show success, I'm not sure what is failing at the final stage. The error is a generic exit code -1 too.

How can I successfully configure the interpreter to connect to my running python-dev service?

Docker Config Files

Further code is available on Github

Docker Compose:

version: '3.8'

services:
  ollama:
    image: ollama/ollama
    container_name: ollama
    volumes:
      - ./ollama-data:/root/.ollama
    ports:
      - "11434:11434"
    restart: unless-stopped

  webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    volumes:
      - ./webui-data:/app/backend/data
    ports:
      - "3000:8080"
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
    depends_on:
      - ollama
    restart: unless-stopped

  python-dev:
    build: .
    container_name: python-dev
    volumes:
      - ./:/app
    ports:
      - "8501:8501"
    command: sleep infinity
    # command: streamlit run src/app.py --server.runOnSave=true # also doesn't work
    depends_on:
      - ollama
    restart: unless-stopped

Dockerfile:

FROM python:3.12-bullseye

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
EXPOSE 8501

Tried searching, using Google/LLMs, but no success thus far.

2
  • 1
    Your other services have published ports:, so you can reach them directly from the host system (probably using localhost as a host name and the first ports: number). Can you use a non-container Python for day-to-day development, targeting these containerized services as needed for integration testing? Commented Sep 16 at 12:30
  • I have no idea how to do any of this. Can you help convert to pdf file and zip file ? Commented Sep 16 at 13:02

1 Answer 1

3

you are facing a PyCharm bug, namely https://youtrack.jetbrains.com/issue/PY-81541, I believe

the fix should land in 2025.3 version, try the Early Access Preview build (EAP) from https://www.jetbrains.com/pycharm/nextversion/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.