I am getting the following error when importing rasterstats package.

I searched the internet and found no solution. Does anyone know what this is about?

The only command I gave was import rasterstats

--------------------------------------------------------------------------- TypeError Traceback (most recent call last) in ----> 1 import rasterstats

/opt/conda/lib/python3.7/site-packages/rasterstats/init.py in 2 from .main import gen_zonal_stats, raster_stats, zonal_stats 3 from .point import gen_point_query, point_query ----> 4 from rasterstats import cli 5 from rasterstats._version import version 6

/opt/conda/lib/python3.7/site-packages/rasterstats/cli.py in 26 @click.option('--stats', type=str, default=None) 27 @click.option('--sequence/--no-sequence', type=bool, default=False) ---> 28 @cligj.use_rs_opt 29 def zonalstats(features, raster, all_touched, band, categorical, 30 indent, info, nodata, prefix, stats, sequence, use_rs):

/opt/conda/lib/python3.7/site-packages/click/decorators.py in decorator(f) 171 option_attrs['help'] = inspect.cleandoc(option_attrs['help']) 172 OptionClass = option_attrs.pop('cls', Option) --> 173 _param_memo(f, OptionClass(param_decls, **option_attrs)) 174 return f 175 return decorator

/opt/conda/lib/python3.7/site-packages/click/core.py in init(self, param_decls, show_default, prompt, confirmation_prompt, hide_input, is_flag, flag_value, multiple, count, allow_from_autoenv, type, help, hidden, show_choices, show_envvar, **attrs) 1599
raise TypeError('Cannot prompt for flags that are not bools.') 1600 if not self.is_bool_flag and self.secondary_opts: -> 1601 raise TypeError('Got secondary option for non boolean flag.') 1602 if self.is_bool_flag and self.hide_input \ 1603 and self.prompt is not None:

TypeError: Got secondary option for non boolean flag.

  • 1
    Try adding information on your setup and what you have done to install rasterstats. This question might also be better answered in the stackoverflow.com site, tagged #python and #conda
    – cndnflyr
    Nov 17, 2021 at 18:50

1 Answer 1


I found the problem.

It is incompatibility with other modules and packages that I use in Data Science.

When this error happens, I recommend that you create a new environment and install the package to avoid incompatibilities.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.