I installed pylint by pip install pylint :
Requirement already satisfied: pylint in c:\users\horseman.mini\appdata\roaming\python\python37\site-packages (2.5.3)
Requirement already satisfied: toml>=0.7.1 in
c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from pylint) (0.10.1)
Requirement already satisfied: colorama; sys_platform == "win32" in
c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from pylint) (0.4.1)
Requirement already satisfied: isort<5,>=4.2.5 in
c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from pylint) (4.3.21)
Requirement already satisfied: astroid<=2.5,>=2.4.0 in
c:\users\horseman.mini\appdata\roaming\python\python37\site-packages (from pylint) (2.4.2)
Requirement already satisfied: mccabe<0.7,>=0.6 in
c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from pylint) (0.6.1)
Requirement already satisfied: lazy-object-proxy==1.4.* in
c:\users\horseman.mini\appdata\roaming\python\python37\site-packages (from astroid<=2.5,>=2.4.0->pylint) (1.4.3)
Requirement already satisfied: typed-ast<1.5,>=1.4.0; implementation_name == "cpython" and python_version < "3.8" in c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from astroid<=2.5,>=2.4.0->pylint) (1.4.1)
Requirement already satisfied: wrapt~=1.11 in
c:\users\horseman.mini\appdata\roaming\python\python37\site-packages (from astroid<=2.5,>=2.4.0->pylint) (1.12.1)
Requirement already satisfied: six~=1.12 in
c:\users\horseman.mini\appdata\local\programs\python\python37\lib\site-packages (from astroid<=2.5,>=2.4.0->pylint) (1.13.0)
But when I run in the directiy with file I want to check pylint text.py it writes
$ pylint test.py
bash: pylint: command not found
I didn't add path to pylint to PATH because I can't find its path. But when I run python and import pylint it imports ok. How could I run pylint from command line?
any python module can be run with python -m MODULE for instance I always use python3 -m pip since I can never manage to get the pip alias to work for the correct version π. so you can use pylint as:
python -m pylint test.py
Related
I am trying to pip install a CLI and it successfully installs.
pip3 install databricks-cli
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: databricks-cli in ./Library/Python/3.8/lib/python/site-packages (0.14.3)
Requirement already satisfied: click>=6.7 in ./Library/Python/3.8/lib/python/site-packages (from databricks-cli) (7.1.2)
Requirement already satisfied: requests>=2.17.3 in ./Library/Python/3.8/lib/python/site-packages (from databricks-cli) (2.25.1)
Requirement already satisfied: six>=1.10.0 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (from databricks-cli) (1.15.0)
Requirement already satisfied: tabulate>=0.7.7 in ./Library/Python/3.8/lib/python/site-packages (from databricks-cli) (0.8.9)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./Library/Python/3.8/lib/python/site-packages (from requests>=2.17.3->databricks-cli) (1.26.4)
Requirement already satisfied: idna<3,>=2.5 in ./Library/Python/3.8/lib/python/site-packages (from requests>=2.17.3->databricks-cli) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in ./Library/Python/3.8/lib/python/site-packages (from requests>=2.17.3->databricks-cli) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in ./Library/Python/3.8/lib/python/site-packages (from requests>=2.17.3->databricks-cli) (2020.12.5)
But when I go ahead and try to use a command I am given an error that it cannot find the command.
~ databricks --version
zsh: command not found: databricks
I needed the following command.
sudo -H pip3 install databricks-cli
I am facing a classic "Module not found error". However, I cannot solved my problem with the questions already posted.
I am trying to use the google.cloud API in order to download some data from a public Google repository to a local linux server.
Below are the instructions I used in a Jupyter server:
# Upgrading pip
!/usr/bin/python3.8 -m pip install --upgrade pip
# Installing the Google cloud storage API
!pip3 install google
!pip3 install google-cloud-storage
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: google in /home/antoine/.local/lib/python3.8/site-packages (3.0.0)
Requirement already satisfied: beautifulsoup4 in /home/antoine/.local/lib/python3.8/site-packages (from google) (4.9.1)
Requirement already satisfied: soupsieve>1.2 in /home/antoine/.local/lib/python3.8/site-packages (from beautifulsoup4->google) (2.0.1)
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: google-cloud-storage in /home/antoine/.local/lib/python3.8/site-packages (1.30.0)
Requirement already satisfied: google-cloud-core<2.0dev,>=1.2.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-cloud-storage) (1.4.1)
Requirement already satisfied: google-resumable-media<2.0dev,>=0.6.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-cloud-storage) (0.7.1)
Requirement already satisfied: google-auth<2.0dev,>=1.11.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-cloud-storage) (1.20.1)
Requirement already satisfied: google-api-core<2.0.0dev,>=1.19.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (1.22.1)
Requirement already satisfied: google-crc32c<0.2dev,>=0.1.0; python_version >= "3.5" in /home/antoine/.local/lib/python3.8/site-packages (from google-resumable-media<2.0dev,>=0.6.0->google-cloud-storage) (0.1.0)
Requirement already satisfied: six in /home/antoine/.local/lib/python3.8/site-packages (from google-resumable-media<2.0dev,>=0.6.0->google-cloud-storage) (1.15.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-auth<2.0dev,>=1.11.0->google-cloud-storage) (4.1.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth<2.0dev,>=1.11.0->google-cloud-storage) (0.2.1)
Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.5" in /home/antoine/.local/lib/python3.8/site-packages (from google-auth<2.0dev,>=1.11.0->google-cloud-storage) (4.6)
Requirement already satisfied: setuptools>=40.3.0 in /usr/local/lib/python3.8/dist-packages (from google-auth<2.0dev,>=1.11.0->google-cloud-storage) (49.3.0)
Requirement already satisfied: pytz in /usr/lib/python3/dist-packages (from google-api-core<2.0.0dev,>=1.19.0->google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (2018.3)
Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /usr/lib/python3/dist-packages (from google-api-core<2.0.0dev,>=1.19.0->google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (2.18.4)
Requirement already satisfied: protobuf>=3.12.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-api-core<2.0.0dev,>=1.19.0->google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (3.13.0)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-api-core<2.0.0dev,>=1.19.0->google-cloud-core<2.0dev,>=1.2.0->google-cloud-storage) (1.52.0)
Requirement already satisfied: cffi>=1.0.0 in /home/antoine/.local/lib/python3.8/site-packages (from google-crc32c<0.2dev,>=0.1.0; python_version >= "3.5"->google-resumable-media<2.0dev,>=0.6.0->google-cloud-storage) (1.14.1)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/lib/python3/dist-packages (from rsa<5,>=3.1.4; python_version >= "3.5"->google-auth<2.0dev,>=1.11.0->google-cloud-storage) (0.4.2)
Requirement already satisfied: pycparser in /home/antoine/.local/lib/python3.8/site-packages (from cffi>=1.0.0->google-crc32c<0.2dev,>=0.1.0; python_version >= "3.5"->google-resumable-media<2.0dev,>=0.6.0->google-cloud-storage) (2.20)
from google.cloud import storage
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-48-d626caf5a463> in <module>
----> 1 from google.cloud import storage
2
3
4 def download_blob(bucket_name, source_blob_name, destination_file_name):
5 """Downloads a blob from the bucket."""
ModuleNotFoundError: No module named 'google'
Thank you for your advice!
Sometimes, when you have multiple versions of Python installed (with multiple Python 3.X versions), using pip3 is not enough, as it does not necessarily install a package for the latest version of Python installed on your machine.
You can check what version of python your pip3 is using by using the pip3 --version command.
If you plan to run a script with Python 3.8 and need to install a package for this specific version of Python, you can use:
pip3.8 install PACKAGE or
python3.8 -m pip install PACKAGE
I just installed awscli using pip pip install awscli==1.15 --user. This was the output -
Requirement already satisfied: awscli==1.15 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (1.15.0)
Requirement already satisfied: colorama<=0.3.7,>=0.2.5 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from awscli==1.15) (0.3.7)
Requirement already satisfied: docutils>=0.10 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from awscli==1.15) (0.15.2)
Requirement already satisfied: rsa<=3.5.0,>=3.1.2 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from awscli==1.15) (3.4.2)
Requirement already satisfied: PyYAML<=3.12,>=3.10 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from awscli==1.15) (3.12)
Requirement already satisfied: botocore==1.10.0 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from awscli==1.15) (1.10.0)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.12 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from awscli==1.15) (0.1.13)
Requirement already satisfied: pyasn1>=0.1.3 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from rsa<=3.5.0,>=3.1.2->awscli==1.15) (0.4.7)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from botocore==1.10.0->awscli==1.15) (0.9.4)
Requirement already satisfied: python-dateutil<2.7.0,>=2.1 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from botocore==1.10.0->awscli==1.15) (2.6.1)
Requirement already satisfied: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from s3transfer<0.2.0,>=0.1.12->awscli==1.15) (3.3.0)
Requirement already satisfied: six>=1.5 in /Users/xyz/Library/Python/2.7/lib/python/site-packages (from python-dateutil<2.7.0,>=2.1->botocore==1.10.0->awscli==1.15) (1.12.0)
And it is also showing in the list of pip packages.
Package Version
-------------------------------------- --------
altgraph 0.10.2
ansible 2.8.0
asn1crypto 0.24.0
awscli 1.15.0
But when I'm trying to run any aws command I get command not found for example -
wwww:~ rgsd$ aws
-bash: aws: command not found
wwww:~ rgsd$ awscli
-bash: awscli: command not found
wwww:~ rgsd $ aws s3
-bash: aws: command not found
I also executed the command to include this in my $PATH.
export PATH=~/.local/bin:$PATH
But no success on that. I use Mac machine.
What am I doing wrong ?
For Modern macos/OSX, you need to find your ~/Library/Python/$version/bin directory and add it to your $PATH. This will help you locate the one where aws got installed.
$ ls -d ~/Library/Python/*/bin/aws
/Users/bbronosky/Library/Python/3.6/bin/aws
So based on that I added this line to my .bashrc
export PATH=$HOME/Library/Python/3.6/bin:$PATH
This link is helpful -
https://www.edureka.co/community/6039/post-installation-aws-cli-not-added
In an attempt to access and run Matlab code via Jupyter notebook and Python, I tried installing 'matlab_kernal' (w/ typo) and 'matlab_kernel' as suggested by a blog, I didn't realize I needed MatLab, not MatLab Compiler Runtime.
I received the error:
"Collecting matlab_kernal
Could not find a version that satisfies the requirement matlab_kernal (from versions: )
No matching distribution found for matlab_kernal"
As a work around, I found python code on GitHub that calculated the metric I wanted, but the author said I'd need to install 'MPI' from 'mpi4py'.
However, it seems my Terminal is now stuck on my previous installation attempts of 'matlab_kernal'. It lists my previous attempts to install these packages (see all white text above red error message in the attached screen capture).
I'm running: pip 18.1 from /anaconda3/lib/python3.7/site-packages/pip (python 3.7)
I've tried:
pip uninstall 'package'
Terminal restart
laptop restart
Screenshot of Terminal error
Please use:
pip install matlab-kernel
Try with conda as well:
conda install -c pchrapka matlab_kernel
I think you're making a typo with kernal.
I am on py3.7 with pip v19.3.
Output:
$ pip install matlab-kernel
Collecting matlab-kernel
Downloading https://files.pythonhosted.org/packages/64/ad/5f471160ec33e2f0f3586d285cd5e3b6dff51027849f28369d43d1d57fd1/matlab_kernel-0.16.7-py3-none-any.whl
Requirement already satisfied: jupyter-client>=4.4.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from matlab-kernel) (5.3.4)
Collecting metakernel>=0.23.0
Downloading https://files.pythonhosted.org/packages/ad/a9/0cd74cfbc9c4aeb117bdb7fd9ff12c3890be34ef5c77932e00ef4afaca98/metakernel-0.24.3-py2.py3-none-any.whl (208kB)
|ββββββββββββββββββββββββββββββββ| 215kB 246kB/s
Collecting wurlitzer>=1.0.2; platform_system != "Windows"
Downloading https://files.pythonhosted.org/packages/24/5e/f3bd8443bfdf96d2f5d10097d301076a9eb55637b7864e52d2d1a4d8c72a/wurlitzer-2.0.0-py2.py3-none-any.whl
Requirement already satisfied: ipython>=4.0.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from matlab-kernel) (7.8.0)
Requirement already satisfied: pyzmq>=13 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (18.1.0)
Requirement already satisfied: tornado>=4.1 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (6.0.3)
Requirement already satisfied: traitlets in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (4.3.3)
Requirement already satisfied: python-dateutil>=2.1 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (2.8.0)
Requirement already satisfied: jupyter-core>=4.6.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (4.6.0)
Requirement already satisfied: pexpect>=4.2 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from metakernel>=0.23.0->matlab-kernel) (4.7.0)
Collecting portalocker
Downloading https://files.pythonhosted.org/packages/91/db/7bc703c0760df726839e0699b7f78a4d8217fdc9c7fcb1b51b39c5a22a4e/portalocker-1.5.2-py2.py3-none-any.whl
Requirement already satisfied: ipykernel in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from metakernel>=0.23.0->matlab-kernel) (5.1.2)
Collecting ipyparallel
Downloading https://files.pythonhosted.org/packages/3f/82/aaa7a357845a98d4028f27c799f0d3bb2fe55fc1247c73dc712b4ae2344c/ipyparallel-6.2.4-py2.py3-none-any.whl (198kB)
|ββββββββββββββββββββββββββββββββ| 204kB 698kB/s
Requirement already satisfied: decorator in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (4.4.0)
Requirement already satisfied: setuptools>=18.5 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (39.0.1)
Requirement already satisfied: pickleshare in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.7.5)
Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (2.0.10)
Requirement already satisfied: jedi>=0.10 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.15.1)
Requirement already satisfied: pygments in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (2.4.2)
Requirement already satisfied: appnope; sys_platform == "darwin" in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.1.0)
Requirement already satisfied: backcall in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.1.0)
Requirement already satisfied: ipython-genutils in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from traitlets->jupyter-client>=4.4.0->matlab-kernel) (0.2.0)
Requirement already satisfied: six in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from traitlets->jupyter-client>=4.4.0->matlab-kernel) (1.12.0)
Requirement already satisfied: ptyprocess>=0.5 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from pexpect>=4.2->metakernel>=0.23.0->matlab-kernel) (0.6.0)
Requirement already satisfied: wcwidth in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython>=4.0.0->matlab-kernel) (0.1.7)
Requirement already satisfied: parso>=0.5.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jedi>=0.10->ipython>=4.0.0->matlab-kernel) (0.5.1)
Installing collected packages: portalocker, ipyparallel, metakernel, wurlitzer, matlab-kernel
Successfully installed ipyparallel-6.2.4 matlab-kernel-0.16.7 metakernel-0.24.3 portalocker-1.5.2 wurlitzer-2.0.0
WARNING: You are using pip version 19.3; however, version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
It's a version issue for pip and MacOS
See this thread
terminal error in MacOS from command 'pip install 'package-name':
"Collecting 'package-name'
Could not find a version that satisfies the requirement 'package-name' (from versions: )
No matching distribution found for 'package-name'"
Uninstall pip and reinstall pip in terminal
I am trying a deployment script, which will need to import boto3, when I run the script, it give me error message:
ImportError: No module named boto3
then I ran:
pip install boto3
it returns:
Requirement already satisfied: boto3 in /usr/local/lib/python3.7/site-packages (1.9.228)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.9.4)
Requirement already satisfied: s3transfer<0.3.0,>=0.2.0 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.2.1)
Requirement already satisfied: botocore<1.13.0,>=1.12.228 in /usr/local/lib/python3.7/site-packages (from boto3) (1.12.228)
Requirement already satisfied: docutils<0.16,>=0.10 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (0.14)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1; python_version >= "2.7" in /usr/local/lib/python3.7/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (2.8.0)
Requirement already satisfied: urllib3<1.26,>=1.20; python_version >= "3.4" in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (1.25.3)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.13.0,>=1.12.228->boto3) (1.12.0)
I ran pip3 install boto3, still it gave the same output as above.
then I ran the deployment script, the same errors with complaining
ImportError: No module named boto3
Any ideas where goes wrong?
I'm using mac 10.14.6 version.
Requirement already satisfied: boto3 in /usr/local/lib/python3.7/site-packages (1.9.228)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.9.4)
Make sure that /usr/local/lib/python3.7/site-packages and /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages are in the path.
Use the below code to temporarily append it to the path.:
import sys
print(sys.path)
sys.path.append('/usr/local/lib/python3.7/site-packages')
sys.path.append('/Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages')
print(sys.path)
import boto3
Make sure you have installed your package with the pip associated with a particular python, use:
python -m pip install <pkg>
instead of:
pip install <pkg>