OliverSherouse / wbdata

A python library for accessing world bank data
GNU General Public License v2.0
183 stars 54 forks source link

Stalled import on Mac OS and Python 3.12 #74

Open danielhuppmann opened 7 months ago

danielhuppmann commented 7 months ago

We just switched from pandas-data reader to wbdata as a dependency for the pyam package, see https://pyam-iamc.readthedocs.io.

I have the following issue on Mac OS 14.2.1, Python 3.12.2, using both Poetry 1.8.2 and pip 24.0: the kernel freezes upon doing import wbdata, with RAM of the kernel going up to 2GB.

There is no error message to report, because there is no error - just a freeze. fyi @glatterf42

OliverSherouse commented 7 months ago

Thanks for this report. I've noticed that tests run slowly on Mac with Python 3.12, but I don't have a personal Mac to test. Are you using Pandas? If so, does it import ok?

danielhuppmann commented 6 months ago

All other imports on my machine work fine. And it seems that our test suite including an integration test with wbdata works fine on Mac OS and python 3.12, see test_data_worldbank.py here.

I made a PR in our package allowing me to skip wbdata locally for now, see https://github.com/IAMconsortium/pyam/pull/833.

Not sure if there's anything that I can do to narrow down the problem, seems specific to my local environment.

glatterf42 commented 6 months ago

Could this be related to Apple's 2021 transition to their own kind of processors? For ixmp, we had some people running into installation issues with that. I don't own a Mac myself, but maybe you could check which kind of processor you are using vs the kind of processor the tests are using.

shreyasgm commented 6 months ago

Also have this issue with Python 3.11.8 and macOS Sonoma 14.3. However, the import had worked fine when I had run my script a couple of times before this, so I'm not sure if there's some rate limit I hit which blocked my machine? Tried the import with a VPN but that did not resolve the issue.

shreyasgm commented 6 months ago

On my mac, this was an issue with a corrupted package cache. I was able to fix this issue by deleting ~/Library/Caches/wbdata/1.0.0/cache.db.