Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyCharm debugger crash #123

Closed
nhoover opened this issue Mar 22, 2022 · 10 comments
Closed

PyCharm debugger crash #123

nhoover opened this issue Mar 22, 2022 · 10 comments

Comments

@nhoover
Copy link
Owner

nhoover commented Mar 22, 2022

Works fine when not debugging, but with or without breakpoints, the debugger crashes:

File "C:\Users\nathan\Desktop\nstrava\modules\caching_bar.py", line 37, in bar_graph_data
monthly_distance = [a.groupby([a.index.year, a.index.month]).agg({DISTANCE_HEADER:
File "C:\Users\nathan\Desktop\nstrava\modules\caching_bar.py", line 37, in
monthly_distance = [a.groupby([a.index.year, a.index.month]).agg({DISTANCE_HEADER:
File "C:\Users\nathan\Desktop\Nathan\venvs\nstrava3.10\lib\site-packages\pandas\core\frame.py", line 8413, in unstack
result = unstack(self, level, fill_value)
File "C:\Users\nathan\Desktop\Nathan\venvs\nstrava3.10\lib\site-packages\pandas\core\reshape\reshape.py", line 478, in unstack
return _unstack_frame(obj, level, fill_value=fill_value)
File "C:\Users\nathan\Desktop\Nathan\venvs\nstrava3.10\lib\site-packages\pandas\core\reshape\reshape.py", line 505, in _unstack_frame
unstacker = _Unstacker(obj.index, level=level, constructor=obj._constructor)
File "C:\Users\nathan\Desktop\Nathan\venvs\nstrava3.10\lib\site-packages\pandas\core\reshape\reshape.py", line 133, in init
if num_cells > np.iinfo(np.int32).max:
File "C:\Users\nathan\Desktop\Nathan\venvs\nstrava3.10\lib\site-packages\numpy\core\getlimits.py", line 651, in init
self.dtype = numeric.dtype(type(int_type))
TypeError: 'NoneType' object is not callable

Code is here: https://github.com/nhoover/nstrava/blob/main/modules/caching_bar.py#L37

   # Aggregate gear (bikes and unis/shoes), distance & climbing by year and activities by month
    yearly_distance = [a.groupby([YEAR_COLUMN]).agg({DISTANCE_HEADER: ['sum', 'count']}) for a in acts]
    yearly_climbing = [a.groupby([YEAR_COLUMN]).agg({CLIMB_HEADER: ['sum']}) for a in acts]
    monthly_counts = [a.groupby([a.index.year, a.index.month]).size() for a in acts]
    monthly_distance = [a.groupby([a.index.year, a.index.month]).agg({DISTANCE_HEADER:
                                                                      ['sum']}).unstack(fill_value=0) for a in acts]
    monthly_climbing = [a.groupby([a.index.year, a.index.month]).agg({CLIMB_HEADER:
                                                                      ['sum']}).unstack(fill_value=0) for a in acts]
@nhoover
Copy link
Owner Author

nhoover commented Mar 23, 2022

It happens for lots of other people too, in python 3.10 https://youtrack.jetbrains.com/issue/PY-52137

@nhoover
Copy link
Owner Author

nhoover commented Mar 23, 2022

This code reproduces the crash

import pandas
df = pandas.DataFrame({'A': [1, 2], 'B': [0.5, 0.75]})
rec = df.to_records()
print(rec)

@nhoover
Copy link
Owner Author

nhoover commented Apr 7, 2022

The root cause of this issue is in numpy. It should be fixed in the next release, 1.22.4: numpy/numpy#21008

@nhoover
Copy link
Owner Author

nhoover commented Apr 8, 2022

Here's the release page where numpy 1.22.4 will show up https://github.com/numpy/numpy/releases

@nhoover
Copy link
Owner Author

nhoover commented Apr 18, 2022

Looks like they finally fixed the underlaying issue in cython, although it may be a while until it propagates into an actual numpy fix. cython/cython#4735

@nhoover
Copy link
Owner Author

nhoover commented May 23, 2022

Bummer - numpy 1.22.4 was just released and the notes say it should fix all these debugging problems everyone is having. But it doesn't for me.

@nhoover
Copy link
Owner Author

nhoover commented May 23, 2022

Tried installing cloning the pandas repo and then installing it's setup.py in my nstrava venv. Had to install cython to build and it takes a really long time then fails with

Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997) -- Some packages may not be found!
No local packages or working download links found for pandas==1.5.0.dev0+809.gd2a7eff002
error: Could not find suitable distribution for Requirement.parse('pandas==1.5.0.dev0+809.gd2a7eff002')

@nhoover
Copy link
Owner Author

nhoover commented Jun 7, 2022

Problem is that both pandas and numpy need to be rebuilt with the new and fixed cython to fix this.

@nhoover
Copy link
Owner Author

nhoover commented Jun 8, 2022

Supposedly pandas 1.4.3 will fix this and may finally be released this weekend or soon. Don't hold the breath though as it was initially scheduled for release 4/30/2022. pandas-dev/pandas#46610

@nhoover
Copy link
Owner Author

nhoover commented Jun 24, 2022

Finally fixed by upgrading to pandas 1.4.3 and numpy 1.23.0 in build v626 6/24/2022 - debugging works!

@nhoover nhoover closed this as completed Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant