[Rllib] File "/opt/conda/lib/python3.8/site-packages/ray/util/tracing/tracing_helper.py", line 461, in _resume_span TypeError: 'NoneType' object is not callable

How severe does this issue affect your experience of using Ray?

  • High: It blocks me to complete my task.

Problem

I am running the PPOTrainer with a custom environment on Ubuntu 20.04 with Python 3.8.8
After a few episodes, my training loop breaks and I get the error:

Exception ignored in: <function RolloutWorker.del at 0x7fc72a1ee700>
Traceback (most recent call last):
File “/opt/conda/lib/python3.8/site-packages/ray/util/tracing/tracing_helper.py”, line 461, in _resume_span
TypeError: ‘NoneType’ object is not callable

The error only occurs on the Ubuntu server while the code runs without problems on my local machine so I guess it could be caused by some incompatible dependencies or something like that. Would be very happy for any kind of help!

Training Loop

import ray
# custom environment classes
from gym_linkage.tradingenv_v12 import TradingEnvironment, Replay
from ray.rllib.agents.ppo import PPOTrainer

ray.init()

replay = Replay()

config = {
        "num_workers": 2,
        "env": TradingEnvironment,
        "disable_env_checking": True,
        "env_config": {
            "config": {
                "replay": replay,
        },
    }
}

rllib_trainer = PPOTrainer(config=config)

for _ in range(5):
    rllib_trainer.train()

Dependencies
Ubuntu 20.04
Python 3.8.8

