Procedure to set hydrogen of atom (virtual environment)

Introduction

Do you want to execute code halfway while developing with atom? When I looked it up, there was a package called hydrogen that can use Atom like jupyter, so I will write how to set it. A beginner like me couldn't solve the error easily, and when I could solve it, I cried honestly. Lol I would appreciate it if you could point out any mistakes in this post for the first time and self-taught.

Target person

・ Those who want to set atom hydrogen in a virtual environment

-If you get the following error statement when setting hydrogen with atom (this is an error when you try to execute hydrogen with atom) Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2032.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2032.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File ・ ・ ・ ・ ・ ・ ・ Omitted ・ ・ ・ ・ ・ ・ ・ ・ "C: \ Users \ username \ AppData \ Local \ Packages \ PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0 \ LocalCache \ local-packages \ Python37 \ site-packages \ jupyter_core \ paths.py ", line 361, in win32_restrict_file_to_user import win32api ImportError: DLL load failed: �w � 肳 ꂽ���W ��� [����������

About the error I got

When I ran hydrogen on atom after completing all the settings, I was able to get the above error code, and I had a really hard time. As a result of various trials, the solution was as follows. (For details, see step ⑧ below) -This is because the json of the base environment was pasted instead of the json of the virtual environment during the procedure of pasting the json of the jupyter Kernel to the "startup code" and "Kernel Gateways" that can be set from Atom / environment settings / hydrogen / settings. It seems that there was an error. (The base environment is python3.7.)

Atom hydrogen設定画面1.png

Atom hydrogen設定画面2.png

environment

・ Windows 10 ・ Atom 1.48.0 ・ Hydrogen 2.14.3 ・ Virtual environment conda python3.6.10

procedure

① Build a virtual environment

・ Start anaconda prompt

・ Execute the following code

Anaconda_prompt


>conda create -n py36_fxpractice python=3.6

・ After various sentences are displayed after execution, the following sentences are displayed.

Proceed ([y]/n)? 

Enter y and ʻEnter`

②: Confirmation of the constructed environment

Execute the following code

Anaconda_prompt


>conda info -e

Output result


# conda environments:
#
base                  *  C:\Users\UsersName\Anaconda3
py36_fxpractice          C:\Users\UsersName\Anaconda3\envs\py36_fxpractice

③: Switching to a virtual environment

Execute the following code

Anaconda_prompt


>activate py36_fxpractice

After execution


(py36_fxpractice) C:\Users\Kawahara>

④: Installation of jupyter

Execute the following code

Anaconda_prompt


>conda install jupyter

・ After various sentences are displayed after execution, the following sentences are displayed.

Proceed ([y]/n)? 

Enter y and ʻEnter`

⑤: Create a jupyter kernel

Execute the following code

Anaconda_prompt


ipython kernel install --user --name py36_fxpractice --display-name py36_fxpractice

⑥: Check the jupyter kernel

Execute the following code

Anaconda_prompt


jupyter kernelspec list

Output result


Available kernels:
  py36_fxpractice    C:\Users\UserName\AppData\Roaming\jupyter\kernels\py36_fxpractice
  python3            C:\Users\UserName\AppData\Roaming\jupyter\kernels\python3

⑦ Installation of necessary libraries

Anaconda_prompt <example>


conda install numpy 

You can install it with conda install [library name]. ①④ Similarly, you will be asked Proceed ([y] / n)?, So enter y and press ʻEnter. The above installs numpy` as an example.

⑧: Start jupyter notebook

Execute the following code

Anaconda_prompt


jupyter notebook 

After executing the code, jupyte will start in the browser. (The following screen will be displayed.)

jupyter display 設定画面1.png

-Click New in the above image and select the display-name of the kernel created in ⑤. Try running the code and see if jupyter works fine. After confirmation, close jupyter and anaconda prompt. (I'm closed with a cross in the upper right corner of the screen.)

⑨: Get json of jupyter kernel

Open the anaconda prompt again and execute the following code

Anaconda_prompt


 jupyter kernelspec list --json

⑩: Atom settings

Open Atom from anaconda prompt (execute the following code)

Anaconda_prompt


 atom .

After starting Atom, paste the jupyter Kernel json to "startup code" and "Kernel Gateways" that can be set from Atom / Preferences / hydrogen / settings.

Exit atom once and open Atom again in the same way. Open the appropriate file and press shift + Enter and the code should be executed like jupyter on Atom like the screen.

Atom hydrogen実行画面.png

Reference URL

I have referred to the HP of the following people, so I will post it.

Jupyter related

[Qiita] Miniconda ・ Python environment construction using Atom Hydrogen

About virtual environment

[Qiita] [For beginners] Try creating a virtual environment with Anaconda

path setting

This is not written in the article, but if the above steps do not work, please refer to this article and try Path in a virtual environment. ・ [Qiita] Atom procedure memo for running Hydrogen

Recommended Posts

Procedure to set hydrogen of atom (virtual environment)
Ssh to virtual environment with remote development of vscode
How to develop in a virtual environment of Python [Memo]
Overview of Python virtual environment and how to create it
[Django] Memorandum of environment construction procedure
Operation memo of Conda virtual environment
How to set up the development environment of ev3dev [Windows version]
[5 steps] Apply anaconda virtual environment to VScode
About the virtual environment of python version 3.7
Try to prepare each environment of kivy
Add a Python virtual environment to VSCode
How to share a virtual environment [About requirements.txt]
How to create a Python virtual environment (venv)
[Ansible installation procedure] From installation to execution of playbook
Flow of creating a virtual environment with Anaconda
Djnago Memo Set Japanese to filename of Content-Disposition
From Python environment construction to virtual environment construction with anaconda
A memo to create a virtual environment (venv) before Django
How to set up a Python environment using pyenv
Procedure to install TensorFlow in fish shell environment (Anaconda 4.0.0)
[Blender] How to dynamically set the selection of EnumProperty
Double-click to open ipynb file (Mac, Anaconda virtual environment)
Set PATH equivalent to "sudo su-" using Ansible environment
Set the specified column of QTableWidget to ReadOnly StyledItemDelegate
Example of pytest environment to fix database with Docker
Procedure to exe python file from Ubunts environment construction
How to set up and compile your Cython environment
Procedure from environment construction to operation test of testinfra, a server environment test tool made by Python