Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install fails on Mac OS x #6

Open
bob-carpenter opened this issue Jun 12, 2023 · 5 comments
Open

install fails on Mac OS x #6

bob-carpenter opened this issue Jun 12, 2023 · 5 comments

Comments

@bob-carpenter
Copy link

I'm not sure what I'm supposed to be doing but the instructions as given on the README.md don't work for me.

~/github/bob-carpenter/stan-getting-started (main)$ quarto add quarto-ext/include-code-files


Quarto extensions may execute code when documents are rendered. If you do not 
trust the authors of the extension, we recommend that you do not install or 
use the extension.
 ? Do you trust the authors of this extension (Y/n) › Yes
[✓] Downloading
[✓] Unzipping
    Found 1 extension.

The following changes will be made:
Include Code Files   [Install]   1.0.0 (filter)
 ? Would you like to continue (Y/n) › Yes

[✓] Extension installation complete.
Learn more about this extension at https://www.github.com/quarto-ext/include-code-files

And then I put this in my Yaml:

filters:
    - include-code-filters

and then I run and it fails with this message when doing the final rendering:

Error running filter /Applications/quarto/share/filters/main.lua:
Error running filter /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-filters:
Could not find executable /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-filters
stack traceback:
	/Applications/quarto/share/filters/main.lua:4026: in function </Applications/quarto/share/filters/main.lua:4005>
	[C]: in ?
	[C]: in method 'walk'
	/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
	/Applications/quarto/share/filters/main.lua:449: in local 'callback'
	/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
stack traceback:
	/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
	/Applications/quarto/share/filters/main.lua:449: in local 'callback'
	/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
make: *** [stan-getting-started.pdf] Error 1

After I run the install, I can't find the include-code-filters anywhere on my OS.

@dragonstyle
Copy link

Looks like perhaps a simple typo?

filters:
  - include-code-files

per

https://github.com/quarto-ext/include-code-files

@bob-carpenter
Copy link
Author

Thanks, @dragonstyle. That was definitely user error on my part.

The install produced an include-code-files.lua but it's not getting picked up. Then I moved a .lua file into quarto directory, but that didn't work either:

Error running filter /Applications/quarto/share/filters/main.lua:
Error running filter /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-files:
Could not find executable /Users/bcarpenter/github/bob-carpenter/stan-getting-started/quarto/include-code-files
stack traceback:
	/Applications/quarto/share/filters/main.lua:4026: in function </Applications/quarto/share/filters/main.lua:4005>
	[C]: in ?
	[C]: in method 'walk'
	/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
	/Applications/quarto/share/filters/main.lua:449: in local 'callback'
	/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
stack traceback:
	/Applications/quarto/share/filters/main.lua:171: in function 'run_emulated_filter'
	/Applications/quarto/share/filters/main.lua:449: in local 'callback'
	/Applications/quarto/share/filters/main.lua:454: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:495: in function </Applications/quarto/share/filters/main.lua:476>
make: *** [stan-getting-started.pdf] Error 1

Is there some way I can install this extension and distribute with my document? Otherwise, this is going to be too hard for me and people I'd like to run this document to use. Which is too bad, because this is exactly the extension I want. I wrote one myself in Java for a previous set of documentation I was writing 15 years ago, but don't want to go down that rabbit hole again.

@rfhb
Copy link

rfhb commented Jun 12, 2023

Worked for me running within the repo's quarto folder quarto add quarto-ext/include-code-files (creates _extensions folder infrastructure)

@dragonstyle
Copy link

Archive.zip

There is a sample I created. I used:

  1. make a directory to work in and cd to that directory
  2. quarto add quarto-ext/include-code-files to add the extension
    1a) (after installation, note the presence of an _extension directory which contains the newly added extension
  3. Make a test.qmd like:
---
title: "My Document"
filters:
   - include-code-files
---


```{.python include="script.py"}
```
  1. Make a script.py like:
# Program to add two matrices using nested loop

X = [[12,7,3],
    [4 ,5,6],
    [7 ,8,9]]

Y = [[5,8,1],
    [6,7,3],
    [4,5,9]]

result = [[0,0,0],
         [0,0,0],
         [0,0,0]]

# iterate through rows
for i in range(len(X)):
   # iterate through columns
   for j in range(len(X[0])):
       result[i][j] = X[i][j] + Y[i][j]

for r in result:
   print(r)
  1. quarto render test.qmd

@bob-carpenter
Copy link
Author

Thanks for all the help.

I just created a PR that adds a note to README.md explaining that the _extensions directory needs to go in the same directory as your quarto files. At least that's what solved the problem for me. If there's a more general solution, please include that instead of my PR.

P.S. Thanks for the extension---it's just what I need!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants