PEP3101 checker installation - python

I want to check PEP-3101 standard for some codes that I have, for this, I want to install flake8-pep3101.
I can not directly install it as it requires PIP upgrade, so I upgrade my PIP from 19.0.3 to 19.1.1.
After upgrade, I began to install it by running
pip install flake8-pep3101
I received this error:
"Collecting flake8-pep3101pip ERROR: Could not find a version that satisfies the requirement flake8-pep3101pip (from versions: none)
ERROR: No matching distribution found for flake8-pep3101pip"
I already have FLAKE8 installed and Phyton 3.7.
What can I do to solve this problem ? it seems that there is no flake8-pep3101 module for this particular python.
I tried to upgrade FLAKE8 using PIP command "pip install --upgrade FLAKE8" and "pip3 install --upgrade FLAKE8":
It gives me error :
Requirement already up-to-date: FLAKE8 in c:\users\mydir\dev\myvirt\lib\site-packages (3.7.7) Requirement already satisfied, skipping upgrade: entrypoints<0.4.0,>=0.3.0 in c:\users\mydir\dev\myvirt\lib\site-packages (from FLAKE8) (0.3) Requirement already satisfied, skipping upgrade: pycodestyle<2.6.0,>=2.5.0 in c:\users\mydir\dev\myvirt\lib\site-packages (from FLAKE8) (2.5.0)
Requirement already satisfied, skipping upgrade: pyflakes<2.2.0,>=2.1.0 in c:\users\mydir\dev\myvirt\lib\site-packages (from FLAKE8) (2.1.1) Requirement already satisfied, skipping upgrade: mccabe<0.7.0,>=0.6.0 in c:\users\mydir\dev\myvirt\lib\site-packages (from FLAKE8) (0.6.1)

From what I can tell, you need to update/reinstall FLAKE8.
To update FLAKE8, use:
pip install --upgrade `FLAKE8`
To install the latest version of FLAKE8, use:
pip install `FLAKE8`
To install a specific version of FLAKE8, use:
pip install FLAKE8==<VERSION>
To install a version of FLAKE8 greater than or equal to one version and less than another, use:
pip install FLAKE8>=<LOW>,<HIGH>
NOTE: if you're using python3 use pip3 instead of pip.
Good luck.

Related

No module named 'OpenSSL' in python

I search on google how to add OpenSSL in python. The command is easy to run.
pip install pyOpenSSL or pip3 install pyOpenSSL. I don't know if my OpenSSL is already installed. I have this response when I installed openssl.
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: pyopenssl in /usr/local/lib/python3.9/site-packages (20.0.1)
Requirement already satisfied: cryptography>=3.2 in /usr/local/lib/python3.9/site-packages (from pyopenssl) (36.0.1)
Requirement already satisfied: six>=1.5.2 in /usr/local/lib/python3.9/site-packages (from pyopenssl) (1.16.0)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.9/site-packages (from cryptography>=3.2->pyopenssl) (1.15.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=3.2->pyopenssl) (2.21)
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
this is my index.py code
import base64
import json
import requests
from OpenSSL import crypto
when I run this command python3 index.py. I always get this error
ModuleNotFoundError: No module named 'OpenSSL'
May i know what's the issue in my setup? Im new in python code. My python version is 3.10.0
It looks like you have pyopenssl installed for a Python 3.9 installation (look at the path: /usr/local/lib/python3.9), but you are trying to run with a Python 3.10 installation.
Use the pip from your Python 3.10 installation to install the required packages. python3 -m pip install pyOpenSSL should do that, regardless of what the standalone pip command resolves to.

Multiple packages cannot install on PyCharm

I am trying to use PyCharm for my python 3 coding on my Linux, and it works great 90% of the time, but I notice that on occasion I cannot import certain packages. For example, when I click Settings->Project->Python Interpreter and try to install 'opencv-python', I get this error:
AttributeError: module 'setuptools.build_meta' has no attribute '__legacy__'
When I try to install opencv-python with pip I get this message:
$ pip install opencv-python
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: opencv-python in ./.local/lib/python3.6/site-packages (4.5.1.48)
Requirement already satisfied: numpy>=1.13.3 in ./.local/lib/python3.6/site-packages (from opencv-python) (1.19.2)
There seems to be some discrepency between the packages my computer has installed and the packages that PyCharm has installed. How can I solve this problem?

Python no module named 'requests' even install requests

