简体   繁体   中英

Python kernel not found by vscode when running docker container

I am trying to build a docker image to do debuging of a module that has lots of odd dependencies in vscocde.

I am using the dockerfile below to build the image:

FROM ubuntu:20.04
USER root

RUN apt update -y && apt upgrade -y && \
    apt install -y software-properties-common && \
    add-apt-repository ppa:ubuntugis/ppa && \
    apt update -y && apt install -y \
    gdal-bin \
    geotiff-bin \
    git \
    libgdal-dev \
    libgl1 \
    libspatialindex-dev \ 
    wget \
    python-is-python3 \
    pip \
    g++ 

RUN pip install Cython numpy  

RUN git clone https://github.com/jgrss/geowombat.git

RUN pip install -r /geowombat/requirements.txt

RUN  pip install sklearn-xarray  pip-tools rtree ipykernel

RUN python -c "import geowombat as gw"
RUN python -c "import rasterio;from rasterio.crs import CRS; cc = CRS.from_epsg(4326)"


When running the image interactively (as my tests suggest) I can successfully run:

python

However when I use vscode remote containers and docker extension to "attach vscode" or use shift+cntr+p to run Remote-Containers: Attach to running container

I am unable to access python by executing code in an .py file and if I try using an .ipynb it informs me I need to install a python kernel from 'the marketplace'.

Basically, vscode doesn't seem to have a connection to the default python kernel.

I am new to this, so any suggestions would be helpful!

You can try to create and update a dockerfile based on thedocument

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM