mypy-pycharm: MacOS: Error while checking Mypy path
Step 1: Are you in the right place?
- I have verified there are no duplicate active or recent bugs, questions, or requests
- I have verified that I am using the latest version of the plugin.
Step 2: Describe your environment
- Plugin version:
0.10.2
- PyCharm/IDEA version:
2018.3.4 Build #PY-183.5429.31
- Mypy version:
0.620
Step 3: Describe the problem:
Steps to reproduce:
- Install mypy using
brew install mypy
- Restart pycharm
Observed Results:
- Pycharm indicates a fatal error “Error while checking Mypy path”
Expected Results:
- Pycharm should load without complaining
Relevant Code:
I think the plugin is throwing an error when executing the /usr/local/bin/mypy
file as installed by brew
but I can’t see why. This file contains:
#!/bin/bash
PYTHONPATH="/usr/local/Cellar/mypy/0.620/libexec/lib/python3.7/site-packages:/usr/local/Cellar/mypy/0.620/libexec/vendor/lib/python3.7/site-packages" exec "/usr/local/Cellar/mypy/0.620/libexec/bin/mypy" "$@"
java.lang.Throwable: Error while checking Mypy path: File "/usr/local/bin/mypy", line 2
PYTHONPATH="/usr/local/Cellar/mypy/0.620/libexec/lib/python3.7/site-packages:/usr/local/Cellar/mypy/0.620/libexec/vendor/lib/python3.7/site-packages" exec "/usr/local/Cellar/mypy/0.620/libexec/bin/mypy" "$@"
^
SyntaxError: invalid syntax
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:134)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:102)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:176)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:152)
at com.leinardi.pycharm.mypy.MypyInspection.inspectFile(MypyInspection.java:76)
at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:337)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 9
- Comments: 15 (3 by maintainers)
I see a similar problem on OSX using the path of mypy inside my project’s venv, using Intellij with the python plugin
I had this issue with pyenv with both python 2.7 and python 3.7 installed. Once I was able to resolve down to a single version I was able to take the output of
pyenv which mypy
and paste it into the path to mypy executable (preferences/mypy) and everything worked fine.@leinardi It looks like it’s not a regression. It’s not working for me in all 3 versions. I can only get it to work if I install mypy in the project’s virtualenv and use that in the settings.
Steps to reproduce:
brew install mypy
/usr/local/bin/mypy
I had the same error on
Windows 10 Pycharm community 2018.3.5
FYI I am getting the same error on Ubuntu Linux 18.04, Pycharm 2018-03-05, Mypy 0.67, Mypy plugin version 0.10.2. Seems like the path is not getting detected.