Open dmbates opened 1 year ago
This is great! Thank you.
Hello,
Sorry for the last minute call. It does not work quite well. It seems that there is a problem with Python and/or Jupyter. However, there's no problem for me to open the file CL2arrow.qmd
in VSCode. (BTW I use MacBook M1)
Here is my quarto check
:
quarto check
[✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.1: OK Dart Sass version 1.55.0: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.3.450 Path: /Applications/quarto/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK Version: 3.9.10 (Conda) Path: /Users/cyhsieh/miniforge3/bin/python Jupyter: 5.3.1 Kernels: julia-1.9, python3
(/) Checking Jupyter engine render....Traceback (most recent call last): File "/Users/cyhsieh/miniforge3/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/Users/cyhsieh/miniforge3/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/ipykernel_launcher.py", line 15, in
from ipykernel import kernelapp as app File "/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/ipykernel/kernelapp.py", line 52, in from .ipkernel import IPythonKernel File "/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/ipykernel/ipkernel.py", line 20, in from .comm.comm import BaseComm File "/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/ipykernel/comm/init.py", line 3, in from .comm import Comm File "/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/ipykernel/comm/comm.py", line 15, in from ipykernel.kernelbase import Kernel File "/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 38, in import psutil File "/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/psutil/init.py", line 123, in from . import _psosx as _psplatform File "/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/psutil/_psosx.py", line 14, in from . import _psutil_osx as cext ImportError: dlopen(/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so, 0x0002): tried: '/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so' (no such file), '/Users/cyhsieh/miniforge3/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) 2023-09-08 22:02:23,309 - traitlets - ERROR - Error occurred while starting new kernel client for kernel 1af016aa-2c26-47c0-a2e6-13b841e79bc6: Kernel died before replying to kernel_info Kernel died before replying to kernel_info [✓] Checking Jupyter engine render....OK
And here is my quarto preview CL2arrow.qmd --to html
:
quarto preview CL2arrow.qmd --to html
Starting julia-1.9 kernel...Done
Executing 'CL2arrow.ipynb' Cell 1/13...Done Cell 2/13...Done Cell 3/13...Done Cell 4/13...Done Cell 5/13...Done Cell 6/13...ERROR:
An error occurred while executing the following cell:
R""" dat <- arrow::read_ipc_file($arrowfn) # pass the file name to R through string interpolation tibble::glimpse(dat) """
REvalError: loadNamespace(x) でエラー: ‘arrow’ という名前のパッケージはありません 呼び出し: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Stacktrace: [1] handle_eval_stderr(; as_warning::Bool) @ RCall ~/.julia/packages/RCall/aK5sD/src/io.jl:174 [2] handle_eval_stderr @ ~/.julia/packages/RCall/aK5sD/src/io.jl:168 [inlined] [3] reval_p(expr::Ptr{LangSxp}, env::Ptr{EnvSxp}) @ RCall ~/.julia/packages/RCall/aK5sD/src/eval.jl:103 [4] reval_p(expr::Ptr{RCall.ExprSxp}, env::Ptr{EnvSxp}) @ RCall ~/.julia/packages/RCall/aK5sD/src/eval.jl:119 [5] reval(str::String, env::RObject{EnvSxp}) @ RCall ~/.julia/packages/RCall/aK5sD/src/eval.jl:136 [6] top-level scope @ ~/.julia/packages/RCall/aK5sD/src/macros.jl:67
I'm not sure if this helps. So as I uninstall Jupyter, I rerun quarto check
and get this. It seems that Julia is not listed as one of the kernels in this case:
quarto check
[✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.1: OK Dart Sass version 1.55.0: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.3.450 Path: /Applications/quarto/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK Version: 3.9.10 (Conda) Path: /Users/cyhsieh/miniforge3/bin/python Jupyter: (None)
Jupyter is not available in this Python installation. Install with conda install jupyter
[✓] Checking R installation...........OK Version: 4.1.1 Path: /Library/Frameworks/R.framework/Resources LibPaths:
- /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library knitr: 1.43 rmarkdown: 2.22
[✓] Checking Knitr engine render......OK
This is an unfortunately common situation. Many operating systems install a version of Python which may or may not have a version of Conda for package installation and maintenance. To avoid the problems of tracking down other installed versions of Python and/or Conda, the PyCall.jl
package, by default, installs a version in ~/.julia/conda/3/bin/
To use quarto to render Julia-based documents you need to ensure that this is the version accessed by quarto. I did it by adding a symbolic link in /usr/local/bin/ but I'm not sure if that is the recommended approach.
@palday Do you have a recommended approach for getting the right Python? Quarto apparently looks for an environment variable QUARTO_PYTHON
(see https://quarto.org/docs/projects/environment.html). It looks as if @cyhsieh-psy is on a Mac.
Below is my hardware overview:
system_profiler SPHardwareDataType Hardware:
Hardware Overview: Model Name: MacBook Air Model Identifier: MacBookAir10,1 Model Number: MGN73TA/A Chip: Unknown Total Number of Cores: 8 (4 performance and 4 efficiency) Memory: 8 GB System Firmware Version: 8422.141.2 OS Loader Version: 8422.141.2 Serial Number (system): FVFG919XQ6L5 Hardware UUID: 846C34AD-C37D-58B4-9D45-1A796D9FBC0A Provisioning UDID: 846C34AD-C37D-58B4-9D45-1A796D9FBC0A Activation Lock Status: Enabled
@cyhsieh-psy If you can go back to your original setup, I think that's the best solution. That one file is failing to render because it has some inline R code and uses RCall
to execute it. You need to make sure that RCall is installed in the appropriate Julia environment.
For the most recent issue (uninstalled jupyter), there are two possible fixes here, let's see which is easiest. :wink:
(I think this is the better way, if it works). Basically, you need to specify which Python to grab and as @dmbates mentioned, you can do this with QUARTO_PYTHON
.
% QUARTO_PYTHON=~/.julia/conda/3/bin/python quarto check
and if that seems happy...
% QUARTO_PYTHON=~/.julia/conda/3/bin/python quarto render
% /Users/cyhsieh/miniforge3/bin/conda install jupyter
and after that completes....
% QUARTO_PYTHON=~/.julia/conda/3/bin/python quarto check
and if that seems happy...
% QUARTO_PYTHON=~/.julia/conda/3/bin/python quarto render
At this point, you might run into an error about not finding an appropriate Julia kernel, but we can cross that bridge when we get there.
Hi
I guess I'm in the right direction: it's all about the path, the directory or whatnot. The directory of python under /.julia/
folder doesn't look straightforward. I run the code below anyway but fail to find both jupyter and julia. Also I cannot install jupyter under this directory. I'm not sure if it's a right thing to do. Sorry to annoy you but I think I'm almost there ...
QUARTO_PYTHON=/Users/cyhsieh/.julia/conda/3/aarch64/bin/python quarto check
[✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.1: OK Dart Sass version 1.55.0: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.3.450 Path: /Applications/quarto/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK Version: 3.10.12 (Conda) Path: /Users/cyhsieh/.julia/conda/3/aarch64/bin/python Jupyter: (None)
Jupyter is not available in this Python installation. Install with conda install jupyter
[✓] Checking R installation...........OK Version: 4.1.1 Path: /Library/Frameworks/R.framework/Resources LibPaths:
- /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library knitr: 1.43 rmarkdown: 2.22
[✓] Checking Knitr engine render......OK
@cyhsieh-psy does everything work now?
I have added some files in branch called db/quarto
If you have julia 1.9 (the current release version) installed you can render the .qmd document after installing the IJulia package. The sequence would be
At this point you have the environment set up but you still need to install the IJulia package, usually in the global environment, not in the current project. Start julia without the --project flag and execute
Finally install quarto as described at https://quarto.org/docs/get-started/ and run
quarto check
which should produce a result likeIn particular, you want to ensure that
julia-1.9
is listed as one of the kernels in the block about Python 3 and Jupyter.Then you could try
If you substitute
preview
forrender
in the call toquarto
it will open the HTML document in a web browser.If this succeeds you can edit the file
CL2arrow.qmd
in VSCode, after installing theJulia
andQuarto
extensions, or in the RStudio IDE. As far as I can tell the "render" button works in RStudio, because it just callsquarto render
in a Terminal window, but it doesn't open a preview. Also, execution of individual code blocks doesn't work (as far as I can tell) because the IDE is not communicating with a Julia instance, just with R.Let me know if you try this and, if so, does it work?