absl-py==0.13.0
aiosignal==1.2.0
alembic @ file:///home/conda/feedstock_root/build_artifacts/alembic_1622150326904/work
anyio @ file:///home/conda/feedstock_root/build_artifacts/anyio_1624539389047/work/dist
appdirs @ file:///home/conda/feedstock_root/build_artifacts/appdirs_1603108395799/work
argon2-cffi @ file:///home/conda/feedstock_root/build_artifacts/argon2-cffi_1610522574055/work
astunparse==1.6.3
async-generator==1.10
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1620387926260/work
Babel @ file:///home/conda/feedstock_root/build_artifacts/babel_1619719576210/work
backcall @ file:///home/conda/feedstock_root/build_artifacts/backcall_1592338393461/work
backports.functools-lru-cache @ file:///home/conda/feedstock_root/build_artifacts/backports.functools_lru_cache_1618230623929/work
beautifulsoup4 @ file:///home/conda/feedstock_root/build_artifacts/beautifulsoup4_1601745390275/work
bleach @ file:///home/conda/feedstock_root/build_artifacts/bleach_1612213472466/work
blinker==1.4
bokeh @ file:///home/conda/feedstock_root/build_artifacts/bokeh_1625756926652/work
Bottleneck @ file:///home/conda/feedstock_root/build_artifacts/bottleneck_1611195606760/work
brotlipy==0.7.0
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
cachetools==4.2.2
certifi==2022.6.15
certipy==0.1.3
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1613413861439/work
chardet @ file:///home/conda/feedstock_root/build_artifacts/chardet_1610093490430/work
click==7.1.2
cloudpickle @ file:///home/conda/feedstock_root/build_artifacts/cloudpickle_1598400192773/work
conda==4.9.2
conda-package-handling @ file:///home/conda/feedstock_root/build_artifacts/conda-package-handling_1618231394280/work
cryptography @ file:///home/conda/feedstock_root/build_artifacts/cryptography_1616851476134/work
cycler==0.10.0
Cython @ file:///home/conda/feedstock_root/build_artifacts/cython_1623963298809/work
cytoolz==0.11.0
dask @ file:///home/conda/feedstock_root/build_artifacts/dask-core_1616804774713/work
debugpy @ file:///home/conda/feedstock_root/build_artifacts/debugpy_1620178540514/work
decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1621187651333/work
defusedxml @ file:///home/conda/feedstock_root/build_artifacts/defusedxml_1615232257335/work
dill @ file:///home/conda/feedstock_root/build_artifacts/dill_1623610058511/work
distlib==0.3.5
distributed @ file:///home/conda/feedstock_root/build_artifacts/distributed_1620931187261/work
dm-tree==0.1.7
entrypoints @ file:///home/conda/feedstock_root/build_artifacts/entrypoints_1605121927639/work/dist/entrypoints-0.3-py2.py3-none-any.whl
filelock==3.7.1
flatbuffers==1.12
frozenlist==1.3.0
fsspec @ file:///home/conda/feedstock_root/build_artifacts/fsspec_1624452401871/work
gast==0.3.3
gmpy2==2.1.0b5
google-auth==1.32.1
google-auth-oauthlib==0.4.4
google-pasta==0.2.0
graphviz==0.11
greenlet @ file:///home/conda/feedstock_root/build_artifacts/greenlet_1620327505524/work
grpcio==1.32.0
gym==0.21.0
h5py==2.10.0
HeapDict==1.0.1
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1593328102638/work
imagecodecs @ file:///home/conda/feedstock_root/build_artifacts/imagecodecs_1623996795751/work
imageio @ file:///home/conda/feedstock_root/build_artifacts/imageio_1594044661732/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1625463720459/work
ipykernel @ file:///home/conda/feedstock_root/build_artifacts/ipykernel_1625232753004/work/dist/ipykernel-6.0.1-py3-none-any.whl
ipyleaflet==0.14.0
ipympl @ file:///home/conda/feedstock_root/build_artifacts/ipympl_1611166850005/work
ipython @ file:///home/conda/feedstock_root/build_artifacts/ipython_1625027225561/work
ipython-genutils==0.2.0
ipywidgets @ file:///home/conda/feedstock_root/build_artifacts/ipywidgets_1609995587151/work
jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1610146791023/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1621419064915/work
joblib @ file:///home/conda/feedstock_root/build_artifacts/joblib_1612898609989/work
json5 @ file:///home/conda/feedstock_root/build_artifacts/json5_1600692310011/work
jsonschema @ file:///home/conda/feedstock_root/build_artifacts/jsonschema_1614815863336/work
jupyter-client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1615693636836/work
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.5.1
jupyter-core @ file:///home/conda/feedstock_root/build_artifacts/jupyter_core_1612125275706/work
jupyter-highlight-selected-word==0.2.0
jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.4.1
jupyter-packaging @ file:///home/conda/feedstock_root/build_artifacts/jupyter-packaging_1613054948399/work
jupyter-server @ file:///home/conda/feedstock_root/build_artifacts/jupyter_server_1624558637735/work
jupyter-telemetry @ file:///home/conda/feedstock_root/build_artifacts/jupyter_telemetry_1605173804246/work
jupyterhub @ file:///home/conda/feedstock_root/build_artifacts/jupyterhub-feedstock_1614255305026/work
jupyterlab @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_1616195786210/work
jupyterlab-drawio==0.9.0
jupyterlab-pygments @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_pygments_1601375948261/work
jupyterlab-server @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_server_1622556871679/work
jupyterlab-widgets @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_widgets_1609173350931/work
Keras==2.4.3
Keras-Preprocessing==1.1.2
kiwisolver @ file:///home/conda/feedstock_root/build_artifacts/kiwisolver_1610099769230/work
llvmlite==0.36.0
locket==0.2.0
lxml==4.6.3
lz4==4.0.2
Mako @ file:///home/conda/feedstock_root/build_artifacts/mako_1610659158978/work
mamba @ file:///home/conda/feedstock_root/build_artifacts/mamba_1625509571906/work
Markdown==3.3.4
MarkupSafe @ file:///home/conda/feedstock_root/build_artifacts/markupsafe_1621455677251/work
matplotlib @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-suite_1611858708474/work
matplotlib-inline @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1618935594181/work
mistune @ file:///home/conda/feedstock_root/build_artifacts/mistune_1624941302223/work
mock @ file:///home/conda/feedstock_root/build_artifacts/mock_1610094566888/work
mpmath @ file:///home/conda/feedstock_root/build_artifacts/mpmath_1612895720168/work
msgpack @ file:///home/conda/feedstock_root/build_artifacts/msgpack-python_1610121699837/work
nbclassic @ file:///home/conda/feedstock_root/build_artifacts/nbclassic_1621947328608/work
nbclient @ file:///home/conda/feedstock_root/build_artifacts/nbclient_1614336084111/work
nbconvert @ file:///home/conda/feedstock_root/build_artifacts/nbconvert_1624472649437/work
nbformat @ file:///home/conda/feedstock_root/build_artifacts/nbformat_1617383142101/work
nest-asyncio @ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1617163391303/work
networkx @ file:///home/conda/feedstock_root/build_artifacts/networkx_1598210780226/work
notebook @ file:///home/conda/feedstock_root/build_artifacts/notebook_1610575313697/work
numba @ file:///home/conda/feedstock_root/build_artifacts/numba_1623568544775/work
numexpr @ file:///home/conda/feedstock_root/build_artifacts/numexpr_1614971340455/work
numpy==1.19.5
oauthlib @ file:///home/conda/feedstock_root/build_artifacts/oauthlib_1622563202229/work
olefile @ file:///home/conda/feedstock_root/build_artifacts/olefile_1602866521163/work
opt-einsum==3.3.0
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1625323647219/work
pamela==1.0.0
pandas==1.2.5
pandocfilters==1.4.2
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1617148930513/work
partd @ file:///home/conda/feedstock_root/build_artifacts/partd_1617910651905/work
patsy==0.5.1
pexpect @ file:///home/conda/feedstock_root/build_artifacts/pexpect_1602535608087/work
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work
Pillow @ file:///home/conda/feedstock_root/build_artifacts/pillow_1625677820830/work
platformdirs==2.5.2
plotly==5.1.0
pooch @ file:///home/conda/feedstock_root/build_artifacts/pooch_1623218528920/work
prometheus-client @ file:///home/conda/feedstock_root/build_artifacts/prometheus_client_1622586138406/work
prompt-toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1623977816122/work
protobuf==3.15.8
psutil @ file:///home/conda/feedstock_root/build_artifacts/psutil_1610127095720/work
ptyprocess @ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1609419310487/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycosat @ file:///home/conda/feedstock_root/build_artifacts/pycosat_1610094800877/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1593275161868/work
pycurl==7.43.0.6
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1620245170812/work
PyJWT @ file:///home/conda/feedstock_root/build_artifacts/pyjwt_1619620644068/work
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1608055815057/work
pyparsing==2.4.7
pyrsistent @ file:///home/conda/feedstock_root/build_artifacts/pyrsistent_1610146798212/work
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1610291447907/work
python-dateutil==2.8.1
python-editor==1.0.4
python-json-logger @ file:///home/conda/feedstock_root/build_artifacts/python-json-logger_1602545356084/work
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1612179539967/work
PyWavelets @ file:///home/conda/feedstock_root/build_artifacts/pywavelets_1607290812047/work
PyYAML==5.4.1
pyzmq @ file:///home/conda/feedstock_root/build_artifacts/pyzmq_1622038460640/work
ray==1.13.0
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1608156231189/work
requests-oauthlib==1.3.0
requests-unixsocket==0.2.0
rise==5.7.1
rsa==4.7.2
ruamel-yaml-conda @ file:///home/conda/feedstock_root/build_artifacts/ruamel_yaml_1611943339799/work
ruamel.yaml @ file:///home/conda/feedstock_root/build_artifacts/ruamel.yaml_1624567361774/work
ruamel.yaml.clib @ file:///home/conda/feedstock_root/build_artifacts/ruamel.yaml.clib_1610146840614/work
scikit-image==0.18.2
scikit-learn @ file:///home/conda/feedstock_root/build_artifacts/scikit-learn_1619628586492/work
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy_1619561901336/work
seaborn @ file:///home/conda/feedstock_root/build_artifacts/seaborn-split_1611834504644/work
Send2Trash @ file:///home/conda/feedstock_root/build_artifacts/send2trash_1624366715919/work
six==1.15.0
sniffio @ file:///home/conda/feedstock_root/build_artifacts/sniffio_1610318319305/work
sortedcontainers @ file:///home/conda/feedstock_root/build_artifacts/sortedcontainers_1621217038088/work
soupsieve @ file:///home/conda/feedstock_root/build_artifacts/soupsieve_1597680516047/work
SQLAlchemy @ file:///home/conda/feedstock_root/build_artifacts/sqlalchemy_1624920405831/work
statsmodels @ file:///home/conda/feedstock_root/build_artifacts/statsmodels_1612273599609/work
sympy @ file:///home/conda/feedstock_root/build_artifacts/sympy_1610127369423/work
tables @ file:///home/conda/feedstock_root/build_artifacts/pytables_1610156075390/work
tabulate==0.8.10
tblib @ file:///home/conda/feedstock_root/build_artifacts/tblib_1616261298899/work
tenacity==8.0.0
tensorboard==2.5.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorboardX==2.5.1
tensorflow==2.4.1
tensorflow-estimator==2.4.0
termcolor==1.1.0
terminado @ file:///home/conda/feedstock_root/build_artifacts/terminado_1623365314921/work
testpath @ file:///home/conda/feedstock_root/build_artifacts/testpath_1621261527237/work
threadpoolctl @ file:///tmp/tmp79xdzxkt/threadpoolctl-2.1.0-py3-none-any.whl
tifffile @ file:///home/conda/feedstock_root/build_artifacts/tifffile_1625322421387/work
toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1600973991856/work
torch==1.10.0
torchaudio==0.10.0
torchvision==0.11.0
torchviz==0.0.2
tornado @ file:///home/conda/feedstock_root/build_artifacts/tornado_1610094706440/work
tqdm @ file:///home/conda/feedstock_root/build_artifacts/tqdm_1625664838498/work
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1602771532708/work
traittypes==0.2.1
typing-extensions==3.7.4.3
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1624634538755/work
vincent==0.4.4
virtualenv==20.16.2
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1600965781394/work
webencodings==0.5.1
websocket-client @ file:///home/conda/feedstock_root/build_artifacts/websocket-client_1610127644879/work
Werkzeug==2.0.1
widgetsnbextension @ file:///home/conda/feedstock_root/build_artifacts/widgetsnbextension_1605475534911/work
wrapt==1.12.1
xlrd @ file:///home/conda/feedstock_root/build_artifacts/xlrd_1610224409810/work
zict==2.0.0
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1625284368454/work

Hi @Mirakolix_Gallier,

That is not the actual error. The real error will be in the wall of errors you get back😂. Are you able to provide the full stacktrace?

Unfortunately, I don’t know how to do that. Is there an easy way to print the full stack trace?

Hi @Mirakolix_Gallier,

Usually when rllib breaks there are many many lines of error information printed out on the terminal. Do you see that?

No, this is everything I could see:

(RolloutWorker pid=14714) —
(RolloutWorker pid=14714)
Exception ignored in: <function RolloutWorker.del at 0x7fc706af3f70>
Traceback (most recent call last):
File “/opt/conda/lib/python3.8/site-packages/ray/util/tracing/tracing_helper.py”, line 461, in _resume_span
TypeError: ‘NoneType’ object is not callable

I downgraded to Python 3.7 and this seems to solve the issue. I also tried upgrading to Python 3.9 but this still yielded the same error. Not really a solution to the actual error but it works at least.