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

MYPYPATH incorrect please remove it #1124

Closed
rwprime opened this issue Mar 21, 2020 · 8 comments
Closed

MYPYPATH incorrect please remove it #1124

rwprime opened this issue Mar 21, 2020 · 8 comments
Milestone

Comments

@rwprime
Copy link

rwprime commented Mar 21, 2020

Someone please - the following error says remove it. Well, how do I do that? I did a grep -iR for mypypath but could find nothing of interest.
On Arch VMs in Windows 10 on three PCs, I got Thonny running on two of them, but on the third one, as soon as the 'import' line is hit, I get an error in terminal. Why terminal? Well because I never got an icon in my xfce4 gui. (All 3 PCs have the same Arch build and packages)(and the given website didn't help either). Here's the error:

WARNING:thonny:MyPy: /home/richard/.local/lib/python3.8/site-packages is in the MYPYPATH. Please remove it.
See https://mypy.readthedocs.io/en/latest/running_mypy.html#how-mypy-handles-imports for more info
WARNING: MyPy: /home/richard/.local/lib/python3.8/site-packages is in the MYPYPATH. Please remove it.
See https://mypy.readthedocs.io/en/latest/running_mypy.html#how-mypy-handles-imports for more info
@aivarannamaa
Copy link
Member

What was your current directory when you got this error?

@rwprime
Copy link
Author

rwprime commented Mar 22, 2020

What are the "normal site-packages are not writeable"? - If I knew, I could chown them if that's the problem. What are they and do they need to be richard:users or something else? BTW ls -lR /home/richard | less shows that all are richard users as they should (same for /home).
I'm in ~ (/home/richard). My install line was: pip3 install thonny. BTW, I uninstalled with pip3 uninstall thonny and rebooted and tried again and rebooted and I'll paste in the install text. Also, I do not get an icon in my xfce4 Start Menu. On two other PCs, the icon showed up in Development along with IDLE 2 and IDLE 3. Here's the install text:

pip3 install thonny
Defaulting to user installation because normal site-packages is not writeable
Collecting thonny
  Using cached thonny-3.2.7-py3-none-any.whl (1.1 MB)
Requirement already satisfied: asttokens>=1.1.10 in ./.local/lib/python3.8/site-packages (from thonny) (2.0.3)
Requirement already satisfied: docutils>=0.13.1 in ./.local/lib/python3.8/site-packages (from thonny) (0.16)
Requirement already satisfied: pylint>=1.6.5 in ./.local/lib/python3.8/site-packages (from thonny) (2.4.4)
Requirement already satisfied: astroid>=1.4.9 in ./.local/lib/python3.8/site-packages (from thonny) (2.3.3)
Requirement already satisfied: setuptools>=33.1.1 in /usr/lib/python3.8/site-packages (from thonny) (46.1.1)
Requirement already satisfied: Send2Trash>=1.4.2 in ./.local/lib/python3.8/site-packages (from thonny) (1.5.0)
Requirement already satisfied: pyserial>=3.1.1 in ./.local/lib/python3.8/site-packages (from thonny) (3.4)
Requirement already satisfied: jedi>=0.10 in ./.local/lib/python3.8/site-packages (from thonny) (0.16.0)
Requirement already satisfied: mypy>=0.470 in ./.local/lib/python3.8/site-packages (from thonny) (0.770)
Requirement already satisfied: six in /usr/lib/python3.8/site-packages (from asttokens>=1.1.10->thonny) (1.14.0)
Requirement already satisfied: isort<5,>=4.2.5 in ./.local/lib/python3.8/site-packages (from pylint>=1.6.5->thonny) (4.3.21)
Requirement already satisfied: mccabe<0.7,>=0.6 in ./.local/lib/python3.8/site-packages (from pylint>=1.6.5->thonny) (0.6.1)
Requirement already satisfied: wrapt==1.11.* in ./.local/lib/python3.8/site-packages (from astroid>=1.4.9->thonny) (1.11.2)
Requirement already satisfied: lazy-object-proxy==1.4.* in ./.local/lib/python3.8/site-packages (from astroid>=1.4.9->thonny) (1.4.3)
Requirement already satisfied: parso>=0.5.2 in ./.local/lib/python3.8/site-packages (from jedi>=0.10->thonny) (0.6.2)
Requirement already satisfied: typing-extensions>=3.7.4 in ./.local/lib/python3.8/site-packages (from mypy>=0.470->thonny) (3.7.4.1)
Requirement already satisfied: mypy-extensions<0.5.0,>=0.4.3 in ./.local/lib/python3.8/site-packages (from mypy>=0.470->thonny) (0.4.3)
Requirement already satisfied: typed-ast<1.5.0,>=1.4.0 in ./.local/lib/python3.8/site-packages (from mypy>=0.470->thonny) (1.4.1)
Installing collected packages: thonny
Successfully installed thonny-3.2.7

@rwprime
Copy link
Author

rwprime commented Mar 22, 2020

Here's something I find odd. On a PC where the install of thonny had no problem, ls -lR .local/lib/python3.8/site-packages | wc - l gives a 'word count' or line count of 211, but on the PC where the install had the error mentioned before, the line count is 7021. What's that all about?

@rwprime
Copy link
Author

rwprime commented Mar 22, 2020

I can see where this is going. I'm probably going to just go with a cloned base build of Arch and install everything and tweak it all over again which will probably take maybe an hour and a half if I want thonny on that PC and delete the entire build with the fault.

@rwprime
Copy link
Author

rwprime commented Mar 23, 2020

So I built an entire Arch build today and did everything the same as on my other two PCs (I have a list printed out) and I got the same errors - Thonny does not show up in Start / Development with IDLE2 and IDLE3 as it does on the other two PCs and I get the following errors - oh and I put
export PATH=$PATH:/home/richard/.local/bin in .bashrc and rebooted and did another pip3 install thonny and rebooted again and still I get no Thonny in Start / Development and a second set of text which I will past in and again ls -lR .local/lib/python3.8/site-packages | wc -l gives a line count of 7021 instead of 211 as on the other two PCs (and this is on a brand new Arch build):

[richard@arch-hp ~]$ thonny
WARNING:thonny:MyPy: /home/richard/.local/lib/python3.8/site-packages is in the MYPYPATH. Please remove it.
See https://mypy.readthedocs.io/en/latest/running_mypy.html#how-mypy-handles-imports for more info

WARNING: MyPy: /home/richard/.local/lib/python3.8/site-packages is in the MYPYPATH. Please remove it.
See https://mypy.readthedocs.io/en/latest/running_mypy.html#how-mypy-handles-imports for more info

Brand new install of Arch 3-23-20
[richard@arch-hp ]$ pip3 install thonny
Defaulting to user installation because normal site-packages is not writeable
Collecting thonny
Downloading thonny-3.2.7-py3-none-any.whl (1.1 MB)
|████████████████████████████████| 1.1 MB 1.5 MB/s
Collecting docutils>=0.13.1
Downloading docutils-0.16-py2.py3-none-any.whl (548 kB)
|████████████████████████████████| 548 kB 4.2 MB/s
Collecting astroid>=1.4.9
Downloading astroid-2.3.3-py3-none-any.whl (205 kB)
|████████████████████████████████| 205 kB 5.3 MB/s
Collecting pylint>=1.6.5
Downloading pylint-2.4.4-py3-none-any.whl (302 kB)
|████████████████████████████████| 302 kB 6.7 MB/s
Collecting mypy>=0.470
Downloading mypy-0.770-cp38-cp38-manylinux1_x86_64.whl (22.6 MB)
|████████████████████████████████| 22.6 MB 13.2 MB/s
Collecting jedi>=0.10
Downloading jedi-0.16.0-py2.py3-none-any.whl (1.1 MB)
|████████████████████████████████| 1.1 MB 4.8 MB/s
Requirement already satisfied: setuptools>=33.1.1 in /usr/lib/python3.8/site-packages (from thonny) (46.1.1)
Collecting Send2Trash>=1.4.2
Downloading Send2Trash-1.5.0-py3-none-any.whl (12 kB)
Collecting pyserial>=3.1.1
Downloading pyserial-3.4-py2.py3-none-any.whl (193 kB)
|████████████████████████████████| 193 kB 8.5 MB/s
Collecting asttokens>=1.1.10
Downloading asttokens-2.0.3-py2.py3-none-any.whl (20 kB)
Requirement already satisfied: six
=1.12 in /usr/lib/python3.8/site-packages (from astroid>=1.4.9->thonny) (1.14.0)
Collecting lazy-object-proxy==1.4.*
Downloading lazy_object_proxy-1.4.3-cp38-cp38-manylinux1_x86_64.whl (58 kB)
|████████████████████████████████| 58 kB 3.0 MB/s
Collecting wrapt==1.11.*
Downloading wrapt-1.11.2.tar.gz (27 kB)
Collecting isort<5,>=4.2.5
Downloading isort-4.3.21-py2.py3-none-any.whl (42 kB)
|████████████████████████████████| 42 kB 846 kB/s
Collecting mccabe<0.7,>=0.6
Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting mypy-extensions<0.5.0,>=0.4.3
Downloading mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB)
Collecting typing-extensions>=3.7.4
Downloading typing_extensions-3.7.4.1-py3-none-any.whl (20 kB)
Collecting typed-ast<1.5.0,>=1.4.0
Downloading typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl (768 kB)
|████████████████████████████████| 768 kB 4.5 MB/s
Collecting parso>=0.5.2
Downloading parso-0.6.2-py2.py3-none-any.whl (97 kB)
|████████████████████████████████| 97 kB 3.6 MB/s
Installing collected packages: docutils, lazy-object-proxy, wrapt, astroid, isort, mccabe, pylint, mypy-extensions, typing-extensions, typed-ast, mypy, parso, jedi, Send2Trash, pyserial, asttokens, thonny
Running setup.py install for wrapt ... done
WARNING: The script isort is installed in '/home/richard/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts epylint, pylint, pyreverse and symilar are installed in '/home/richard/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts dmypy, mypy, stubgen and stubtest are installed in '/home/richard/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed Send2Trash-1.5.0 astroid-2.3.3 asttokens-2.0.3 docutils-0.16 isort-4.3.21 jedi-0.16.0 lazy-object-proxy-1.4.3 mccabe-0.6.1 mypy-0.770 mypy-extensions-0.4.3 parso-0.6.2 pylint-2.4.4 pyserial-3.4 thonny-3.2.7 typed-ast-1.4.1 typing-extensions-3.7.4.1 wrapt-1.11.2

