tractor icon indicating copy to clipboard operation
tractor copied to clipboard

Issue installing in conda environment - astrometry.utils not found

Open dmasters opened this issue 1 year ago • 3 comments

I am trying to install Tractor and astrometry.net in a conda environment using pip (from yaml file):

- pip:
    - git+https://github.com/dstndstn/astrometry.net.git@main
    - git+https://github.com/dstndstn/tractor.git@main

This worked before, and seems to complete successfully. However, I now get an error loading Tractor because the package "astrometry.utils" is not found, and I don't see the utils directory in the conda env .../site-packages/astrometry/ directory where it would normally live after a successful installation.

dmasters avatar May 26 '23 21:05 dmasters

Ugh, yes, this is something I have been (unsuccessfully) wrestling with lately. (the whole setuptools ecosystem is changing in recent pythons, which is why I didn't just leave it alone...). Instead of using pip, what I have been doing for my own Docker container builds is this,

https://github.com/legacysurvey/legacypipe/blob/main/docker/Dockerfile#LL78C1-L78C1

Sorry for the trouble, I appreciate that it's a huge pain.

On Fri, May 26, 2023 at 5:18 PM dmasters @.***> wrote:

I am trying to install Tractor and astrometry.net in a conda environment using pip (from yaml file):

  • pip:
    • @.***
    • @.***

This worked before, and seems to complete successfully. However, I now get an error loading Tractor because the package "astrometry.utils" is not found, and I don't see the utils directory in the conda env .../site-packages/astrometry/ directory where it would normally live after a successful installation.

— Reply to this email directly, view it on GitHub https://github.com/dstndstn/tractor/issues/105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIEH7JTOUQNRRIIJJJAZRDXIEM2FANCNFSM6AAAAAAYQWMUDY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dstndstn avatar May 26 '23 21:05 dstndstn

Thanks, Dustin. We were able to get a workaround installation running, by specifying a previous version of setuptools and earlier versions of tractor and astrometry.net. Not ideal, but it works for now. We thought this could potentially help debug the issue with pip installation. The details are below.

  1. We create a conda environment with setuptools<66.0.0 before PEP 440 version compliance was enforced.

The env.yaml file looks like this:

name: tractor channels: - conda-forge - default dependencies: - astropy - astropy-healpix - fitsio - gsl - healpy - ipykernel - mpi4py - netpbm - numpy - pandas - pip <23.0 - pyopencl - python >=3.10.0 - pyyaml - requests - seaborn - setuptools < 66.0.0 - scikit-image - scipy - swig

  1. We store pip’s dependencies in a separate file requirements.txt (using previous version of tractor that we had working in December):

git+https://github.com/dstndstn/[email protected] git+https://github.com/dstndstn/tractor.git@cf8bac3

  1. We install with the following:

conda env create --name tractor_20230604 --file env.yaml conda activate tractor_20230604 pip install -r requirements.txt

dmasters avatar Jun 09 '23 16:06 dmasters

I am also running into this problem. It looks like the setup.py is not properly copying over sub-directories in the installation process.

On my local machine, I am able to get around this by using pip install --editable . in the cloned astrometry repo, which just points python to the current directory rather than copying the astrometry files so the right place. This is not ideal but might help other people

jhod0 avatar Aug 21 '23 22:08 jhod0