-
DescriptionI created and published a basic website by doing the following:
> quarto publish quarto-pub
? Authorize (Y/n) › Yes
? Site name: › oatsite
[✓] Creating quarto-pub site
Rendering for publish:
[1/3] index.qmd
[2/3] about.qmd
[3/3] hello.qmd
Executing 'hello.ipynb'
Cell 1/1...Done
[✓] Preparing to publish site
[✓] Uploading files (complete)
[✓] Deploying published site
[✓] Published site: https://oat.quarto.pub/oatsite
[✓] Account site updated: https://oat.quarto.pub Then, I added a page ---
title: "Quarto Basics"
format:
html:
code-fold: true
---
For a demonstration of a line plot on a polar axis, see @fig-polar.
\```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
subplot_kw = {'projection': 'polar'}
)
ax.plot(theta, r);
ax.set_rticks([0.5, 1, 1.5, 2]);
ax.grid(True);
plt.show()
\``` This page with the chart can be published to ![]() However, once I added the following code in the
I got the following error after running ╰─ quarto publish quarto-pub
? Publish update to: › Add a new destination...
? Publish with account: › [email protected]
? Publish with name: › oatsite_plotly
[✓] Creating quarto-pub site
Rendering for publish:
[1/3] index.qmd
[2/3] about.qmd
[3/3] hello.qmd
Starting python3 kernel...Done
Executing 'hello.ipynb'
Cell 1/2...Done
Cell 2/2...ERROR:
An error occurred while executing the following cell:
------------------
import plotly.express as px
import plotly.io as pio
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length",
color="species",
marginal_y="violin", marginal_x="box",
trendline="ols", template="simple_white")
fig.show()
------------------
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[2], line 4
2 import plotly.io as pio
3 df = px.data.iris()
----> 4 fig = px.scatter(df, x="sepal_width", y="sepal_length",
5 color="species",
6 marginal_y="violin", marginal_x="box",
7 trendline="ols", template="simple_white")
8 fig.show()
File ~/opt/anaconda3/lib/python3.8/site-packages/plotly/express/_chart_types.py:66, in scatter(data_frame, x, y, color, symbol, size, hover_name, hover_data, custom_data, text, facet_row, facet_col, facet_col_wrap, facet_row_spacing, facet_col_spacing, error_x, error_x_minus, error_y, error_y_minus, animation_frame, animation_group, category_orders, labels, orientation, color_discrete_sequence, color_discrete_map, color_continuous_scale, range_color, color_continuous_midpoint, symbol_sequence, symbol_map, opacity, size_max, marginal_x, marginal_y, trendline, trendline_options, trendline_color_override, trendline_scope, log_x, log_y, range_x, range_y, render_mode, title, template, width, height)
12 def scatter(
13 data_frame=None,
14 x=None,
(...)
60 height=None,
61 ):
62 """
63 In a scatter plot, each row of `data_frame` is represented by a symbol
64 mark in 2D space.
65 """
---> 66 return make_figure(args=locals(), constructor=go.Scatter)
File ~/opt/anaconda3/lib/python3.8/site-packages/plotly/express/_core.py:2123, in make_figure(args, constructor, trace_patch, layout_patch)
2120 elif args["ecdfnorm"] == "percent":
2121 group[var] = 100.0 * group[var] / group_sum
-> 2123 patch, fit_results = make_trace_kwargs(
2124 args, trace_spec, group, mapping_labels.copy(), sizeref
2125 )
2126 trace.update(patch)
2127 if fit_results is not None:
File ~/opt/anaconda3/lib/python3.8/site-packages/plotly/express/_core.py:358, in make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref)
356 trace_patch["x"] = sorted_trace_data[args["x"]][non_missing]
357 trendline_function = trendline_functions[attr_value]
--> 358 y_out, hover_header, fit_results = trendline_function(
359 args["trendline_options"],
360 sorted_trace_data[args["x"]],
361 x,
362 y,
363 args["x"],
364 args["y"],
365 non_missing,
366 )
367 assert len(y_out) == len(
368 trace_patch["x"]
369 ), "missing-data-handling failure in trendline code"
370 trace_patch["y"] = y_out
File ~/opt/anaconda3/lib/python3.8/site-packages/plotly/express/trendline_functions/__init__.py:43, in ols(trendline_options, x_raw, x, y, x_label, y_label, non_missing)
37 if k not in valid_options:
38 raise ValueError(
39 "OLS trendline_options keys must be one of [%s] but got '%s'"
40 % (", ".join(valid_options), k)
41 )
---> 43 import statsmodels.api as sm
45 add_constant = trendline_options.get("add_constant", True)
46 log_x = trendline_options.get("log_x", False)
File ~/opt/anaconda3/lib/python3.8/site-packages/statsmodels/api.py:71
1 # -*- coding: utf-8 -*-
3 __all__ = [
4 "BayesGaussMI",
5 "BinomialBayesMixedGLM",
(...)
67 "webdoc",
68 ]
---> 71 from . import datasets, distributions, iolib, regression, robust, tools
72 from .__init__ import test
73 from .discrete.count_model import (
74 ZeroInflatedGeneralizedPoisson,
75 ZeroInflatedNegativeBinomialP,
76 ZeroInflatedPoisson,
77 )
File ~/opt/anaconda3/lib/python3.8/site-packages/statsmodels/distributions/__init__.py:2
1 from statsmodels.tools._testing import PytestTester
----> 2 from .empirical_distribution import ECDF, monotone_fn_inverter, StepFunction
3 from .edgeworth import ExpandedNormal
4 from .discrete import genpoisson_p, zipoisson, zigenpoisson, zinegbin
File ~/opt/anaconda3/lib/python3.8/site-packages/statsmodels/distributions/empirical_distribution.py:5
1 """
2 Empirical CDF Functions
3 """
4 import numpy as np
----> 5 from scipy.interpolate import interp1d
7 def _conf_set(F, alpha=.05):
8 r"""
9 Constructs a Dvoretzky-Kiefer-Wolfowitz confidence band for the eCDF.
10
(...)
26 Wasserman, L. 2006. `All of Nonparametric Statistics`. Springer.
27 """
File ~/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/__init__.py:165
1 """
2 ========================================
3 Interpolation (:mod:`scipy.interpolate`)
(...)
163 (should not be used in new code).
164 """
--> 165 from .interpolate import *
166 from .fitpack import *
168 # New interface to fitpack library:
File ~/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/interpolate.py:11
7 import numpy as np
8 from numpy import (array, transpose, searchsorted, atleast_1d, atleast_2d,
9 ravel, poly1d, asarray, intp)
---> 11 import scipy.special as spec
12 from scipy.special import comb
13 from scipy._lib._util import prod
File ~/opt/anaconda3/lib/python3.8/site-packages/scipy/special/__init__.py:633
1 """
2 ========================================
3 Special functions (:mod:`scipy.special`)
(...)
628
629 """
631 from .sf_error import SpecialFunctionWarning, SpecialFunctionError
--> 633 from . import _ufuncs
634 from ._ufuncs import *
636 from . import _basic
ImportError: dlopen(/Users/minioat/opt/anaconda3/lib/python3.8/site-packages/scipy/special/_ufuncs.cpython-38-darwin.so, 0x0002): Library not loaded: @rpath/libgfortran.3.dylib
Referenced from: <58EBC3B1-D5F6-34B9-94FC-34B232E83AB0> /Users/minioat/opt/anaconda3/lib/python3.8/site-packages/scipy/special/_ufuncs.cpython-38-darwin.so
Reason: tried: '/Users/minioat/opt/anaconda3/lib/python3.8/site-packages/scipy/special/../../../../libgfortran.3.dylib' (no such file), '/Users/minioat/opt/anaconda3/lib/python3.8/site-packages/scipy/special/../../../../libgfortran.3.dylib' (no such file), '/Users/minioat/opt/anaconda3/bin/../lib/libgfortran.3.dylib' (no such file), '/Users/minioat/opt/anaconda3/bin/../lib/libgfortran.3.dylib' (no such file), '/usr/local/lib/libgfortran.3.dylib' (no such file), '/usr/lib/libgfortran.3.dylib' (no such file, not in dyld cache)
ImportError: dlopen(/Users/minioat/opt/anaconda3/lib/python3.8/site-packages/scipy/special/_ufuncs.cpython-38-darwin.so, 0x0002): Library not loaded: @rpath/libgfortran.3.dylib
Referenced from: <58EBC3B1-D5F6-34B9-94FC-34B232E83AB0> /Users/minioat/opt/anaconda3/lib/python3.8/site-packages/scipy/special/_ufuncs.cpython-38-darwin.so
Reason: tried: '/Users/minioat/opt/anaconda3/lib/python3.8/site-packages/scipy/special/../../../../libgfortran.3.dylib' (no such file), '/Users/minioat/opt/anaconda3/lib/python3.8/site-packages/scipy/special/../../../../libgfortran.3.dylib' (no such file), '/Users/minioat/opt/anaconda3/bin/../lib/libgfortran.3.dylib' (no such file), '/Users/minioat/opt/anaconda3/bin/../lib/libgfortran.3.dylib' (no such file), '/usr/local/lib/libgfortran.3.dylib' (no such file), '/usr/lib/libgfortran.3.dylib' (no such file, not in dyld cache) I do have So, may I ask why the chart generated with Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You appear to have multiple python setups, and somehow the one under |
Beta Was this translation helpful? Give feedback.
Thanks, @cscheid.
I seemed to have solved this issue by changing my current
conda env
, which is thebase
env, to a new one, in which all the modules/libraries are installed again, e.g.numpy
,matplotlib
,matplotlib-inline
,plotly
, etc.Then, within this new
conda env
, I managed to successfully publish the website with a chart generated byplotly
with all its interactivity implemented.I don't know why this works, and it's probably related to the "messy python installations" on my computer as you pointed out above.
Anyway, thanks, again.