Giter VIP home page Giter VIP logo

Comments (5)

elarivie avatar elarivie commented on July 19, 2024

Hello @ShadowLNC,

TLTR: Your issue seems to be relatedd to a python2 vs python3 mixup.

I don't know if they are typos in your issue description but sometimes you mention 'python' and sometimes your mention 'python3'.

On ubuntu 'python' is pointing to python2

Note that python2 end of life is January 1st 2020... so you should be using python3 everywhere by now.

I can confirm that the message that your receive is not a linter-mypy bug, in fact linter-mypy is perfectly doing its job of showing you the error message provided by mypy.

Make sure that the linter-mypy setting is using python3 (its the default value unless you have written something in that textbox)

Effectively mypy needs typed-ast to run and if you run the command

python3 -m pip install -U typed-ast

It will install it

You can try to uninstall it first just in case (to start clean)

python3 -m pip uninstall typed-ast
python3 -m pip uninstall mypy

python3 -m pip install -U mypy
python3 -m pip install -U typed-ast

But then even if they are are correctly installed in the python3 packages... if you are using the executable of python2 it will keep complaining that they are not installed.

Let me know if it solves your issue.

from linter-mypy.

ShadowLNC avatar ShadowLNC commented on July 19, 2024

Thanks for the response!
I'm using a virtual environment, hence the python binary (which is a Python3 virtual environment), is it required to use the user packages directory? I'm not sure how mypy is being invoked, and whether typed-ast is actually available (on the path) at runtime.
My executable path for linter-mypy is /home/scott/.atom/venv/bin/python.

from linter-mypy.

elarivie avatar elarivie commented on July 19, 2024

@ShadowLNC I just wrote this small script to help you debug your environment:
Use this script as a wrapper to inspect parameters and environment variables being use

#!/bin/sh

# You can use this script to debug linter-mypy in your environment.
# It basically wrap python3 calls

#1 - Define an output file somewhere on your disk:
outputfile=~/linter-mypy_debug.txt

#2 - Make this script executable (chmod +x linter-mypy_X)

#3 - Change linter-mypy settings to use the current script as a pseudo python executable.

#4 - Within atom trigger a lint process of a file.

#5 - Look at the content of the outputfile

# Clear the output file content
echo "" > "$outputfile"


# The following command will send every parameters received to the output file
echo "PARAMETERS" >> "$outputfile"
echo "$@" >> "$outputfile"

# The following commands will send some important environment variables to the output file

echo "PATH" >> "$outputfile"
echo $PATH >> "$outputfile"

echo "MYPYPATH" >> "$outputfile"
echo $MYPYPATH >> "$outputfile"

echo "PYTHONPATH" >> "$outputfile"
echo $PYTHONPATH >> "$outputfile"

# The following command will send the current working directory path to the output file

echo "Current Working Directory" >> "$outputfile"
pwd >> "$outputfile"


# Forward the call to python3 including all the parameters received so that linter-mypy gets lint output
python3 "$@"

from linter-mypy.

ShadowLNC avatar ShadowLNC commented on July 19, 2024

Thanks 😄

(Apologies - I responded yesterday but it seems it didn't submit?)

Seems like somehow the PYTHONPATH environment variable is being modified and is copied from the PYTHONPATH setting from the linter-pylint plugin. This doesn't always happen, so I suspect a race condition (and linter-pylint is probably modifying the environment which is then picked up by linter-mypy). When PYTHONPATH is empty, everything works as expected.

I've filed the bug with linter-pylint as referenced above, but in the meantime, would it please be possible to add a setting to linter-mypy for the PYTHONPATH variable?

from linter-mypy.

elarivie avatar elarivie commented on July 19, 2024

Hi @ShadowLNC,

In linter-mypy v2.6.9
1- PYTHONPATH can now be specified
2- There is now a more user friendly message if typed-ast is not present

from linter-mypy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.