I hope it is ok to ask this even though it is not specifically a programming question. I installed the SublimeLinter and SublimeLinter-flake8 packages in Sublime Text 3.
I did pip install flake8 and restarted but the console shows the following message:
SublimeLinter: WARNING: cannot locate 'flake8'. Fill in the 'python' or 'executable' setting.
WARNING:SublimeLinter.lint.base_linter.python_linter:cannot locate 'flake8'.Fill in the 'python' or 'executable' setting
I suspect it may have to do with setting a path in the user settings, but I am not sure how to go about it.
As you may see I am a relative newbie.
Thanks.
Please ensure you've followed these steps:
Install SublimeText packages (help)
SublimeLinter
SublimeLinter-flake8
Install Flake8 (use pip, or pip3 if you have multiple python versions)
pip3 install flake8
Configure flake8 settings
Open Sublime Text
Sublime Text -> Preferences -> Package Settings -> Sublime Linter -> Settings
Set the path to the desired python version:
Notice: Custom settings needs to be on the right(user) side!
{
"linters": {
"flake8": {
"executable": [ "python3", "-m", "flake8" ]
}
}
}
Restart Sublime to enable the changes
Not sure about pip or pip3? Please take a look at pip or pip3 to install packages for Python 3?
Related
Introduction
After I installed atom into my debian-ParrotOS for coding python. I've tried to search for flake8 for helping me to figure out the problems while writing code.
The Problem
after I installed linter-flake8 using this command: pip install flake8
It showed me that this line:
[Linter] Error running Flake8
See console for more info
What I've done
I tried several times to re-install linter-flake8. Even I tried to search multiple times for another alterative but all of them was not effcient as linter-flake8.
Fix Linter flake8
Description:
This's the solution for fixing the console problem which we're facing when we decide to install Linter-flake8 for Python3. It has been tested in Linux and Debian.
Why Linter-flake8 doesn't work after installation?
Linter-flake8 default installation meant to be for python 2.7 beside if you read the description of the package, you will also find that their implementation was for python 2.7 not for python3.
Default installation package simulates directly with python 2.7, not for python3. so, you have to install the package using the commands of python3.
Even after inserting your Executable PATH will be only mere of spectacular. Because you need to install flake8 in terms of python3, not python2.
So, What should I do?
Install Linter-flake8 From Atom and then restart your IDE.
Check if it's actually being installed via your package manager by executing: which flake8 in your terminal.
Reopen your IDE and click Ctrl+Shift+P to open the Search in Atom.
Search for Application: Open the Init Script.
Then, Write in the init.coffee this code:
process.env.PATH = ['usr/local/bin/', process.env.PATH].join(':')
Go To your *Executable PATH and paste this path /usr/local/bin/.
Then, open a new Terminal and execute these commands:
First, enter your root Mode by sudo su.
Second, go to cd /usr/local/bin/.
Third, execute these commands:
python3 -m pip install flake8.
ls
apm install linter-flake8
ls
python3 -m pip install flake8-docstring
python3 -m pip install hacking
If you didn't install pip before, then you can install it by sudo apt-get install pip and then, you can move on to continue the installation of flake8.
close your Atom and open it.
If you want to disable The Max Line Lenght you can do that by Default: 0.
Smile!
It will be a courtesy from you if you start following me :) <3
References:
flake8 not found
linter-flake8
I have been trying to import "gdal" in PyCharm for a couple of hours now, but without success and I do not know any further now.
In the Anaconda Powershell I installed gdal:
conda install gdal,
and that seemed to work, I get "# All requested packages already installed". Also, when I hit conda list, gdal is listed as one of the packages (gdal 2.3.3).
Now, normally it works in PyCharm then. However, this time it does not. What I tried:
In PyCharm, I hovered over import gdal and tried to install the package, but without success.
In PyCharm, Settings -> Project Interpreter -> "+" -> tried to install the "GDAL" package there, but without success as well.
In PyCharm, Settings -> Project Interpreter -> "Show All" -> "Show paths for the selected interpreter" -> there I added the path to the "gdal-2.3.3-py37hdf43c64_0" directory ("C:...\AppData\Local\Continuum\anaconda3\pkgs"), but without success.
Any ideas? Thank you!
The best way to use conda anywhere would be to install a conda environment with the following commands followed by using the same environment in the pycharm.
Conda environment install commands:
conda create -n gdal python=3.7
activate gdal
conda install -c conda-forge gdal
Setting conda environment in the pycharm:
-> Go to Preferences / settings in pycharm
-> Search for `python interpreter`
-> Click on the drop down and then click on show all
-> Click on the + symbol to add the environment
-> Click on Conda environment in the left panel and select existing environment
-> Select the exact path of python3.7 (or other version) where the environment is installed (/opt/anaconda3/envs/gis/bin/python3.7 - in case of mac)
That should get the job done.
i wonder How to reload python package after pip install in Visual Studio Code?
pip install 'package-A'
pip list
Not exist 'package-A'
Restart 'Visual Studio Code'
Is the only way restart?
Thank u.
The best answer I've found is to use Developer:Reload Window like rioV8 suggested. You can either use the command palette or you can change the key mappings as described here. There's already a Ctrl + R key mapping for reloading the window, but its got a 'when' condition attached to it so I changed that to true. I also had to delete key mappings for other extensions so there was no overlap.
ctrl+shift+p and choose "Developer: Reload with extentions disabled"
You can do that using the Refresh Explorer (The reload button) right next to the directory/workspace that you opened up in the File Explorer.
You might have to hover for a while next to the workspace/directory name on the file explorer once it's expanded to have it in view.
You mean upgrade or re-install ?
pip install --upgrade --force-reinstall <package>
OR
pip install -I <package>
pip install --ignore-installed <package>
Try these commands
On MacOS, use command + shift + p and then choose "Developer: Reload Window". It is helpful to bind this to command + r. For Windows users, replace command with CTRL.
Are you sure this is a vscode issue? What happens when you run pip install from a normal command prompt? I suspect you will have the same issue, if that proves true, I would entirely uninstall python and re-install python, then install/upgrade pip to latest.
python -m pip install –upgrade pip
I decided to I wanted to test the newest version of Python. I downloaded from source and performed an altinstall so python3.7 (full) in located in usr/local/lib and its executable is # usr/local/bin. I thought an easy way to go about getting modules installed would be to select this executable as my Project Interpreter in PyCharm and use its package manager to install pip and whatnot. However, when I select 3.7 executable as the: Virtualenv Environment it will not allow me to hit 'ok'. Instead a warning at the bottom left of the window says:
Environment location directory is not empty
So I tried selecting the executable as the System Interpreter and it works to an extent. It allows me to hit ok but in the package manager window there is a yellow bar at the bottom that says:
Python packaging tools not found. Install packaging tools
So if I click the link it attempts an install (requires sudo) and then instead of installing, a warning box pops up:
Failed to install Python packaging tools:
ModuleNotFoundError: No moudle named'_ctypes'
So, how do I get PyCharm to use 3.7 s/t I can install modules for it?
I have installed python 3.5 on my Windows 7 machine. When I installed it, I marked the check box to install pip. After the installation, I wanted to check whether pip was working, so I typed pip on the command line and hit enter, but did not respond. The cursor blinks but it does not display anything.
Please help.
Regards.
Add the Script folder of python to your environment path
or you can do this from command line:
python -m pip install package-name
go the windows cmd prompt
go to the python directory
then type python -m pip install package-name
run it at the cmd window, not inside the python window. it took me forever to realize my mistake.
I was having the same problem on Windows 10, This is how I fix it:
Click the search icon and type System Environment
In System Properties click on Environment Variables
In System Variables tab click New
Enter PYTHON3_SCRIPTS for the variable name and C:\Users\YOUR USER NAME\AppData\Local\Programs\Python\Python38-32\Scripts for Variable Value. Don't forget to change (YOUR USER NAME) in the path with your user, And to change your Python version or just go to this path to check it C:\Users\YOUR USER NAME\AppData\Local\Programs\Python
Click OK
Click NEW again!
Enter PYTHON3_HOME for the variable name and C:\Users\YOUR USER NAME\AppData\Local\Programs\Python\Python38-32\ for Variable Value. Don't forget to change (YOUR USER NAME) in the path with your user, And to change your Python version or just go to this path to check it C:\Users\YOUR USER NAME\AppData\Local\Programs\Python
Click OK
Find Path in the same tab select it and click Edit
Click New and type %PYTHON3_SCRIPTS% Then click OK
Now, everything is set. Restart your Terminal and pip should be working now.
I had the same problem with Version 3.5.2.
Have you tried py.exe -m install package-name? This worked for me.
As soon as you open a command prompt, use:
python -m pip install --upgrade pip
then
python -m pip install <<package-name>>
If you are working in Pycharm, an easy way is go to file>setting>project interpreter. Click on the + icon you will find on right side probably and then search and install required library.
For those with several python versions of python 3 installed in windows: I solved this issue by executing the pip install command directly from my python35 Scripts folder in cmd...for some reason pip3 pointed to python 34 even though python 35 was set first in environmental variables.
I had the issue, and answered this same question sometimes ago. Do open a cmd if in windows OS or linux OS with admistrative privilege. Then python -m pip install --upgrade pip
then
python -m pip install <>
Working on windows and above version than 3.0
First upgrade pip to pip3 by following command:
pip3 install --upgrade setuptools pip
Then install maximum package by following command:
pip3 install <package_name>
I never wrote all package because some package not support to pip or pip3 command.