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

error importing lime #2

Closed
albertfxwang opened this issue Mar 17, 2023 · 3 comments
Closed

error importing lime #2

albertfxwang opened this issue Mar 17, 2023 · 3 comments

Comments

@albertfxwang
Copy link

Hi Vital,

Thanks so much for bringing this awesome spectral fitting tool to the community. I installed the latest version using pip install lime-stable but when I try to import the package, I got the following error message. Could you please help take a look? Thanks so much!

In [1]: import lime

ImportError Traceback (most recent call last)
Cell In [1], line 1
----> 1 import lime

File ~/local/anaconda3/envs/xwang-jwst/lib/python3.10/site-packages/lime/init.py:38
35 class Error(Exception):
36 """LiMe exception function"""
---> 38 from .treatment import Spectrum, Sample, Cube
39 from .io import *
40 from .tools import *

File ~/local/anaconda3/envs/xwang-jwst/lib/python3.10/site-packages/lime/treatment.py:8
5 from astropy.io import fits
7 import lime
----> 8 from .tools import LineFinder, UNITS_LATEX_DICT, DISPERSION_UNITS,
9 FLUX_DENSITY_UNITS, unit_convertor, define_masks, extract_fluxes, relative_fluxes, compute_line_ratios
11 from .plots import SpectrumFigures, SampleFigures, CubeFigures
12 from .plots_interactive import SpectrumCheck, CubeCheck, SampleCheck

File ~/local/anaconda3/envs/xwang-jwst/lib/python3.10/site-packages/lime/tools.py:19
17 from pathlib import Path
18 from scipy import signal
---> 19 from .io import LiMe_Error
21 _logger = logging.getLogger('LiMe')
23 try:

File ~/local/anaconda3/envs/xwang-jwst/lib/python3.10/site-packages/lime/io.py:24
22 from pathlib import Path
23 from distutils.util import strtobool
---> 24 from collections import Sequence
26 from astropy.io import fits
27 from astropy.table import Table

ImportError: cannot import name 'Sequence' from 'collections' (/Users/wangxin/local/anaconda3/envs/xwang-jwst/lib/python3.10/collections/init.py)

@Vital-Fernandez
Copy link
Owner

Hello @albertfxwang for your post and sorry for the delay.

I think this error is due to the python version (skorch-dev/skorch#895). Can you try to run this command in your terminal to see if it works?

from collections.abc import Sequence

I can modify to command to make it work for you.

(This week and the next one I am updating the documentation to show the definitive LiMe workflow, Until them I recommend you follow the scripts on the github examples folder to follow the definitive version)

@albertfxwang
Copy link
Author

Hi @Vital-Fernandez , I checked that both the following lines of code work for me.
python3.10 -c "from collections.abc import Sequence"
python3.9 -c "from collections.abc import Sequence"
However, when trying to import lime, in Python 3.10 environment, it seems that from collections import Sequence will inflict an error.

@Vital-Fernandez
Copy link
Owner

Ty @albertfxwang very much for checking. I have modified that import in the 0.9.16 version. You should be able to get it with this command:

pip install lime-stable --upgrade

Please tell me if you have any issue.

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

2 participants