natashabatalha / propexo

A Proposal Tutorial for Transiting Exoplanet Atmospheres
https://natashabatalha.github.io/SaganSchoolTutorial
3 stars 2 forks source link

error with geos library? #1

Closed jkteske closed 1 year ago

jkteske commented 1 year ago

When I try to run this line in the notebook, the first in the CHIMERA section:

import blackbox_codes as bbs #packaged function with chimera and picaso for the purposes of this demo !

I get the error below. It seems to be related to the shapely, specifically geos.py. Have you seen this error before? I'm using Mac OS 12.6 with python 3.7 (I installed following the instructions, creating a conda environment). Looks like I need and don't have libgeos_c.dylib, do I need to install geos separately? Thanks!


OSError Traceback (most recent call last)

in ----> 1 import blackbox_codes as bbs #packaged function with chimera and picaso for the purposes of this demo ! ~/Documents/staff/research/observing_proposals/propexo/blackbox_codes.py in 4 import pandas as pd 5 ----> 6 import picaso.justdoit as jdi 7 8 def chimera_chem(CtoO, Met, T, P, directory=None, xsects=None): ~/.conda/envs/propexo/lib/python3.7/site-packages/picaso/justdoit.py in 6 from .disco import get_angles_1d, get_angles_3d, compute_disco, compress_disco, compress_thermal 7 ----> 8 from virga import justdoit as vj 9 from scipy.signal import savgol_filter 10 from scipy.interpolate import RegularGridInterpolator ~/.conda/envs/propexo/lib/python3.7/site-packages/virga/__init__.py in 7 8 ----> 9 from . import justdoit 10 from . import justplotit 11 ~/.conda/envs/propexo/lib/python3.7/site-packages/virga/justdoit.py in 5 import os 6 from scipy import optimize ----> 7 import PyMieScatt as ps 8 9 from .root_functions import advdiff, vfall,vfall_find_root,qvs_below_model, find_cond_t ~/.conda/envs/propexo/lib/python3.7/site-packages/PyMieScatt/__init__.py in 3 from PyMieScatt.Mie import MieQ, Mie_ab, Mie_cd, RayleighMieQ, AutoMieQ, LowFrequencyMieQ, LowFrequencyMie_ab, AutoMie_ab, Mie_SD, ScatteringFunction, SF_SD, MieS1S2, MiePiTau, MatrixElements, MieQ_withDiameterRange, MieQ_withWavelengthRange, MieQ_withSizeParameterRange, Mie_Lognormal 4 from PyMieScatt.CoreShell import MieQCoreShell, CoreShellScatteringFunction, CoreShellMatrixElements, CoreShellS1S2 ----> 5 from PyMieScatt.Inverse import ContourIntersection, ContourIntersection_SD, SurveyIteration, SurveyIteration_SD, Inversion, Inversion_SD, fastMieQ, fastMie_SD 6 from PyMieScatt._version import __version__ ~/.conda/envs/propexo/lib/python3.7/site-packages/PyMieScatt/Inverse.py in 8 from scipy.ndimage import zoom 9 from scipy.integrate import trapz ---> 10 from shapely import geometry 11 12 def coerceDType(d): ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/geometry/__init__.py in 2 """ 3 ----> 4 from .base import CAP_STYLE, JOIN_STYLE 5 from .geo import box, shape, asShape, mapping 6 from .point import Point, asPoint ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/geometry/base.py in 16 17 from shapely.affinity import affine_transform ---> 18 from shapely.coords import CoordinateSequence 19 from shapely.errors import WKBReadingError, WKTReadingError 20 from shapely.geos import WKBWriter, WKTWriter ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/coords.py in 6 from ctypes import byref, c_double, c_uint 7 ----> 8 from shapely.geos import lgeos 9 from shapely.topology import Validating 10 ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/geos.py in 136 _lgeos = load_dll('geos_c', fallbacks=alt_paths) 137 --> 138 free = load_dll('c').free 139 free.argtypes = [c_void_p] 140 free.restype = None ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/geos.py in load_dll(libname, fallbacks, mode) 60 raise OSError( 61 "Could not find lib {} or load any of its variants {}.".format( ---> 62 libname, fallbacks or [])) 63 64 _lgeos = None OSError: Could not find lib c or load any of its variants [].
natashabatalha commented 1 year ago

