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

Installation/import issue #23

Open
keflavich opened this issue Sep 28, 2021 · 7 comments
Open

Installation/import issue #23

keflavich opened this issue Sep 28, 2021 · 7 comments

Comments

@keflavich
Copy link
Contributor

Reported by @dmehring

radio-astro-tools/uvcombine#24

@astrofrog
Copy link
Member

See radio-astro-tools/uvcombine#24 (comment) - I think somehow it is because casa-formats-io was not installed with pip and it is being imported from the source tree without the extension compiled.

@jpinedaf
Copy link

I cannot get spetral_cube to work because of this issue with casa-formats-io. I installed it using pip,

pip install spectral-cube

but then I get the following error:

In [1]: from spectral_cube import SpectralCube as sc
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 from spectral_cube import SpectralCube as sc

File ~/miniconda3/envs/py38/lib/python3.8/site-packages/spectral_cube/__init__.py:16, in <module>
     13 from .lower_dimensional_structures import (OneDSpectrum, Projection, Slice)
     15 # Import the following sub-packages to make sure the I/O functions are registered
---> 16 from .io import casa_image
     17 del casa_image
     18 from .io import class_lmv

File ~/miniconda3/envs/py38/lib/python3.8/site-packages/spectral_cube/io/casa_image.py:14, in <module>
     11 from .. utils import BeamWarning
     12 from .. import wcs_utils
---> 14 from casa_formats_io import getdesc, coordsys_to_astropy_wcs, image_to_dask
     16 # Read and write from a CASA image. This has a few
     17 # complications. First, by default CASA does not return the
     18 # "python order" and so we either have to transpose the cube on
   (...)
     22 # when writing but don't want them in memory. By default, try to
     23 # yield the same array in memory that we would get from astropy.
     26 def is_casa_image(origin, filepath, fileobj, *args, **kwargs):
     27 
     28     # See note before StringWrapper definition

File ~/code/python_code/casa-formats-io/casa_formats_io/__init__.py:9, in <module>
      1 # For convenience, we import the astropy Table class here which
      2 # allows one to do:
      3 #     >>> from casa_formats_io import Table
      4 # instead of:
      5 #     >>> import casa_formats_io
      6 #     >>> from astropy.table import Table
      7 from astropy.table import Table  # noqa
----> 9 from .casa_dask import *  # noqa
     10 from .casa_low_level_io import *  # noqa
     11 from .casa_wcs import *  # noqa

File ~/code/python_code/casa-formats-io/casa_formats_io/casa_dask.py:13, in <module>
     10 import dask.array
     12 from .casa_low_level_io.table import CASATable
---> 13 from ._casa_chunking import _combine_chunks
     15 __all__ = ['image_to_dask']
     18 def combine_chunks(array_1d, itemsize, shape, oversample):

ModuleNotFoundError: No module named 'casa_formats_io._casa_chunking'

This is in a fresh environment, with python 3.8 and ipython installed. I also tried installing casa-formats-io via

pip install casa-formats-io

but I get the same error.

Any suggestion of how to solve this?
BTW, I also tried cloning the repo and installing using python setup.py develop without any difference.

@astrofrog
Copy link
Member

@jpinedaf - it looks like it is trying to import from a local code path:

~/code/python_code/casa-formats-io/casa_formats_io

can you try using pip install and then importing casa_formats_io from an empty directory?

@jpinedaf
Copy link

@astrofrog you are right, that was messing it up... and now I remembered why, I am using python 3.9 and I cannot install

