No module named 'OpenSSL' in python - 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.

Related

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?

Issue with impacket & python

Hi there boys and girls,
I am trying to run a script written in python and the console is telling me this:
Install the following library to make this script work
Impacket : https://github.com/CoreSecurity/impacket.git
PyCrypto : https://pypi.python.org/pypi/pycrypto
The problem is that I have already installed those python packages in python3 so when I make a request via pip for those packages I receive this:
Requirement already satisfied: impacket in /usr/local/lib/python3.8/dist-packages (0.9.17)
Requirement already satisfied: ldap3>=2.5.0 in /usr/lib/python3/dist-packages (from impacket) (2.7)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from impacket) (1.15.0)
Hid the rest of the lines but the idea is that. I understand that the package is already installed in my system but I cannot use those with python2.7.
Any idea how to solve this?
In this case the error is because you have not installed impacket for python2.7.
Before installing impacket we need to install pip2 in python2.7, Download get-pip.py form Link
if pip2 is already installed you can verify this by
pip --verison, output of that command should be
pip 20.3.3 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
If pip2 is not installed then install pip2 in python2 package using sudo python2 get-pip.py
Next, install impacket for python2 using pip install . (this must be with in the impacket directory link)
then try to run your script

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

PEP3101 checker installation

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.

pywin32 requirement is not satisfied after installing pypiwin32

Trying to install pyad package for Python 2.7.13 (windows x64) using pip.
There is pywin32 package among requirements, so we get an error:
C:\Windows\system32>pip install pyad
Collecting pyad
Using cached pyad-0.5.16.tar.gz
Requirement already satisfied: setuptools in c:\python27\lib\site-packages (from pyad)
Collecting pywin32 (from pyad)
Could not find a version that satisfies the requirement pywin32 (from pyad) (from versions: )
No matching distribution found for pywin32 (from pyad)
Then I install pypiwin32 which used to work in such cases:
C:\Windows\system32>pip install pypiwin32
Collecting pypiwin32
Using cached pypiwin32-219-cp27-none-win32.whl
Installing collected packages: pypiwin32
Successfully installed pypiwin32-219
But after this I still can't install pyad with the same error as above, like pypiwin32 has never been installed:
C:\Windows\system32>pip install pyad
Collecting pyad
Using cached pyad-0.5.16.tar.gz
Requirement already satisfied: setuptools in c:\python27\lib\site-packages (from pyad)
Collecting pywin32 (from pyad)
Could not find a version that satisfies the requirement pywin32 (from pyad) (from versions: )
No matching distribution found for pywin32 (from pyad)
Folder C:\Python27\Lib\site-packages\pywin32_system32 exists, the pypiwin32 package seems to be installed.
Any ideas to fix this?
You are facing pywin32 installation problem, which is a binary wheel.
You can download binary wheels of pywin32 here. You install it with
pip install pywin32-221-cp27-cp27m-win32.whl
if it is the file you have downloaded
Select the correct version with respect to your installation (Python version and 32/64 bit Python version)
You can have detailed instructions here
pyad is declaring it needs "the pywin32 distribution package" in order to be installed. Distribution packages, i.e. something from PyPI that you can pip install, differ from Python packages, folders with an __init__.py that can be imported. The naming is confusing.
So, because it's not installed, it tries to install pywin32, but it can't find a distribution that matches your Python environment: Python 2.7 on Windows x64. On PyPI it appears like the only distributions are for Python 3.6: https://pypi.python.org/pypi/pypiwin32/220

Categories