I would like to check what version of twisted python is installed on my OS. I need to have a version 17.1.0 or greater and I work on CentOS 7.
I tried this:
(.synapse)[root#nexus-chat1 .synapse]# twisted -v
-bash: twisted : commande introuvable
But how can I upgrade my version? If I do this, will it update it?
(.synapse)[root#nexus-chat1 .synapse]# pip install twisted
Use:
pip search twisted
among the output you should see the desired information:
Twisted (17.9.0) - An asynchronous networking framework written in Python
INSTALLED: 16.3.0
LATEST: 17.9.0
update to latest available version with:
pip install --upgrade twisted
if you has installed twisted, you can write pip show twisted
(venv) ➜ testTwisted pip show twisted
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Name: Twisted
Version: 20.3.0
Summary: An asynchronous networking framework written in Python
Home-page: https://twistedmatrix.com/
Author: Twisted Matrix Laboratories
Author-email: twisted-python#twistedmatrix.com
License: MIT
Location: /home/ss/testTwisted/venv/lib/python2.7/site-packages
Requires: hyperlink, attrs, Automat, PyHamcrest, incremental, zope.interface, constantly
Required-by:
Related
I try to install tensorflow==1.1.0 for Python2.7 with pip package manager but am getting the following error when I run the command pip install tensorflow:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at pip.pypa.io/en/latest/development/release-process/… pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement tensorflow==1.1.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==1.1.0
How else can I install tensorflow for Python2.7?
Thank you!
You could use a ready to use Docker image.
https://hub.docker.com/r/tensorflow/tensorflow/tags?page=1&name=1.1.0
The tags with the postfix ”py3“ indicate using Python 3.x while the ones without this postfix are using Python 2.7.
Here some additional information about the Docker images. https://hub.docker.com/r/tensorflow/tensorflow/
Dockerfiles for TF 1.1.0 https://github.com/tensorflow/tensorflow/tree/v1.1.0/tensorflow/tools/docker
So I'm in the process of playing around with SonarCloud/SonarLint and had to set up some preliminaries - i.e. create AzureDevOps and Pipeline. This is my first time diving into Azure and I honestly don't understand how to go about fixing this error. I'm assuming I either need to create a 'requirements.txt' file or that I need to install dependencies....or both. Either way,I honestly don't know where to get started with this. Could someone please help? Below is the log I get from testing out the pipeline which is where my issue lies. Am I right in my assumption? Thanks in advance!
2020-12-20T01:30:10.5970195Z ##[section]Starting: Install dependencies
2020-12-20T01:30:10.5977975Z ==============================================================================
2020-12-20T01:30:10.5978665Z Task : Command line
2020-12-20T01:30:10.5978936Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-12-20T01:30:10.5979213Z Version : 2.178.0
2020-12-20T01:30:10.5979420Z Author : Microsoft Corporation
2020-12-20T01:30:10.5979702Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-12-20T01:30:10.5980019Z ==============================================================================
2020-12-20T01:30:11.0224446Z Generating script.
2020-12-20T01:30:11.0226001Z ========================== Starting Command Output ===========================
2020-12-20T01:30:11.0229091Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/f501a929-0e67-45b9-9e28-7047fe9295cf.sh
2020-12-20T01:30:15.1478266Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
2020-12-20T01:30:15.8292586Z Collecting pip
2020-12-20T01:30:15.8700890Z Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
2020-12-20T01:30:15.9513160Z Installing collected packages: pip
2020-12-20T01:30:15.9513725Z Attempting uninstall: pip
2020-12-20T01:30:15.9514085Z Found existing installation: pip 20.3.1
2020-12-20T01:30:16.0461039Z Uninstalling pip-20.3.1:
2020-12-20T01:30:16.0935089Z Successfully uninstalled pip-20.3.1
2020-12-20T01:30:16.9255324Z Successfully installed pip-20.3.3
2020-12-20T01:30:17.4315243Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
2020-12-20T01:30:17.5185497Z ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
2020-12-20T01:30:17.5845613Z ##[error]Bash exited with code '1'.
2020-12-20T01:30:17.5859482Z ##[section]Finishing: Install dependencies
I would highly recommend to go through the official documentation on Use CI/CD to deploy a Python web app to Azure App Service
Irrespective of Azure Devops, you need to have the dependencies define in requirements.txt and bound your dependencies to the respective environment. With Azure Devops, you need to define a task to install the dependencies from file which is defined here.
steps:
- task: UsePythonVersion#0
inputs:
versionSpec: '$(pythonVersion)'
displayName: 'Use Python $(pythonVersion)'
- script: |
python -m venv antenv
source antenv/bin/activate
python -m pip install --upgrade pip
pip install setup
pip install -r requirements.txt
workingDirectory: $(projectRoot)
displayName: "Install requirements"
```
Lately, I got this warning:
CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
Should I upgrade Gspread or Python ? Cause all code are in Python 2, it is hard to move to python 3.
I recently started to see this on macOS 10.15.7 (Catalina) when running Google Cloud tools written in Python (gcloud and gsutil). For example:
$ gsutil ls gs://<object store bucket and object path>
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography import x509
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography import x509
<expected output>
This solves it:
$ pip install cryptography==2.2.2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting cryptography==2.2.2
Using cached cryptography-2.2.2-cp27-cp27m-macosx_10_6_intel.whl (1.5 MB)
Requirement already satisfied: ipaddress; python_version < "3" in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography==2.2.2) (1.0.22)
...
Successfully installed cryptography-2.2.2
Note that it only installs it for the current user. It may or may not be safe to do this with sudo and update the system-wide copy. This was good enough for me, and lower risk.
pip install cryptography==2.2.2
Works fine with out warnings
I am using Paramiko. Any idea how I can use the Paramiko.RSAKey.from_private_key() function?
I'm interested in using a function to parse a private key and use that private key for SSHClient.
Code I wanted to run:
file = './file.pem'
mypkey = paramiko.RSAKey.from_private_key_file(file)
Result:
ImportError: The version of cryptography does not match the loaded shared object. This can happen if you have multiple copies of cryptography installed in your Python path. Please try creating a new virtual environment to resolve this issue. Loaded python version: 2.4.2, shared object version: b'2.7'
It apears to be a problem with the lib cryptography:
from cryptography.hazmat.backends.openssl.backend import backend
I have python 3.7.1
I have installed Paramiko using pip install
Here are some infromation about the version I have used for paramiko :
pip show paramiko
Name: paramiko
Version: 2.6.0
Summary: SSH2 protocol library
Home-page: https://github.com/paramiko/paramiko/
License: LGPL
Requires: pynacl, bcrypt, cryptography
Required-by: sshtunnel
Here are some infromation about the version I have used for cryptography:
pip show cryptography
Name: cryptography
Version: 2.7
Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
Home-page: https://github.com/pyca/cryptography
License: BSD or Apache License, Version 2.0
Requires: six, asn1crypto, cffi
Required-by: service-identity, pyOpenSSL, paramiko
I have unistalled cryptography and installed the same ver of the paramiko:
pip install cryptography==2.6.0
The same ERROR stays
This problem is almost always caused by having multiple copies of cryptography installed simultaneously. This can happen if you've installed cryptography both with pip and your system's package manager. Try building a new virtualenv, installing your dependencies into that, and that should resolve the issue.
I want to accelerate downloading Python packages with PyPi mirrors(our company mirror), but the pip can't select correct iPython version from mirrors. I guess the problem maybe has relation with PyPi index database. If someone know anything about that problem, welcome to tell me.
Python version:
(p2) ➜ /tmp python --version
Python 2.7.13
Here is my ~/.pip/pip.conf
[global]
index-url = http://mirrors.company.com/pypi/simple/
trusted-host=mirrors.company.com
The following error message was print when I used pip install ipython
(p2) ➜ /tmp pip install ipython
Collecting ipython
Downloading http://mirrors.aliyun.com/pypi/packages/79/63/b671fc2bf0051739e87a7478a207bbeb45cfae3c328d38ccdd063d9e0074/ipython-6.1.0.tar.gz (5.1MB)
100% |████████████████████████████████| 5.1MB 7.6MB/s
Complete output from command python setup.py egg_info:
IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Beginning with IPython 6.0, Python 3.3 and above is required.
See IPython `README.rst` file for more information:
https://github.com/ipython/ipython/blob/master/README.rst
Python sys.version_info(major=2, minor=7, micro=13, releaselevel='final', serial=0) detected.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/6c/gbrkbbzd4gvdp56x7x8s6xpw0000gn/T/pip-build-FVITyR/ipython/
Your Proxy/Mirror does not implement pep503 correctly and your pip may be is out of date (you need pip 9.0.1+). Since December 2016 PyPI has been fixed to correctly expose extra metadata telling Pip with which Python version a package is compatible (My talk at PyCon , and PyBay this year about this).
To be sure, check this page on PyPI, you can see in the source the link of IPython 6.0.0:
<a data-requires-python=">=3.3" href="../../packages/.../ipython-6.0.0.tar.gz" >ipython-6.0.0.tar.gz</a><br/>
Now check the same page on your mirror... it is missing the data-requires-python=">=3.3" field, so pip cannot know IPython 6.0 is incompatible. I would suggest to contact the people running the mirror to update it.
Also please setup your mirror to only allow https, or you will be unsure that what you are downloading has not been tampered with !