(py3) bash-3.2$ python setup.py develop
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/setuptools/dist.py:738: UserWarning: Usage of dash-separated 'upload-dir' will not be supported in future versions. Please use the underscore name 'upload_dir' instead
  warnings.warn(
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/setuptools/dist.py:738: UserWarning: Usage of dash-separated 'show-response' will not be supported in future versions. Please use the underscore name 'show_response' instead
  warnings.warn(
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'use_scm_version'
  warnings.warn(msg)
running develop
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/setuptools/command/easy_install.py:160: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running egg_info
writing spectral_cube.egg-info/PKG-INFO
writing dependency_links to spectral_cube.egg-info/dependency_links.txt
writing requirements to spectral_cube.egg-info/requires.txt
writing top-level names to spectral_cube.egg-info/top_level.txt
reading manifest file 'spectral_cube.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README.md'
warning: no files found matching '*.c' under directory '*.pyx'
warning: no files found matching '*.pxd' under directory '*.pyx'
warning: no files found matching '*' under directory 'licenses'
warning: no files found matching '*' under directory 'cextern'
warning: no files found matching '*' under directory 'scripts'
no previously-included directories found matching 'build'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/api'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.o' found anywhere in distribution
adding license file 'LICENSE.rst'
writing manifest file 'spectral_cube.egg-info/SOURCES.txt'
running build_ext
Creating /Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/spectral-cube.egg-link (link to .)
spectral-cube 0.0.0 is already the active version in easy-install.pth

Installed /Users/jpineda/code/python_code/spectral-cube
Processing dependencies for spectral-cube==0.0.0
Searching for casa-formats-io
Reading https://pypi.org/simple/casa-formats-io/
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: formats-io-0.1 is an invalid version and will not be supported in a future release
  warnings.warn(
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: io-0.1 is an invalid version and will not be supported in a future release
  warnings.warn(
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning:  is an invalid version and will not be supported in a future release
  warnings.warn(
Downloading https://files.pythonhosted.org/packages/4f/9b/6411821cad6c502403c2447c14a55a92d8c2517c7161d9cf85f49604dd1f/casa-formats-io-0.1.tar.gz#sha256=3ad18e72fb732137b0fb49ef4d5c3468773a4c990bba4e63eedd355e8cbc3e9b
Best match: casa-formats-io 0.1
Processing casa-formats-io-0.1.tar.gz
Writing /var/folders/2n/6gk_yf0d1zvdwj6wy12h_klr0000gn/T/easy_install-fgemcgoq/casa-formats-io-0.1/setup.cfg
Running casa-formats-io-0.1/setup.py -q bdist_egg --dist-dir /var/folders/2n/6gk_yf0d1zvdwj6wy12h_klr0000gn/T/easy_install-fgemcgoq/casa-formats-io-0.1/egg-dist-tmp-r9nkg621
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'use_scm_version'
  warnings.warn(msg)
warning: no files found matching 'README.md'
warning: no files found matching 'LICENSE.rst'
warning: no files found matching '*.c' under directory '*.pyx'
warning: no files found matching '*.pxd' under directory '*.pyx'
warning: no files found matching '*' under directory 'licenses'
warning: no files found matching '*' under directory 'cextern'
warning: no files found matching '*' under directory 'scripts'
no previously-included directories found matching 'build'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/api'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.o' found anywhere in distribution
/Users/jpineda/miniconda3/envs/py3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
In file included from casa_formats_io/_casa_chunking.c:3:
In file included from /Users/jpineda/miniconda3/envs/py3/include/python3.9/Python.h:91:
/Users/jpineda/miniconda3/envs/py3/include/python3.9/bytearrayobject.h:9:10: fatal error: 'stdarg.h' file not found
#include <stdarg.h>
         ^~~~~~~~~~
1 error generated.
error: Setup script exited with error: command '/Users/jpineda/miniconda3/envs/py3/bin/x86_64-apple-darwin13.4.0-clang' failed with exit code 1
(py3) bash-3.2$ 

It installs very well in python 3.8, but with 3.9 I got this problem.

Any idea?

@astrofrog
Copy link
Member

@jpinedaf - sorry for the delay, could you send me the output of conda list for the environment in which this fails?

@astrofrog
Copy link
Member

I wonder if we should add a CI job with the conda compilers as it might be related to that.

@astrofrog
Copy link
Member

@jpinedaf - could you try and pip install casa-formats-io as we have now published new wheels?

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

3 participants