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

TypeError: Got secondary option for non boolean flag. #8

Closed
bdseal opened this issue Feb 16, 2022 · 7 comments
Closed

TypeError: Got secondary option for non boolean flag. #8

bdseal opened this issue Feb 16, 2022 · 7 comments

Comments

@bdseal
Copy link

bdseal commented Feb 16, 2022

Traceback (most recent call last):
File "train.py", line 60, in
@click.option('--use_wandb/--no_wandb', default=False)
File "/home/anaconda3/lib/python3.7/site-packages/click/decorators.py", line 173, in decorator
_param_memo(f, OptionClass(param_decls, **option_attrs))
File "/home/anaconda3/lib/python3.7/site-packages/click/core.py", line 1601, in init
raise TypeError('Got secondary option for non boolean flag.')
TypeError: Got secondary option for non boolean flag.

Got an error. Anyone knows how to fix this?

@rotemtzaban
Copy link
Owner

@bdseal
What version of click do you have?
This similar issue is solved by removing type=bool from the option declaration.
Though from the stack trace it seems like you've tried that.

@bdseal
Copy link
Author

bdseal commented Feb 16, 2022

@rotemtzaban thank you for your prompt response. I have googled and tried that but it didn't work for me. Alternatively, I run the codes using google colab.

@rotemtzaban
Copy link
Owner

@bdseal
Are you simply running the scripts with Google Colab? I haven't tried it but I would expect it to work.
Can you check the version of click you have, say with running pip freeze | grep click?
Maybe even try to upgrade click to the latest version if possible.

@rotemtzaban
Copy link
Owner

I can also try later to check the notebook myself, If you want to send me a copy I'll try to look over it

@bdseal
Copy link
Author

bdseal commented Feb 16, 2022

Sorry for the misunderstanding. The error occured when I tried to run the codes on our lab server. I successfully run the codes on Google Colab.

The version of Click is 7.0, Python 3.7. I have also tried pytorch 1.7 and 1.10, same error.

@rotemtzaban
Copy link
Owner

@bdseal
Oh OK, Thanks for the clarification, glad to know it works well on Colab.
I've reproduced the issue on my server with click==7.0, and it seems to be fixed by removing all the type=bool from flag options.
e.g. make sure to remove it from the use_dlib and use_locality_reg flags as well.
Alternatively, upgrading click to 7.1 or higher also seems to work for me

@bdseal
Copy link
Author

bdseal commented Feb 16, 2022

Thanks. Considering that #7 is also caused by the package version, it might be helpful to add a requirements.txt.

Besides, this is a simple Colab notebook I used. Maybe it would be helpful for those who want to try STIS on Colab like me before you released the official one.

@bdseal bdseal closed this as completed Feb 17, 2022
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