Skip to content

Crashes with different Python versions #24

Open

Description

@Guillawme

Hello,

Maybe you should update the compatibility info on PyPI to restrict to python==3.8, and possibly specify tighter version ranges for numpy (not sure about this one).

I recently installed OccuPy in a clean conda environment, which came with Python 3.13 (latest at this time) because I only specified python=3 when creating the environment. Then I got a crash with this error when pressing the "Estimate scale" button:

Traceback (most recent call last):
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.13/site-packages/occupy_lib/occupy_gui.py", line 2777, in estimate_scale
    self.run_cmd(only_estimate=True)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.13/site-packages/occupy_lib/occupy_gui.py", line 2795, in run_cmd
    estimate.occupy_run(options)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.13/site-packages/occupy_lib/estimate.py", line 309, in occupy_run
    scale, max_val, tiles_raw = occupancy.get_map_scale(
                                ~~~~~~~~~~~~~~~~~~~~~~~^
        scale_data,
        ^^^^^^^^^^^
    ...<6 lines>...
        verbose=options.verbose
        ^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.13/site-packages/occupy_lib/occupancy.py", line 425, in get_map_scale
    scale_map, map_val_at_full_scale, extr_tiles = percentile_filter(
                                                   ~~~~~~~~~~~~~~~~~^
        data,
        ^^^^^
    ...<3 lines>...
        tile_sz=tile_size,
        ^^^^^^^^^^^^^^^^^^
        verbose=verbose)
        ^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.13/site-packages/occupy_lib/occupancy.py", line 275, in percentile_filter
    return percentile_filter_tiled(
        data,
    ...<5 lines>...
        verbose=verbose
    )
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.13/site-packages/occupy_lib/occupancy.py", line 193, in percentile_filter_tiled
    n_tau = int(np.floor(tau * np.product(tile_sz)))
                               ^^^^^^^^^^

After this crash I made a new conda environment with python=3.9 (listed as compatible on PyPI) and got this different crash at the same press of the button:

Traceback (most recent call last):
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.9/site-packages/occupy_lib/occupy_gui.py", line 2777, in estimate_scale
    self.run_cmd(only_estimate=True)
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.9/site-packages/occupy_lib/occupy_gui.py", line 2795, in run_cmd
    estimate.occupy_run(options)
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.9/site-packages/occupy_lib/estimate.py", line 309, in occupy_run
    scale, max_val, tiles_raw = occupancy.get_map_scale(
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.9/site-packages/occupy_lib/occupancy.py", line 425, in get_map_scale
    scale_map, map_val_at_full_scale, extr_tiles = percentile_filter(
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.9/site-packages/occupy_lib/occupancy.py", line 275, in percentile_filter
    return percentile_filter_tiled(
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.9/site-packages/occupy_lib/occupancy.py", line 193, in percentile_filter_tiled
    n_tau = int(np.floor(tau * np.product(tile_sz)))
  File "/opt/miniconda3/envs/occupy-0.1.13/lib/python3.9/site-packages/numpy/__init__.py", line 410, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'product'
Aborted (core dumped)

Finally, in a fresh conda env explicitly requesting python=3.8 everything is working fine again.

No need to investigate this until you decide to use more recent dependencies, but until then it would be good to only list the functioning versions on PyPI, so others won't trip up on this.

Activity

  1. EuanPyle commented on Sep 9, 2025

    @EuanPyle

    hi, I also had the same issue, thanks for the solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions