You hate building an environment, right? I hate it at a crazy level because I'm a bad person who makes errors and takes a few days without hesitation. If I try to get a non-engineer who works with me to do analysis work that I am a weak but crazy engineer, I may be stabbed from behind. That's why I made a title that seems to be able to be diverted to some extent, so I will also post it as a memorandum.
** Providing non-engineers with an environment where they can write Python like Jupyter Notebook on VS Code **
I am aiming for that.
――I want to easily create a Python environment --I want to use Visual Studio Code mainly ――I don't want to devote effort to building the environment ――I want non-engineers to easily analyze data using Python. ――If you can, I only want to use the mouse (I don't want to)
(We do not explain each software or technical details)
OS: Windows 10 Pro 64bit (to use Hyper-V function when using Docker)
Roughly, the following flow.
I prepared a folder structure to be used as a base and a group of necessary files on GitHub, so I cloned it or downloaded it and placed it in any folder (in my case, I created a folder for Git under C drive) https://github.com/m0p1nt/ds_base_env_for_vscode
Change the value of the name attribute of devcontainer.json
to your liking.
Since other contributors have already written articles that are easy to understand for environment construction, only the rough procedure (reference site is in the supplement below).
Enable Hyper-V
Check Hyper-v
in the Control Panel
-> Programs and Features
-> Enable or Disable Windows Features
item (Restart when prompted) ).
Download and install the installer from Docker Desktop for Windows Download Site
Drive mount settings
(1) Open the setting screen with [Setting] from the Docker icon at the bottom right of the Widndows taskbar (if there is no icon, start Docker and check again).
(2) Check the mount permission for the drive where the folder for the analysis environment is placed.
Download and install the installer from Visual Studio Code Download Site
Add extension Remote --Containers
Remote-Containers: Open Folder in Container ...
.
Select the folder placed in "1. Get the folder structure that is the base of the environment" above.
A new screen will be launched and the environment construction will start, so wait a few minutes and you're done.
It is convenient because it can be used like Jupyter Notebook on VS Code.
To close it, click the green icon at the bottom left and select End remote connection
.
--If you want to add a Python library
→ Install with pip command on VS Code terminal
If you want others to see the addition of the library, on the VS Code terminal,
$ pip freeze > .devcontainer/requirements.txt
You can list the installed libraries with.
--If you want to add VS Code extensions
→ Edit the extensions attribute of devcontainer.json
The name corresponds to the value in the figure below that is displayed when searching for an extension.
(Example: For extension Python
)
-Microsoft vscode dev containers (reference for folder structure)
Recommended Posts