I run my python scrapy project shows the error no module named 'requests'
So I type pip install requests
and then terminal information:
Requirement already satisfied: requests in ./Library/Python/2.7/lib/python/site-packages (2.22.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./Library/Python/2.7/lib/python/site-packages (from requests) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./Library/Python/2.7/lib/python/site-packages (from requests) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./Library/Python/2.7/lib/python/site-packages (from requests) (1.25.7)
Requirement already satisfied: certifi>=2017.4.17 in ./Library/Python/2.7/lib/python/site-packages (from requests) (2019.11.28)
type command pip list can see request 2.22.0
I type command python --version to check the python version:
python 2.7.16
Finally I run my scrapy project again still see the same error no module named 'requests'
I have no idea how to fix the error now, any help would be appreciated. Thanks.
Install python3 and pip3 and then pip3 install requests
if you are on ubuntu python3 is installed by default
you should first install pip3 by apt install python3-pip and then pip3 install requests
If you are using two different versions of Python, it should explain why you can't use your module.
To install the module on Python 3, try:
pip3 install requests
And make sure, you are using the correct version.
Check if you are using the same interpreter to which you have installed the package using pip install. As a best practice to avoid this type of issues when you have multiple versions of python, use pip as a module instead of directly calling pip.
eg:
python -m pip install requests
python3 -m pip install requests

How to fix ' [Win error 5] access is denied' error while installing surprise in anaconda

I'm installing surprise package in anaconda and I got this Access denied error. I'm using windows 10. please see the error
C:\Users\Hp>pip install surprise
Collecting surprise
Using cached https://files.pythonhosted.org/packages/61/de/e5cba8682201fcf9c3719a6fdda95693468ed061945493dea2dd37c5618b/surprise-0.1-py2.py3-none-any.whl
Collecting scikit-surprise (from surprise)
Requirement already satisfied: six>=1.10.0 in c:\program files\anaconda3\lib\site-packages (from scikit-surprise->surprise) (1.12.0)
Requirement already satisfied: numpy>=1.11.2 in c:\program files\anaconda3\lib\site-packages (from scikit-surprise->surprise) (1.16.4)
Requirement already satisfied: joblib>=0.11 in c:\program files\anaconda3\lib\site-packages (from scikit-surprise->surprise) (0.13.2)
Requirement already satisfied: scipy>=1.0.0 in c:\program files\anaconda3\lib\site-packages (from scikit-surprise->surprise) (1.2.1)
Installing collected packages: scikit-surprise, surprise
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Program Files\\Anaconda3\\Lib\\site-packages\\scikit_surprise-1.1.0.dist-info'
Consider using the '--user' option or check the permissions.
Your Environment is Pip version, Python and OS. You need to install it as a user
First upgrade your pip:
pip install --upgrade
Then use the user privilege:
pip install --user surprise
For Linux users you install as root privilege. Ubuntu users do not have a root privilege directly so you have to use sudo:
sudo apt install <packagename>

python-Can't use modules installed by Homebrew?

I want to use the essentia module in my python virtualenv and the version of python is 2.7.6.
After I executed
brew tap MTG/essentia
I can't find this module in my Pycharm.
I've also tried to install other package such as matplotlib using
sudo pip install matplotlib
under my virtualenv path.
The directory '/Users/username/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/username/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): matplotlib in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): tornado in /Library/Python/2.7/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): pyparsing>=1.5.6 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Collecting nose (from matplotlib)
/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading nose-1.3.7-py2-none-any.whl (154kB)
100% |████████████████████████████████| 155kB 46kB/s
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade): singledispatch in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade): certifi in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade): backports-abc>=0.4 in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade): six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado->matplotlib)
Installing collected packages: nose
Successfully installed nose-1.3.7
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I checked in Pycharm, however, in the interpreter there was no matplotlib module.
How can I install packages in my virtualenv?
If the pip package is not available, you can find the brew installation in your local python directory.
Quick Fix:
Install essentia to your local environment.
Append the local essentia package to your virtual environment
sys.path.append('/usr/local/lib/python2.7/site-packages')
import essentia
Long Fix:
If you want to fully contain the packages in your virtual environment, try copying the local site-packages/essentia folder to your virtual environment
Copy over any other dependencies such as site-packages/numpy. Check brew's Cellar (/usr/local/Cellar) for other dependencies
You should not install python modules with brew, instead you should use pip. The following method has worked for me in OSX.
Desktop $ virtualenv myproject # Create the virtual environment
Desktop $ cd myproject # Change into that directory
Desktop $ source bin/activate # Enter the virtual environment
(myproject) $ sudo pip install matplotlib # Install matplotlib
(myproject) $ deactivate # Exit from the virtual environment
Look here for a further explanation of virtualenv.

Categories