-
I am currently trying to render a quarto markdown file that contains python code, which I would like to display using the Jupyter feature. I am also using this in conjunction with a Hugo site. The problem I am facing is that every time I attempt to render the page, I get a ModuleNotFoundError as shown by the following traceback: ➜ workflow git:(main) ✗ source plaid-env/bin/activate
(plaid-env) ➜ workflow git:(main) ✗ quarto render plaid-ml.qmd
Starting Jupyter kernel...Done
Executing 'plaid-ml.ipynb'
Cell 1/2...ERROR:
An error occurred while executing the following cell:
------------------
import numpy as np
from os import environ
environ["KERAS_BACKEND"] = "plaidml.keras.backend"
import keras
from keras.layers import Dense
import matplotlib.pyplot as plt
------------------
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <module>
2 from os import environ
3 environ["KERAS_BACKEND"] = "plaidml.keras.backend"
----> 4 import keras
5 from keras.layers import Dense
6 import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'keras'
ModuleNotFoundError: No module named 'keras' I have already verified that keras is installed: (plaid-env) ➜ workflow git:(main) ✗ pip list | grep keras
keras 2.8.0 I have also successfully used the keras module in a jupyter notebook, with the interpreter set to use the same virtual environment that I have sourced. Occasionally, I am also prompted to activate my virtual environment after it has already been sourced -- leading me to believe quarto may not be taking advantage of the environment and just using the default. I have also tried rendering just my jupyter notebook using Quarto, but am only able to output to HTML. Is it possible to configure this to convert to markdown? Any suggestions would be much appreciated. Thanks Quarto Version == 0.9.215 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
You appear to be doing things correctly (activating the virtual environment in the shell and then calling quarto render). If you execute Note that one thing that could be happening is that in the loading of the Keras library its failing to bind to plaidml somehow, and that manifests as a "ModuleNotFound" (that's complete speculation on my part though). To convert to markdown just do |
Beta Was this translation helpful? Give feedback.
-
Issue related to conda and envSetup
conda list:
jupyter kernelspec list
Problem:I notice when I activate env and install a library in, quarto preview can't see the library, but as it seems to look at the base environment by default (the one seen is When I install the appropriate library in the base, quarto preview see the python library. Question:
|
Beta Was this translation helpful? Give feedback.
You appear to be doing things correctly (activating the virtual environment in the shell and then calling quarto render).
If you execute
quarto check jupyter
you'll see exactly which Python version/environment Quarto is binding against. This should be discovered from thePATH
so should indeed work as you are expecting it to (note that Quarto only works w/ Python 3 so is explicitly looking for that not Python 2). You can force the version of Python used by Quarto via theQUARTO_PYTHON
environment variable.Note that one thing that could be happening is that in the loading of the Keras library its failing to bind to plaidml somehow, and that manifests as a "ModuleNotFound" (that's complete …