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.
・ 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 ��� [����������
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.)
・ Windows 10 ・ Atom 1.48.0 ・ Hydrogen 2.14.3 ・ Virtual environment conda python3.6.10
・ Start anaconda prompt
・ Execute the following code
Anaconda_prompt
>conda create -n py36_fxpractice python=3.6
py36_fxpractice
is the part that becomes the virtual environment name, so you can use any name.・ After various sentences are displayed after execution, the following sentences are displayed.
Proceed ([y]/n)?
Enter y
and ʻEnter`
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
base
environment and the py36_fxpractice
environment created earlier. You can also tell that you are currently in the base
environment because there is a*
mark in the base
environment.Execute the following code
Anaconda_prompt
>activate py36_fxpractice
After execution
(py36_fxpractice) C:\Users\Kawahara>
(base) ⇒ (py36_fxpractice)
.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`
Execute the following code
Anaconda_prompt
ipython kernel install --user --name py36_fxpractice --display-name py36_fxpractice
$ ipython kernel install --user --name = environment name --display-name = environment name
, the part of environment name
can be arbitrary.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
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.
Execute the following code
Anaconda_prompt
jupyter notebook
After executing the code, jupyte will start in the browser. (The following screen will be displayed.)
-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.)
Open the anaconda prompt again and execute the following code
Anaconda_prompt
jupyter kernelspec list --json
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.
I have referred to the HP of the following people, so I will post it.
・ [Qiita] Miniconda ・ Python environment construction using Atom Hydrogen
[Qiita] [For beginners] Try creating a virtual environment with Anaconda
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