mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Can't find stubgen

Open devchakraborty opened this issue 6 years ago • 5 comments

With Python 3.7.5 and mypy 0.660 on macOS 10.14.4, I'm unable to find the stubgen tool:

$ stubgen
bash: stubgen: command not found
$ python3 -m stubgen         
/opt/homebrew/opt/python37/bin/python3.7: No module named stubgen

It's unclear from the documentation whether it's supposed to be globally available or if there are any other steps here.

devchakraborty avatar Dec 19 '19 21:12 devchakraborty

Usually installing mypy via pip comes with a globally available stubgen command, as I verified on MacOS 10.15 with Python 3.7.5 and mypy 0.660. Would you please check your path again or be more specific about how you install mypy?

TH3CHARLie avatar Dec 20 '19 07:12 TH3CHARLie

I should add mypy 0.660 is pretty old, almost a year old now (!), @devchakraborty you should probably update. If you can give how you installed mypy, and if other tools like flake8 work, then we may be better able to diagnose the issue.

emmatyping avatar Dec 21 '19 09:12 emmatyping

stubgen or python3 -m mypy.stubgen should work. If you still can't get things working on with a newer version of mypy, feel free to reopen.

hauntsaninja avatar Aug 07 '20 03:08 hauntsaninja

I'm trying to get python -m mypy.stubgen to work in my Jenkins build. It's hard for me to understand what's going on with this remote environment, but it is easier for me if I can specify the Python interpreter, as opposed to using the stubgen command directly.

When I run:

python3 -m pip install "mlflow>=1.23.1,!=1.30.0,<2" mypy==1.0.0  # for stubgen
python3 -m mypy.stubgen -p mlflow

I get:

python3: No code object available for mypy.stubgen

Edit: what finally worked:

python3 -m pip install "mlflow>=1.23.1,!=1.30.0,<2" mypy==1.0.0  # for stubgen
python3 -c "import mypy.stubgen; mypy.stubgen.main(['-p', 'mlflow'])"

chrisranderson avatar Feb 14 '23 18:02 chrisranderson

I am seeing the same thing with a recent 1.13.0 conda install on MacOS M1, the suggested "-c import..." hack does work.

analog-cbarber avatar Dec 15 '24 15:12 analog-cbarber