autoRIFT icon indicating copy to clipboard operation
autoRIFT copied to clipboard

Deprecated numpy functions

Open adehecq opened this issue 1 year ago • 4 comments

Since version 1.24, numpy has deprecated the aliases np.bool and np.int, which are still used at numerous occasions in autorift, leaving the user with an AttributeError. It can be easily fixed by replacing all occurrence of np.bool with bool and np.int with int.

Also np.asscalar has also been removed in version 1.23. I think it can be safely replaced by calling int() instead.

adehecq avatar May 23 '24 15:05 adehecq

@adehecq this was largely done in #88, but some of the un-distributed scripts were missed, and I don't think np.assscalar was checked for either.

If you have time, I'll happily review a PR, merge, and cut a new release. Otherwise, it will take me a bit to get to this.

jhkennedy avatar May 23 '24 17:05 jhkennedy

Hi @jhkennedy,

yes, I was thinking about submitting a PR, but I was working on the conda install directly, not on a clone of the repository. I tried cloning the repository and running python setup.py install as recommended in the installation notes but I get the following error: "geo_autoRIFT/autoRIFT/bindings/autoriftcoremodule.cpp:43:10: fatal error: opencv2/imgproc/imgproc.hpp: No such file or directory" (also the setup.py raises a DeprecationWarning). Note that I'm installing directly in the conda environment that I created for installing autorift in the first place, and that already installed all dependencies, as I could not find an environment file in this repository. Could you please indicate the way to go forward? Thanks!

adehecq avatar May 27 '24 13:05 adehecq

@adehecq @jhkennedy looks like setup.py is assuming a linux machine with paths to library files that don't necessarily match opencv installed from conda. We were recently working around this by adding a path to the hpp files under the conda environment directory, see https://github.com/nasa-jpl/autoRIFT/compare/master...relativeorbit:autoRIFT:condaInstall.

The PR above fixes the lingering np.asscalars . Would be great to have a release on pypi (and conda-forge) to simplify installing and compatible with numpy>1.23 (and soon-to-be-released numpy2)

scottyhq avatar May 29 '24 16:05 scottyhq

@adehecq to install into an existing conda environment, I think you can do:

python -m pip install --global-option=build_ext --global-option="-I${CONDA_PREFIX}/include/opencv4" .

based on the conda-forge recipe: https://github.com/conda-forge/autorift-feedstock/blob/main/recipe/meta.yaml#L18

@scottyhq I agree we should add an environment.yml file, and I'd be happy to review a PR for that.

Really, the entire build and packaging system needs to be reworked, and quite a bit of geogrid/autorift could be refactored for usability. I'm planning later this summer or maybe early fall to start in on that.

jhkennedy avatar May 30 '24 19:05 jhkennedy

With PRs #88, #98, #106, and #111, this should be fully addressed now and will be released in v1.6.0 soon.

jhkennedy avatar Apr 16 '25 23:04 jhkennedy