@rwprime
Copy link
Author

rwprime commented Mar 23, 2020

I have found the only solution that works. First I pip3 uninstall thonny and then I git clone yay an AUR helper (which I didn't want to do) and then I yay -Sy thonny and then the Thonny icon shows up in Start / Development. This has been the only way to get that icon. I then ran a .py file and I didn't get any errors and then I tried it by starting it from terminal and ran the same file and It exited cleanly - no errors. I recommend to stop telling people to install with pip3 install thonny or pip install thonny at least if they're in Arch linux and to use yay. Using git clone doesn't work either.

@aivarannamaa
Copy link
Member

Sorry for late reply.

When you install thonny with pip, then you are not supposed to get any icons -- command line (or making a desktop file yourself) is your only way.

"Defaulting to user installation because normal site-packages is not writeable"

This is not Thonny-specific -- in some Linuxes pip3 tries to install into system directory and fails without sudo. In your case it falled back to pip3 install --user thonny, which is OK. I'll consider updating the recommendation and adding --user (but this is not required in a virtual environment).

@aivarannamaa
Copy link
Member

I could now reproduce this (it simply wasn't reproducible in my development environment) and also found the reason: python/mypy#7604

Will include a fix in the next release.

@aivarannamaa aivarannamaa added this to the 4.0.0 milestone Mar 31, 2021
aivarannamaa added a commit that referenced this issue Mar 31, 2021
MyPy doesn't accept extra stubs even in a subdirectory under site-packages, therefore MyPy checks were not working. As turtle.pyi is now in Typeshed, I don't need to include it anymore. User can specify another directory with the new configuration parameter.
aivarannamaa added a commit that referenced this issue Apr 30, 2021
MyPy doesn't accept extra stubs even in a subdirectory under site-packages, therefore MyPy checks were not working. As turtle.pyi is now in Typeshed, I don't need to include it anymore. User can specify another directory with the new configuration parameter.
@aivarannamaa aivarannamaa modified the milestones: 4.0.0, 3.3.7 Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants