holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.61k stars 500 forks source link

Loading a pickled object works in Jupyter, not in panel serve #2360

Closed marketneutral closed 3 years ago

marketneutral commented 3 years ago

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)

Jupyter and panel serve running on Ubuntu. Chrome browser running on Windows 10.

I've confirmed that a simple panel app works with panel serve. I cannot get the pickled object to load; it works in the Jupyter session, not in panel serve.

16:37 $ pip freeze
absl-py==0.9.0
adal==1.2.2
affine==2.3.0
aiohttp==3.6.2
alabaster==0.7.12
albumentations==0.4.5
alembic==1.4.2
allennlp==1.0.0
altair==4.1.0
anaconda-client==1.7.2
anaconda-project==0.8.3
annoy==1.16.3
ansiwrap==0.8.4
anyio==3.1.0
appdirs==1.4.3
argh==0.26.2
argon2-cffi==20.1.0
arrow==0.15.5
arviz==0.8.3
asn1crypto==1.3.0
astor==0.8.1
astroid==2.3.3
astropy==4.0.1.post1
astunparse==1.6.3
async-generator==1.10
async-timeout==3.0.1
atomicwrites==1.3.0
attrs==19.3.0
audioread==2.1.8
autopep8==1.5.1
azure-core==1.15.0
azure-datalake-store==0.0.52
azure-storage-blob==12.8.1
Babel==2.8.0
backcall==0.1.0
backoff==1.10.0
backports.shutil-get-terminal-size==1.0.0
Baker==1.3
base58==2.1.0
basemap==1.2.1
bayesian-optimization @ git+https://github.com/fmfn/BayesianOptimization.git@cb28df83f757c5c7406b2730eac3a67a2d0270a5
bayespy==0.5.19
bcolz==1.2.1
beautifulsoup4==4.9.0
binaryornot==0.4.4
biopython==1.77
bitarray==1.2.1
bkcharts==0.2
black==19.10b0
bleach==3.1.4
blinker==1.4
blis==0.4.1
bokeh==2.3.2
Boruta==0.3
boto==2.49.0
boto3==1.16.40
botocore==1.19.63
Bottleneck==1.3.2
-e git+https://github.com/SohierDane/BigQuery_Helper@8615a7f6c1663e7f2d48aa2b32c2dbcb600a440f#egg=bq_helper
bqplot==0.12.12
branca==0.4.1
brewer2mpl==1.4.1
brotlipy==0.7.0
cachetools==4.2.2
cairocffi==1.1.0
CairoSVG==2.4.2
Cartopy @ file:///home/conda/feedstock_root/build_artifacts/cartopy_1588596947365/work
catalogue==1.0.0
catalyst==20.6
catboost==0.23.2
category-encoders @ git+https://github.com/scikit-learn-contrib/categorical-encoding.git@ea9428a896bef77baf8b26159f7030cee924e916
certifi==2021.5.30
cesium==0.9.12
cffi==1.14.0
cftime==1.1.3
chainer==7.4.0
chainer-chemistry==0.7.0
chainercv==0.13.1
chardet==3.0.4
-e git+http://gitlab/jlarkin/cimclib.git@c39971b61991d0270d8d504974f7ca8cfb33338b#egg=cimclib
cleverhans==3.0.1
click==7.1.1
click-plugins==1.1.1
cliff==3.3.0
cligj==0.5.0
cloud-tpu-client==0.10
cloudpickle==1.3.0
clyent==1.2.2
cmaes==0.5.0
cmd2==1.1.0
cmdstanpy==0.4.0
cmudict==0.4.4
colorama==0.4.3
colorcet==2.0.2
colorlog==4.1.0
colorlover==0.3.0
conda==4.10.1
conda-package-handling==1.6.0
ConfigArgParse==1.2.3
configparser==5.0.0
confuse==1.1.0
contextily==1.0.0
contextlib2==0.6.0.post1
contexttimer==0.3.3
convertdate==2.2.1
conx==3.7.10
cookiecutter==1.7.0
coverage==5.1
crc32c==2.0
cryptography==2.8
cssselect2==0.3.0
cufflinks==0.17.3
CVXcanon==0.1.1
cvxpy==1.1.1
cycler==0.10.0
cymem==2.0.3
cysignals==1.10.2
Cython==0.29.20
cytoolz==0.10.1
dask==2.18.1
dask-glm==0.2.0
dask-ml==1.5.0
dask-xgboost==0.1.10
datashader==0.11.0
datashape==0.5.2
datatable==0.11.1
deap==1.3.1
decorator==4.4.2
deepdish==0.3.6
defusedxml==0.6.0
Delorean==1.0.0
Deprecated @ file:///home/conda/feedstock_root/build_artifacts/deprecated_1589409885623/work
deprecation==2.1.0
descartes==1.1.0
diff-match-patch==20181111
dill==0.3.2
dipy==1.1.1
distributed==2.14.0
dlib==19.20.0
docker==4.2.0
docker-pycreds==0.4.0
docopt==0.6.2
docutils==0.15.2
earthengine-api==0.1.226
ecos==2.0.7.post1
eli5==0.10.1
emoji==0.5.4
en-core-web-lg @ https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-2.2.5/en_core_web_lg-2.2.5.tar.gz
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz
entrypoints==0.3
ephem==3.7.7.1
essentia==2.1b6.dev234
et-xmlfile==1.0.1
fancyimpute==0.5.4
fastai==1.0.61
fastcache==1.1.0
fastprogress==0.2.3
fasttext==0.9.2
fbpca==1.0
fbprophet==0.6
feather-format==0.4.1
featuretools==0.16.0
filelock==3.0.10
Fiona==1.8.13
fitter==1.2.1
flake8==3.7.9
flashtext==2.7
Flask==1.1.2
folium==0.11.0
fsspec==0.7.2
funcy==1.14
fury==0.5.1
future==0.18.2
fuzzywuzzy==0.18.0
gast==0.3.3
gatspy==0.3
gcsfs==0.6.1
GDAL==3.0.4
gensim==3.8.3
geographiclib==1.50
Geohash==1.0
geojson==2.5.0
geopandas==0.6.3
geoplot==0.4.1
geopy==1.22.0
geoviews==1.8.1
getjson==1.0.0
gevent==1.5.0
ggplot @ https://github.com/hbasria/ggpy/archive/0.11.5.zip
gitdb==4.0.4
GitPython==3.1.1
glob2==0.7
gluoncv==0.7.0
gluonnlp==0.9.1
gmpy2==2.1.0b1
google==2.0.3
google-api-core==1.17.0
google-api-python-client==1.8.0
google-auth==1.14.0
google-auth-httplib2==0.0.3
google-auth-oauthlib==0.4.1
google-cloud-automl==0.10.0
google-cloud-bigquery==1.12.1
google-cloud-bigtable==1.2.1
google-cloud-core==1.3.0
google-cloud-dataproc==0.7.0
google-cloud-datastore==1.12.0
google-cloud-firestore==1.6.2
google-cloud-kms==1.4.0
google-cloud-language==1.3.0
google-cloud-logging==1.15.0
google-cloud-pubsub==1.4.3
google-cloud-scheduler==1.2.1
google-cloud-spanner==1.15.1
google-cloud-speech==1.3.2
google-cloud-storage==1.27.0
google-cloud-tasks==1.5.0
google-cloud-translate==2.0.1
google-cloud-videointelligence==1.14.0
google-cloud-vision==1.0.0
google-pasta==0.2.0
google-resumable-media==0.5.0
googleapis-common-protos==1.51.0
gplearn==0.4.1
gpxpy==1.4.1
gql==0.2.0
graphql-core==1.1
graphviz==0.8.4
greenlet==0.4.15
grpc-google-iam-v1==0.12.3
grpcio==1.29.0
grpcio-gcp==0.2.2
gym==0.17.2
h2o==3.30.0.5
h5py==2.10.0
haversine==2.2.0
heamy==0.0.7
HeapDict==1.0.1
hep-ml==0.6.1
hmmlearn==0.2.3
holidays==0.10.2
holoviews==1.13.2
hpsklearn==0.1.0
html5lib==1.0.1
htmlmin==0.1.12
httplib2==0.17.2
httplib2shim==0.0.3
humanize==2.4.0
hunspell==0.5.5
husl==4.0.3
hyperopt==0.2.4
hypertools==0.6.2
hypothesis==5.10.0
ibis-framework==1.3.0
idna==2.9
imagecodecs==2020.5.30
ImageHash==4.1.0
imageio==2.8.0
imagesize==1.2.0
imbalanced-learn==0.7.0
imgaug==0.2.6
implicit==0.4.2
importlib-metadata==1.6.0
intervaltree==3.0.2
ipykernel==5.5.0
ipython==7.13.0
ipython-genutils==0.2.0
ipython-sql==0.3.9
ipyvue==1.5.0
ipyvuetify==1.6.2
ipywidgets==7.5.1
iso3166==1.0.1
isodate==0.6.0
isort==4.3.21
isoweek==1.3.3
itsdangerous==1.1.0
Janome==0.3.10
jdcal==1.4.1
jedi==0.15.2
jeepney==0.4.3
jieba==0.42.1
Jinja2==2.11.3
jinja2-time==0.2.0
jmespath==0.10.0
joblib==0.14.1
joypy==0.2.2
json5==0.9.0
jsonnet==0.16.0
jsonpickle==1.4.1
jsonschema==3.2.0
jupyter==1.0.0
jupyter-aihub-deploy-extension==0.1
jupyter-client==6.1.3
jupyter-console==6.1.0
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.5.1
jupyter-core==4.6.3
jupyter-highlight-selected-word==0.2.0
jupyter-http-over-ws==0.0.8
jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.4.1
jupyter-server==1.8.0
jupyterhub==0.9.4
jupyterlab==1.2.10
jupyterlab-git==0.10.0
jupyterlab-pygments==0.1.2
jupyterlab-server==1.1.1
jupyterlab-widgets==1.0.0
kaggle==1.5.6
kaggle-environments==1.0.8
Keras==2.4.0
Keras-Preprocessing==1.1.2
keras-tuner==1.0.1
keyring==21.1.1
kiwisolver==1.2.0
kmapper==1.2.0
kmeans-smote==0.1.2
kmodes==0.10.2
knnimpute==0.1.0
korean-lunar-calendar==0.2.1
kornia==0.3.1
kubernetes==10.1.0
langid==1.1.6
Lasagne @ git+git://github.com/Lasagne/Lasagne.git@5d3c63cb315c50b1cbd27a6bc8664b406f34dd99
lazy-object-proxy==1.4.3
ldap3==2.7
learntools @ git+https://github.com/Kaggle/learntools@886f5c215de079287f21e2d3a92bd852fb95d105
leven==1.0.4
libarchive-c==2.9
librosa==0.7.2
lief==0.9.0
lightfm==1.15
lightgbm==3.1.1
lime==0.2.0.0
line-profiler==3.0.2
llvmlite==0.31.0
lml==0.0.9
locket==0.2.0
LunarCalendar==0.0.9
lxml==4.5.0
Mako==1.1.3
mapclassify==2.3.0
marisa-trie==0.7.5
Markdown==3.2.1
markovify==0.8.2
MarkupSafe==1.1.1
matplotlib==3.2.1
matplotlib-venn==0.11.5
mccabe==0.6.1
memory-profiler==0.57.0
mercantile==1.1.5
microconventions==0.0.5
microprediction==0.9.21
missingno==0.4.2
mistune==0.8.4
mizani==0.7.1
mkl-fft==1.1.0
mkl-random==1.1.0
mkl-service==2.3.0
ml-metrics==0.1.4
mlcrate==0.2.0
mlens==0.2.3
mlxtend==0.17.2
mmh3==2.5.1
mne==0.20.7
mnist==0.2.2
mock==3.0.5
more-itertools==8.2.0
mpld3==0.5.1
mplleaflet==0.0.5
mpmath==1.1.0
msgpack==0.6.2
msgpack-numpy==0.4.6.post0
msrest==0.6.21
muid==0.4.8
multidict==4.7.6
multipledispatch==0.6.0
multiprocess==0.70.10
munch==2.5.0
murmurhash==1.0.2
mxnet==1.6.0
mypy-extensions==0.4.3
nb-conda @ file:///home/conda/feedstock_root/build_artifacts/nb_conda_1611345550379/work
nb-conda-kernels==2.2.3
nbclient==0.5.3
nbconvert==6.0.7
nbdime==2.0.0
nbformat==5.0.6
nbpresent==3.0.2
nervananeon @ file:///usr/local/src/neon
nest-asyncio==1.3.2
netCDF4==1.5.3
networkx==2.4
nibabel==3.1.0
nilearn==0.6.2
nltk==3.2.4
nnabla==1.8.0
nolearn==0.6.1
nose==1.3.7
notebook==5.5.0
notebook-executor==0.2
nteract-scrapbook==0.4.2
numba==0.48.0
numexpr==2.7.1
numpy==1.18.1
numpydoc==0.9.2
nvidia-ml-py3==7.352.0
oauth2client==4.1.3
oauthlib==3.0.1
odfpy==1.4.1
olefile==0.46
onnx==1.7.0
opencv-python==4.2.0.34
openpyxl==3.0.7
openslide-python @ git+git://github.com/rosbo/openslide-python.git@6bb6e3dbae448fe9ccf21a5a2078e9d7e890153c
opt-einsum==3.2.1
optuna==1.5.0
orderedmultidict==1.0.1
ortools==7.7.7810
osmnx==0.14.1
osqp==0.6.1
overrides==3.0.0
OWSLib @ file:///home/conda/feedstock_root/build_artifacts/owslib_1591376955812/work
packaging==20.1
palettable==3.3.0
pamela==1.0.0
pandas==1.0.3
pandas-datareader==0.8.1
pandas-profiling==2.6.0
pandas-summary==0.0.7
pandasql==0.7.3
pandoc==1.0.2
pandocfilters==1.4.2
panel==0.11.3
papermill==2.1.0
param==1.10.1
parso==0.5.2
partd==1.1.0
path==13.1.0
path.py==12.4.0
pathlib==1.0.1
pathlib2==2.3.5
pathos==0.2.6
pathspec==0.8.0
pathtools==0.1.2
patsy==0.5.1
pbr==5.4.5
pdf2image==1.13.1
PDPbox @ git+https://github.com/SauceCat/PDPbox@73c69665f1663b53984e187c7bc8996e25fea18e
pep8==1.7.1
pexpect==4.8.0
pgmpy==0.1.7
phik==0.9.11
pickleshare==0.7.5
Pillow==8.2.0
pkginfo==1.5.0.1
plac==1.1.3
plotly==4.9.0
plotly-express==0.4.1
plotnine==0.7.0
pluggy==0.13.0
ply==3.11
polyglot==16.7.4
portalocker==1.7.0
posix-ipc==1.0.4
pox==0.2.8
poyo==0.5.0
ppca==0.0.4
ppft==1.6.6.2
preprocessing==0.1.13
preshed==3.0.2
prettytable==0.7.2
prometheus-client==0.7.1
promise==2.3
prompt-toolkit==3.0.5
pronouncing==0.2.0
protobuf==3.12.2
psutil==5.7.0
ptyprocess==0.6.0
pudb==2019.2
py==1.8.1
py-cpuinfo==6.0.0
py-lz4framed==0.14.0
py-spy==0.3.3
py-stringmatching==0.4.1
py-stringsimjoin==0.3.1
pyahocorasick==1.4.0
pyaml==20.4.0
PyArabic==0.6.7
pyarrow==0.16.0
pyasn1==0.4.8
pyasn1-modules==0.2.7
PyAstronomy==0.15.0
pybind11==2.5.0
PyBrain==0.3
pycairo==1.19.1
pycodestyle==2.5.0
pycoingecko==1.3.0
pycosat==0.6.3
pycountry==19.8.18
pycparser==2.20
pycrypto==2.6.1
pyct==0.4.6
pycurl==7.43.0.5
pydash==4.8.0
pydeck==0.6.2
pydicom==2.0.0
pydocstyle==5.0.2
pydot==1.4.1
pydub==0.24.1
pyemd==0.5.1
pyepsg==0.4.0
pyexcel-io==0.5.20
pyexcel-ods==0.5.6
pyfasttext==0.4.6
pyflakes==2.1.1
pyglet==1.5.0
Pygments==2.6.1
PyJWT==1.7.1
pykalman==0.9.5
pyLDAvis==2.1.2
pylint==2.4.4
pymc3==3.9.1
PyMeeus==0.3.7
pymongo==3.10.1
pymorton==1.0.5
Pympler==0.8
pymsteams==0.1.13
pyocr==0.7.2
pyodbc==4.0.30
pyOpenSSL==19.1.0
pypandoc==1.5
pyparsing==2.4.7
pyPdf==1.13
pyperclip==1.8.0
PyPrind==2.11.2
pyproj @ file:///home/conda/feedstock_root/build_artifacts/pyproj_1588596070165/work
PyQt5==5.12.3
PyQt5-sip==4.19.18
PyQtWebEngine==5.12.1
pyrsistent==0.16.0
pysal==2.1.0
pyshp==2.1.0
PySocks==1.7.1
pystan==2.19.1.1
pytagcloud==0.3.5
pytesseract==0.3.4
pytest==5.4.1
pytest-arraydiff==0.3
pytest-astropy==0.7.0
pytest-astropy-header==0.1.2
pytest-cov==2.10.0
pytest-doctestplus==0.4.0
pytest-mock==3.1.1
pytest-openfiles==0.4.0
pytest-remotedata==0.3.1
pytest-tornasync==0.6.0.post2
pytext-nlp==0.1.2
python-dateutil==2.8.1
python-editor==1.0.4
python-igraph @ file:///home/conda/feedstock_root/build_artifacts/python-igraph_1588168236405/work
python-jsonrpc-server==0.3.4
python-language-server==0.31.10
python-Levenshtein==0.12.0
python-louvain==0.14
python-oauth2==1.1.1
python-slugify==4.0.0
pytorch-ignite==0.3.0
pytz==2019.3
PyUpSet==0.1.1.post7
pyviz-comms==0.7.5
PyWavelets==1.1.1
pyxdg==0.26
PyYAML==5.3.1
pyzmq==19.0.0
QDarkStyle==2.8.1
qgrid==1.3.1
QtAwesome==0.7.1
qtconsole==4.7.3
QtPy==1.9.0
randomgen==1.16.6
rasterio==1.1.5
ray==0.8.5
redis==3.4.1
regex==2020.4.4
requests==2.23.0
requests-oauthlib==1.2.0
resampy==0.2.2
retrying==1.3.3
rgf-python==3.8.0
risk-infrastructure==0.1.1351b0
rope==0.16.0
rsa==4.0
Rtree==0.9.4
ruamel-yaml==0.15.80
s2sphere==0.2.5
s3fs==0.4.2
s3transfer==0.3.3
sacred==0.8.1
sacremoses==0.0.43
scattertext==0.0.2.65
scikit-image==0.16.2
scikit-learn==0.23.1
scikit-multilearn==0.2.0
scikit-optimize==0.7.4
scikit-plot==0.3.7
scikit-surprise==1.1.0
scipy==1.4.1
scs==2.1.2
seaborn==0.9.1
SecretStorage==3.1.2
Send2Trash==1.5.0
sentencepiece==0.1.91
sentry-sdk==0.15.1
setuptools-git==1.2
shap==0.35.0
Shapely==1.7.0
shortuuid==1.0.1
simplegeneric==0.8.1
SimpleITK==1.2.4
simplejson==3.17.0
singledispatch==3.4.0.3
sip==4.19.20
six==1.14.0
sklearn==0.0
sklearn-contrib-py-earth @ git+git://github.com/scikit-learn-contrib/py-earth.git@dde5f899255411a7b9cbbabf93a817eff4b02e5e
sklearn-pandas==1.8.0
smart-open==2.0.0
smhasher==0.150.1
smmap==3.0.2
sniffio==1.2.0
snowballstemmer==2.0.0
snuggs==1.4.7
sortedcollections==1.1.2
sortedcontainers==2.1.0
SoundFile==0.10.3.post1
soupsieve==1.9.4
spacy==2.2.4
spectral==0.21
Sphinx==3.0.2
sphinx-rtd-theme==0.2.4
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
sphinxcontrib-websupport==1.2.1
spyder==4.1.2
spyder-kernels==1.9.0
SQLAlchemy==1.3.16
sqlparse==0.3.1
squarify==0.4.3
srsly==1.0.2
statsmodels==0.12.2
stemming==1.0.1
stevedore==2.0.0
stop-words==2018.7.23
stopit==1.1.2
streamlit==0.77.0
streamlit-aggrid==0.1.9
subprocess32==3.5.4
svgwrite==1.4
sympy==1.5.1
tables==3.6.1
tabulate==0.8.7
tangled-up-in-unicode==0.0.4
tblib==1.6.0
tenacity==6.1.0
tensorboard==2.2.2
tensorboard-plugin-wit==1.6.0.post3
tensorboardX==2.0
tensorflow @ file:///tmp/tensorflow_cpu/tensorflow-2.2.0-cp37-cp37m-linux_x86_64.whl
tensorflow-addons @ file:///tmp/tfa_cpu/tensorflow_addons-0.10.0-cp37-cp37m-linux_x86_64.whl
tensorflow-datasets==3.1.0
tensorflow-estimator==2.2.0
tensorflow-gcs-config @ file:///tmp/tensorflow_gcs_config/tensorflow_gcs_config-2.1.7-py3-none-any.whl
tensorflow-hub==0.8.0
tensorflow-metadata==0.22.2
tensorflow-probability==0.10.0
Tensorforce==0.5.5
tensorpack==0.10.1
termcolor==1.1.0
terminado==0.8.3
terminalplot==0.3.0
terminaltables==3.1.0
testpath==0.4.4
text-unidecode==1.3
textblob==0.15.3
texttable==1.6.2
textwrap3==0.9.2
Theano==1.0.4
thinc==7.4.0
threadpoolctl==2.1.0
tifffile==2020.6.3
tinycss2==1.0.2
tokenizers==0.7.0
toml==0.10.0
toolz==0.10.0
torch==1.5.0
torchaudio==0.5.0a0+738ccba
torchtext==0.6.0
torchvision==0.6.0a0+35d732a
tornado==5.1.1
TPOT==0.11.5
tqdm==4.45.0
traitlets==4.3.3
traittypes==0.2.1
transformers==2.11.0
treeinterpreter==0.2.2
trueskill==0.4.5
tsfresh==0.16.0
typed-ast==1.4.1
typeguard==2.9.1
typing==3.7.4.1
typing-extensions==3.7.4.1
tzlocal==2.1
ujson==1.35
umap-learn @ https://api.github.com/repos/lmcinnes/umap/tarball/5f9488a9540d1e0ac149e2dd42ebf03c39706110
unicodecsv==0.14.1
Unidecode==1.1.1
update-checker==0.17
uritemplate==3.0.1
urllib3==1.25.11
urwid==2.1.0
validators==0.18.2
vecstack==0.4.0
vega==3.4.0
vega-datasets==0.9.0
visions==0.4.1
voila==0.2.10
voila-gridstack==0.2.0
voila-vuetify==0.5.2
vowpalwabbit==8.8.1
vtk==8.1.2
Wand==0.5.3
wandb==0.9.1
wasabi==0.6.0
watchdog==0.10.2
waterfallcharts==3.8
wavio==0.0.4
wcwidth==0.1.9
webencodings==0.5.1
websocket-client==0.57.0
Werkzeug==1.0.1
wfdb==3.0.1
whichcraft==0.6.1
widgetsnbextension==3.5.1
Wordbatch==1.4.6
wordcloud==1.7.0
wordsegment==1.3.1
wrapt==1.11.2
wurlitzer==2.0.0
xarray==0.15.1
xgboost==1.1.1
xlrd==1.2.0
XlsxWriter==1.2.8
xlwt==1.3.0
xvfbwrapper==0.2.9
yapf==0.29.0
yarl==1.4.2
yellowbrick==1.1
zict==2.0.0
zipp==3.1.0

Description of expected behavior and the observed behavior

I can load a pickled object in a notebook session, but not in a panel serve session.

This throws the error in the browser below.

Complete, minimal, self-contained example code that reproduces the issue

Notebook: Untiltled.ipynb

import numpy as np
import pickle

class MyObj():
    data = None

my_obj = MyObj()
my_obj.data = np.random.random(100)

with open('myobj.pickle', 'wb') as handle:
    pickle.dump(my_obj, handle)

Notebook: Untiltled1.ipynb

import panel as pn
pn.extension()

import numpy as np
import pandas as pd
import pickle

class MyObj():
    data = None

my_obj = None
with open('myobj.pickle', 'rb') as handle:
    my_obj = pickle.load(handle)

pn.Column(pn.widgets.Tabulator(pd.DataFrame(my_obj.data))).servable()

Stack traceback and/or browser JavaScript console output

Stack trace in the browser

AttributeError: Can't get attribute 'MyObj' on
Traceback (most recent call last):
  File "/home/jovyan/.local/lib/python3.7/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
    exec(self._code, module.__dict__)
  File "/home/jovyan/panel-repro/Untitled1.ipynb", line 19, in <module>
    "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
AttributeError: Can't get attribute 'MyObj' on <module '__main__' from '/opt/conda/bin/panel'>

Screenshots or screencasts of the bug in action

Works fine in Jupyter: image

Fails on panel serve in browser image

philippjfr commented 3 years ago

Loading pickles referencing dynamically defined objects is always going to be a mess. I'd strongly urge moving your MyObj into an importable module, at that point this should work just fine.

marketneutral commented 3 years ago

This example is just a minimal reproducible error. In the actual problem I have a large existing codebase and am trying to build a panel app around it. In that codebase there are large objects which have been pickled which I need to load.

philippjfr commented 3 years ago

Sure, but I'd like to see an example that pickles an object type which is not defined dynamically in the app itself. Right now that is definitely not supported because of the way the Bokeh server dynamically creates a module for the script or notebook being served.

marketneutral commented 3 years ago

Ok - this repro example works when I move MyObj out into a .py file and then import it into each of the notebooks. Thanks.