Hello! I should really update this readme. This github has been discontinued and replaced with the picaso tutorial available here: https://natashabatalha.github.io/picaso/notebooks/workshops/SaganSchool2020/JWSTProposalTutorial.html

For this new tutorial you will not need to download CHIMERA, which should fix your problem!

jkteske commented 1 year ago

I get the same error with the new notebook, too, I don't think it's with CHIMERA, it's with VIRGA:


OSError Traceback (most recent call last)

in 1 #load picaso 2 # load picaso ----> 3 import picaso.justdoit as pj 4 import picaso.justplotit as pp ~/.conda/envs/propexo/lib/python3.7/site-packages/picaso/justdoit.py in 6 from .disco import get_angles_1d, get_angles_3d, compute_disco, compress_disco, compress_thermal 7 ----> 8 from virga import justdoit as vj 9 from scipy.signal import savgol_filter 10 from scipy.interpolate import RegularGridInterpolator ~/.conda/envs/propexo/lib/python3.7/site-packages/virga/__init__.py in 7 8 ----> 9 from . import justdoit 10 from . import justplotit 11 ~/.conda/envs/propexo/lib/python3.7/site-packages/virga/justdoit.py in 5 import os 6 from scipy import optimize ----> 7 import PyMieScatt as ps 8 9 from .root_functions import advdiff, vfall,vfall_find_root,qvs_below_model, find_cond_t ~/.conda/envs/propexo/lib/python3.7/site-packages/PyMieScatt/__init__.py in 3 from PyMieScatt.Mie import MieQ, Mie_ab, Mie_cd, RayleighMieQ, AutoMieQ, LowFrequencyMieQ, LowFrequencyMie_ab, AutoMie_ab, Mie_SD, ScatteringFunction, SF_SD, MieS1S2, MiePiTau, MatrixElements, MieQ_withDiameterRange, MieQ_withWavelengthRange, MieQ_withSizeParameterRange, Mie_Lognormal 4 from PyMieScatt.CoreShell import MieQCoreShell, CoreShellScatteringFunction, CoreShellMatrixElements, CoreShellS1S2 ----> 5 from PyMieScatt.Inverse import ContourIntersection, ContourIntersection_SD, SurveyIteration, SurveyIteration_SD, Inversion, Inversion_SD, fastMieQ, fastMie_SD 6 from PyMieScatt._version import __version__ ~/.conda/envs/propexo/lib/python3.7/site-packages/PyMieScatt/Inverse.py in 8 from scipy.ndimage import zoom 9 from scipy.integrate import trapz ---> 10 from shapely import geometry 11 12 def coerceDType(d): ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/geometry/__init__.py in 2 """ 3 ----> 4 from .base import CAP_STYLE, JOIN_STYLE 5 from .geo import box, shape, asShape, mapping 6 from .point import Point, asPoint ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/geometry/base.py in 16 17 from shapely.affinity import affine_transform ---> 18 from shapely.coords import CoordinateSequence 19 from shapely.errors import WKBReadingError, WKTReadingError 20 from shapely.geos import WKBWriter, WKTWriter ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/coords.py in 6 from ctypes import byref, c_double, c_uint 7 ----> 8 from shapely.geos import lgeos 9 from shapely.topology import Validating 10 ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/geos.py in 136 _lgeos = load_dll('geos_c', fallbacks=alt_paths) 137 --> 138 free = load_dll('c').free 139 free.argtypes = [c_void_p] 140 free.restype = None ~/.conda/envs/propexo/lib/python3.7/site-packages/shapely/geos.py in load_dll(libname, fallbacks, mode) 60 raise OSError( 61 "Could not find lib {} or load any of its variants {}.".format( ---> 62 libname, fallbacks or [])) 63 64 _lgeos = None OSError: Could not find lib c or load any of its variants [].
jkteske commented 1 year ago

So, the fix was to upgrade Shapley. I quit the notebook, deactivated the environment, reactivated the environment, ran

pip install Shapely --upgrade

and then opened the jupyter notebook and the bbs line ran without error.