cmdstanpy icon indicating copy to clipboard operation
cmdstanpy copied to clipboard

_pickle.PicklingError in test_serialization: Can't pickle <class 'cmdstanpy.stanfit.gq.CmdStanGQ'>

Open SermetPekin opened this issue 1 year ago • 1 comments

I encountered a _pickle.PicklingError when running the test suite for cmdstanpy. The error occurs in the test_serialization test within test/test_generate_quantities.py. The error message indicates that Python cannot pickle the <class 'cmdstanpy.stanfit.gq.CmdStanGQ'> object because it is "not the same object" as cmdstanpy.stanfit.gq.CmdStanGQ.

This issue may be caused by module import mismatches or problems with the environment setup.

error message


FAILED test/test_generate_quantities.py::test_serialization - _pickle.PicklingError: 
Can't pickle <class 'cmdstanpy.stanfit.gq.CmdStanGQ'>: 
it's not the same object as cmdstanpy.stanfit.gq.CmdStanGQ

I use uv to build the environment, other tests are passing.

Python 3.10.9

This is the only test that is failing.

Environment Details

Operating System:
Darwin 192.168.1.33 23.5.0 Darwin Kernel Version 23.5.0: RELEASE_ARM64_T6020 arm64

Python Version:
3.10.9

CmdStanPy Installation:
file:///Users/UserName/Documents/cmdstanpy/cmdstanpy

Installed Python Packages:
exceptiongroup==1.2.2
iniconfig==2.0.0
numpy==2.2.2
packaging==24.2
pandas==2.2.3
pluggy==1.5.0
pytest==8.3.4
python-dateutil==2.9.0.post0
pytz==2024.2
six==1.17.0
stanio==0.5.1
tomli==2.2.1
tqdm==4.67.1
tzdata==2025.1
xarray==2025.1.1

SermetPekin avatar Jan 25 '25 12:01 SermetPekin

This issue may be caused by module import mismatches or problems with the environment setup.

In my experience it is usually an environment issue. I think installing from a path but not editable can lead to this?

WardBrian avatar Jan 27 '25 15:01 WardBrian

Closing as stale

WardBrian avatar Oct 20 '25 19:10 WardBrian