Data Loader Can No Longer Fiind Correct Python Interpreter #1319
-
#!/Users/my_user/miniconda3/envs/my_env/bin/python
import numpy as np
import pandas as pd
a = np.random.rand(10, 10)
df = pd.DataFrame(a)
df_results_dict = {'my_df': df}
# MORE CODE TO SAVE DF HERE I also added the following line to my interpreters: {
".py": ["/Users/my_user/miniconda3/envs/my_env/bin/python"],
}, When I run the dashboard with
This error occurs for any package that is not part of the standard library. It seems like Observable is not using the correct interpreter despite the shebang and the interpreter specification in the config.ts file. When I try to determine what interpreter is being used by adding a line like: raise SystemError(f"python env: {sys.executable}") I get:
The Python interpreter was installed with Homebrew. I have tried to create a fresh Observable project and a fresh conda environment, and the problem persists. I am not sure exactly what changed, but I did upgrade to the latest version of Observable. How can I get Observable to use the correct Python interpreter? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The shebang has no effect unless you are using an executable ( Have you tried running your Python data loader manually? Assuming you are in your project root, and
(If you’re not on the latest version 1.7.0, then your source root is probably It should also be possible for you to set your Lastly have you considered using a virtual environment? I’m not a Python expert but I believe it’s common practice. We use it in our python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
yarn
yarn dev Then you can exit the virtual environment like so: deactivate |
Beta Was this translation helpful? Give feedback.
The shebang has no effect unless you are using an executable (
.exe
) data loader. When you use.py
data loader, by default you’ll getpython3
as the interpreter, though you should be able to override the interpreter by using the interpreters config option.Have you tried running your Python data loader manually? Assuming you are in your project root, and
foo.csv.py
lives in your source rootsrc
, it should be like this:(If you’re not on the latest version 1.7.0, then your source root is…