Install IPython from PyPi mirrors with pip - python

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 !

Related

How to install Tensorflow==1.X.X for Python2.7 on Ubuntu?

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

Do I need a 'requirements.txt' file or should I install dependencies? Azure DevOps

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"
```

CryptographyDeprecationWarning with python 2

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

which version of package do I need to not upgrade django

I was asked to fix an old installation of a Django App
I was going through the package dependencies and saw that during a server change they probably lost some python modules:
Installed is:
Python 2.7.5 and Django (1.8)
pip 8.1.2
edit: django-mptt 0.9.1
I need to install django-mptt-admin
but I get this error when doing pip install django-mptt-admin:
...
Collecting Django>=1.11 (from django-mptt->django-mptt-admin==0.5.8)
Using cached https://files.pythonhosted.org/packages/7e/ae/29c28f6afddae0e305326078f31372f03d7f2e6d6210c9963843196ce67e/Django-2.1.7.tar.gz
Complete output from command python setup.py egg_info:
==========================
Unsupported Python version
==========================
This version of Django requires Python 3.5, but you're trying to
install it on Python 2.7.
This may be because you are using a version of pip that doesn't
understand the python_requires classifier. Make sure you
have pip >= 9.0 and setuptools >= 24.2, then try again:
the question is now:
How can I find the right version of django-mptt-admin and save myself the problem of upragding all python, django and their dependencies?
Its a non documented app which probably has some more problems in it
In tried
pip install django-mptt-admin==0.2.1 (from 0.5.8 down to 0.2.1) but always with the same error.
I think you install django-mptt as dependency for django-mptt-admin. And there in dependencies is Django>=1.11. You must fix version of django-mptt-admin and django-mptt for both.
Why don't you check the release history?
https://pypi.org/project/django-mptt-admin/#history

Python pip argparse upgrade

I have been attempting to upgrade argparse on Ubuntu 16.04 to the latest version, but pip keeps saying that it is part of the standard library.
How can this package be upgraded?
$ sudo pip install argparse --upgrade
Collecting argparse
Using cached argparse-1.4.0-py2.py3-none-any.whl
Installing collected packages: argparse
Found existing installation: argparse 1.2.1
Not uninstalling argparse at /usr/lib/python2.7, as it is in the standard library.
Successfully installed argparse-1.2.1
Thanks.
Argparse is maintained as a separate package here: https://pypi.python.org/pypi/argparse
Which is where pip is going to collect it.
But
As of Python >= 2.7 and >= 3.2, the argparse module is maintained
within the Python standard library. For users who still need to
support Python < 2.7 or < 3.2, it is also provided as a separate
package....
So, you are getting the error because it is part of the standard library, but also available to install via pip if you are using a version of Python for which it isn't.
If you really need to install 1.4.0 try this: (worked for me on my Windows 2.7.11 install)
Download the gzip file, not the wheel, from the pypi downloads page
Uncompress the archive and open a terminal in the argparse-1.4.01 folder
Run python setup.py install (See the 'Install' section of first link)
And check you now have the correct version (hopefully):
>>> import argparse
>>> argparse.__version__
'1.4.0'
Note:
This still leaves the original argparse.py (in ...Python27\Lib for me) intact, and places the 1.4.0 egg in site-packages, with an easy-install.pth file which I presume ensures that this version gets used in preference to the standard library one.

Categories