Skip to content

Numpy version pinning required with astropy.convolution in FITS display notebook #77

Closed

Description

@jaladh-singhal

@jonesmg noticed following issue in displaying-images.ipynb in #76:

I had to revert my numpy version to 2.3 because the latest version (2.4) seems to be incompatible with astropy.convolution. This might trip up a less experienced python user.

I'm not sure exactly why I'm having this issue and you are not (I'm running on an M2 Macbook). I deleted my environment and started from scratch, doing the following:

conda create -n firefly python=3 astropy jupyterlab
conda activate firefly
pip install firefly_client
export FIREFLY_URL="https://irsa.ipac.caltech.edu/irsaviewer"
jupyter lab
When I tried to import the modules from astropy.convolution I hit the error: AttributeError: module 'numpy' has no attribute 'in1d'
Doing some Googling, I think this has been deprecated for a while, and removed in numpy v2.4, but astropy (v7.1) is still using it I guess. I rebuilt the environment using:

conda create -n firefly python=3 numpy=2.3 astropy jupyterlab
Then all the astropy stuff imports.

Activity

  1. jaladh-singhal commented on Jan 27, 2026

    @jaladh-singhal
    MemberAuthor

    @jonesmg I tried conda create -n firefly python=3 astropy jupyterlab to reproduce your issue but I still don't see any errors with numpy when importing astropy.convolution (I'm on M1 though). This is how my astropy, numpy versions look:

    astropy                   7.2.0              pyhd8ed1ab_0    conda-forge
    astropy-base              7.2.0           py314hdcf55e8_0    conda-forge
    astropy-iers-data         0.2026.1.26.0.43.56    pyhd8ed1ab_0    conda-forge
    numpy                     2.4.1           py314hae46ccb_0    conda-forge
    

    I suspect that the astropy version you're pulling in is not up-to-date which is requiring a numpy downgrade.

    Can you please create a fresh environment again with above command, activate it, and then post the output of conda list | grep -e numpy -e astropy?

  2. jonesmg commented on Jan 27, 2026

    @jonesmg

    @jaladh-singhal You're correct, my conda is installing a slightly older version of astropy when I run the same environment command.

    astropy                      7.1.1                py314hdbb4bc7_0
    astropy-iers-data            0.2026.1.19.0.42.31  py314hca03da5_0
    numpy                        2.4.1                py314hde9b8b7_0
    numpy-base                   2.4.1                py314hb4b2851_0

    Is conda-forge in your default channels perhaps.

    Somewhat surprisingly, when I add an explicit conda-forge channel,

    conda create -n firefly -c conda-forge python=3 astropy jupyterlab

    It installed much older packages:

    astropy                          5.1.1            py311h4add359_3       conda-forge
    numpy                            1.23.4           py311ha92fb03_1       conda-forge
  3. jonesmg commented on Jan 27, 2026

    @jonesmg

    I just remembered that I'm using the mamba solver rather than the classic conda solver. Perhaps that's the issue.

  4. jaladh-singhal commented on Jan 28, 2026

    @jaladh-singhal
    MemberAuthor

    Is conda-forge in your default channels perhaps.

    @jonesmg Yes, that's correct and I was about to ask you to try conda-forge channel. Thanks for already realizing and doing that.

    Somewhat surprisingly, when I add an explicit conda-forge channel. It installed much older packages.

    It is indeed surprising.

    I just remembered that I'm using the mamba solver rather than the classic conda solver. Perhaps that's the issue.

    I just updated my conda which uses mamba-solver now by default. Doing conda create -n firefly -c conda-forge python=3 astropy jupyterlab still installs astropy v7.2.0 and numpy v2.4.1 for me.

    Can you post output of conda config --show, I wonder if that can give us better idea for the version discrepancy?

  5. jonesmg commented on Jan 29, 2026

    @jonesmg

    My conda version is 25.11.1, and here is the conda config output:

    add_anaconda_token: True
    add_pip_as_python_dependency: True
    aggressive_update_packages:

    • ca-certificates
    • certifi
    • openssl
      allow_conda_downgrades: False
      allow_cycles: True
      allow_non_channel_urls: False
      allow_softlinks: False
      allowlist_channels: []
      always_copy: False
      always_softlink: False
      always_yes: None
      anaconda_anon_usage: True
      anaconda_heartbeat: False
      anaconda_upload: None
      auto_activate: True
      auto_stack: 0
      auto_update_conda: True
      bld_path:
      changeps1: True
      channel_alias: https://conda.anaconda.org
      channel_priority: flexible
      channel_settings:
    • channel: https://repo.anaconda.cloud/*
      auth: anaconda-auth
      channels:
    • defaults
      client_ssl_cert: None
      client_ssl_cert_key: None
      clobber: False
      conda_build: {}
      console: classic
      create_default_packages: []
      croot: /opt/anaconda3/conda-bld
      custom_channels:
      pkgs/main: https://repo.anaconda.com
      pkgs/r: https://repo.anaconda.com
      pkgs/pro: https://repo.anaconda.com
      custom_multichannels:
      defaults:
    • https://repo.anaconda.com/pkgs/main
    • https://repo.anaconda.com/pkgs/r
      default_python: 3.13
      default_threads: None
      denylist_channels: []
      deps_modifier: not_set
      dev: False
      disallowed_packages: []
      download_only: False
      dry_run: False
      enable_private_envs: False
      env_prompt: ({default_env})
      environment_specifier: None
      envs_dirs:
    • /opt/anaconda3/envs
    • /Users/mgjones/.conda/envs
      envvars_force_uppercase: True
      error_upload_url: https://conda.io/conda-post/unexpected-error
      execute_threads: 1
      experimental: []
      export_platforms:
    • osx-arm64
      extra_safety_checks: False
      fetch_threads: 5
      force: False
      force_32bit: False
      force_reinstall: False
      force_remove: False
      ignore_pinned: False
      json: False
      list_fields:
    • name
    • version
    • build
    • channel_name
      local_repodata_ttl: 1
      migrated_channel_aliases: []
      migrated_custom_channels: {}
      no_lock: False
      no_plugins: False
      non_admin_enabled: True
      notify_outdated_conda: True
      number_channel_notices: 5
      offline: False
      override_channels_enabled: True
      override_virtual_packages: {}
      path_conflict: clobber
      pinned_packages: []
      pkgs_dirs:
    • /opt/anaconda3/pkgs
    • /Users/mgjones/.conda/pkgs
      plugins:
      anaconda_telemetry: True
      auto_accept_tos: False
      use_sharded_repodata: False
      prefix_data_interoperability: False
      protect_frozen_envs: True
      proxy_servers: {}
      quiet: False
      register_envs: True
      remote_backoff_factor: 1
      remote_connect_timeout_secs: 9.15
      remote_max_retries: 3
      remote_read_timeout_secs: 60.0
      repodata_fns:
    • current_repodata.json
    • repodata.json
      repodata_threads: None
      repodata_use_zst: True
      report_errors: None
      rollback_enabled: True
      root_prefix: /opt/anaconda3
      safety_checks: warn
      sat_solver: pycosat
      separate_format_cache: False
      shortcuts: True
      shortcuts_only: []
      show_channel_urls: None
      signing_metadata_url_base: None
      solver: libmamba
      solver_ignore_timestamps: False
      ssl_verify: True
      subdir: osx-arm64
      subdirs:
    • osx-arm64
    • noarch
      target_prefix_override:
      trace: False
      track_features: []
      unsatisfiable_hints: True
      unsatisfiable_hints_check_depth: 2
      update_modifier: update_specs
      use_index_cache: False
      use_local: False
      use_only_tar_bz2: None
      verbosity: 0
      verify_threads: 1

    Just to double check, I removed the environment and re-ran conda create -n firefly -c conda-forge python=3 astropy jupyterlab, and it now seems to work (see below). I tried updating conda and changing the solver between classic and mamba within the past few days. I'm not sure what exactly changed it, but it seems that with a fully up to date conda and conda-forge in channels, then it will install the right versions.

    conda list | grep -e numpy -e astropy
    astropy 7.2.0 pyhd8ed1ab_0 conda-forge
    astropy-base 7.2.0 py314hdcf55e8_0 conda-forge
    astropy-iers-data 0.2026.1.26.0.43.56 pyhd8ed1ab_0 conda-forge
    numpy 2.4.1 py314hae46ccb_0 conda-forge

  6. jaladh-singhal commented on Jan 30, 2026

    @jaladh-singhal
    MemberAuthor

    Just to double check, I removed the environment and re-ran conda create -n firefly -c conda-forge python=3 astropy jupyterlab, and it now seems to work (see below).

    Interesting 😄 - I'm glad it worked out.

    I tried updating conda and changing the solver between classic and mamba within the past few days. I'm not sure what exactly changed it, but it seems that with a fully up to date conda and conda-forge in channels, then it will install the right versions.

    Yes, it's usually a good idea to update conda (or any other package manger for that matter). Looking at your conda config, I don't see conda-forge in default channels. It's a good idea to always use conda-forge over defaults channel, you can update your config as explained here: https://conda-forge.org/docs/user/introduction/#how-can-i-install-packages-from-conda-forge. Then you won't need to remember to supply -c conda-forge each time.

    Another thing I do when creating environments is to use conda only for env creation and installing python (and non-python pacakges) and then use pip for installing python packages. So your example becomes:

    conda create -n firefly python=3.13
    conda activate firefly
    pip install astropy jupyterlab
    
  7. jaladh-singhal commented on Jan 30, 2026

    @jaladh-singhal
    MemberAuthor

    I'm closing it as it got resolved by upgrading the machinery. Feel free to comment if this problem reoccurs.

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions