'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!
Solution 1:[1]
You can try to create and update a dockerfile based on the document
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | MingJie-MSFT |