How to setup up Pweave on Atom for Python 3?

627 views Asked by At

I want to get into literate programming on my code editor, so I decided to try to set up Pweave for Atom (the code editor) by following the steps on this website: http://protips.maxmasnick.com/literate-python-setup-with-pweave-and-atom. But it still isnt working.

I've followed all the steps that are highlighted in the website except i changed the "Python 2" in {"pweave markdown": "Python 2"} and {"Python 2": "import matplotlib as matplotlib_import_only\nmatplotlib_import_only.use('Agg')\n%matplotlib inline\n%config InlineBackend.figure_format = 'retina'\npython=None"} to "Python 3".

I expected an output of a notebook to the code:

# This is the title

*backtick backtick backtick*python
print("Hello, World")
*backtick backtick backtick*

But I instead I got the output from the Hydrogen package: "No kernel for grammar Pweave markdown found".

Note: The "backtick backtick backtick" stands for ```

1

There are 1 answers

0
AUNZ On

You have to Ctrl Enter, on the line print(..). This will do a single line execute with Hydrogen if it is installed properly

I have just followed the blog post of Leonardo Cerliani and succesfully got this working with a Conda env using Python 3.6.8

Python notebooks for R markdown lovers using Atom and Pweave

His install is missing some keywords "install" and I had to do the conda install as shown below. So should read as follows. If your are installing in a conda env, launch atom from in that that conda env to access pweave (Windows CMD prompt , activate , atom)

conda install pweave -c conda-forge
apm install hydrogen # interactive coding environment
                     # with single line/selection evaluation

apm install language-weave           # for syntax highlighting
apm install atom-html-preview        # use ctrl-shift-h to preview
apm install atom-shell-commands      # to define shell commands with shortcuts

It appears to work well