leinardi / mypy-pycharm

A plugin providing both real-time and on-demand scanning of Python files with Mypy from within PyCharm/IDEA.
Apache License 2.0
194 stars 31 forks source link

Failure: executable "[...]mypy.exe" not found #35

Open nasosev opened 5 years ago

nasosev commented 5 years ago

This is the exact same issue as https://github.com/leinardi/mypy-pycharm/issues/12 which supposedly was fixed but apparently not for me.

Step 1: Are you in the right place?

Step 2: Describe your environment

Step 3: Describe the problem:

Steps to reproduce:

  1. In 'Settings -> Mypy', set path to mypy.exe in current environment.
  2. Click 'test'.

Error message: "Failure: executable "[...]mypy.exe" not found".

The path is correct and mypy.exe runs properly from the Anaconda prompt.

stacktrace.txt:

java.lang.Throwable: Error while checking Mypy path: Traceback (most recent call last):
  File "C:\Users\nasos\Anaconda3\envs\myenv\Scripts\mypy-script.py", line 5, in <module>
    from mypy.__main__ import console_entry
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\site-packages\mypy\__main__.py", line 4, in <module>
    from mypy.main import main
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\site-packages\mypy\main.py", line 11, in <module>
    from mypy import build
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\site-packages\mypy\build.py", line 62, in <module>
    from mypy.metastore import MetadataStore, FilesystemMetadataStore, SqliteMetadataStore
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\site-packages\mypy\metastore.py", line 12, in <module>
    import sqlite3
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\sqlite3\__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "C:\Users\nasos\Anaconda3\envs\myenv\lib\sqlite3\dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
    at com.leinardi.pycharm.mypy.mpapi.MypyRunner.isMypyPathValid(MypyRunner.java:103)
    at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:177)
    at com.leinardi.pycharm.mypy.mpapi.MypyRunner.checkMypyAvailable(MypyRunner.java:153)
    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:339)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Workaround

Adding '%USERPROFILE% \Anaconda3\envs[ENVIRONMENT NAME]\Library\bin' to the path resolved the issue.

Jackenmen commented 5 years ago

I'm having the same issue when running mypy from venv (pipenv) on Windows.

four43 commented 5 years ago

It's annoying this isn't caught better. A message in the tool panel would be much better than a constant flashing failure.

eballes commented 5 years ago

Exactly same error here, but I can't make the workaround work for me.

lingster commented 5 years ago

I had a similar problem, so I manually pointed the path of mypy in pycharm settings like this: image It seems like the auto-detect wasn't working (maybe confusing the '\' with '/' in windows vs linux?)

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had activity in the last 60 days.