tsinghua-fib-lab / DRL-urban-planning

A deep reinforcement learning (DRL) based approach for spatial layout of land use and roads in urban communities. (Nature Computational Science)
https://rdcu.be/dlRPZ
MIT License
155 stars 33 forks source link

Unable to load pickle file correctly #13

Closed Beau-Yang closed 1 week ago

Beau-Yang commented 3 weeks ago

Issue Description

When attempting to run your trianing command python3 -m urban_planning.train --cfg hlg --global_seed 111, the PlainClient's initialisation called load_pickle() to read the initial plan which raised an error:

# urban_planning/envs/plan_client.py -> Class PlanClient -> def __init__
self.init_plan = load_pickle(file_path)

And the following is the error information:

  File "/home/DRL-urban-planning/khrylib/utils/load_save.py", line 25, in load_pickle
    data = pickle.load(open(files[0], 'rb'))
  File "stringsource", line 4, in pyproj._crs._CRS.__setstate_cython__
TypeError: no default __reduce__ due to non-trivial __cinit__

From my understanding, this method tried to read the file urban_planning/cfg/test_data/real/hlg/init_plan_hlg.pickle but somehow it failed. I also tried to read the corresponding dhm file instead but got the same error.

Environment

Operating System: Linux

I suspect this is due to python package compatibility, but am not very sure. I created the environment via conda create --name test1 python=3.8 pandas geopandas and got the following versions of packages and above error information:

python 3.8.19
pandas 2.0.3
geopandas 0.12.2
geopandas-base 0.12.2

And then I also tried newer python via conda create --name test2 python=3.9 pandas geopandas and got the following versions of packages but a different error information:

python 3.9.19
pandas 2.2.2
geopandas 0.14.2
geopandas-base 0.14.2
No module named 'pandas.core.indexes.numeric'

Could you please share your runtime environment or give me some suggestions on how to fix this? Thanks in advance.

DavyMorgan commented 2 weeks ago

I guess it is due to the mismatch of pandas version. Please try pandas==1.4.3.

yyblbiscute commented 2 weeks ago

This method tried to read the file urban planning/cfg/test data/real/hlg/init plan hlg.pickle , but this file is missing here

712805e34212396611e6731f2ed131f

DavyMorgan commented 2 weeks ago

You can find the file at urban_planning/cfg/test_data/real/hlg/init_plan_hlg.pickle.

Beau-Yang commented 1 week ago

I guess it is due to the mismatch of pandas version. Please try pandas==1.4.3.

Thanks for your help! I configured the environment code according to your requirement.txt file and it worked fine (although I still need to use conda to force the ignore python library version incompatibility error).