Azure Devops Agent Pipeline install pip fails - python

I'm building a azure devops pipeline, to deploy an databricks notebook, however, before I get to that step I need to install a few things.
In a bash step I have the following
echo "Updating pip"
python3 -m pip install --upgrade pip
I've also tried the following
pip install --upgrade pip
Both yield the same error log that:
2020-07-07T09:19:21.9087970Z Updating pip
2020-07-07T09:19:22.8470016Z Collecting pip
2020-07-07T09:19:23.1307705Z Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
2020-07-07T09:19:23.4814923Z Installing collected packages: pip
2020-07-07T09:19:24.3589221Z Successfully installed pip-8.1.1
2020-07-07T09:19:24.5176900Z You are using pip version 8.1.1, however version 20.1.1 is available.
2020-07-07T09:19:24.5178120Z You should consider upgrading via the 'pip install --upgrade pip' command.
I'm a puzzled by the fact that the output showes that it is installing pip-8.1.1, when it is clearly downloading the newest version (20.1.1) of pip.
I'm clearly missing something.
Thanks for your time and help in advance!

I solved the issue by adding a step before the bash script to select Python
- task: UsePythonVersion#0
displayName: 'Use Python 3.8'
inputs:
versionSpec: 3.8
According to the log it is merely adding a path env variable to PATH
2020-07-07T13:02:27.1599357Z Prepending PATH environment variable with directory: /opt/hostedtoolcache/Python/3.8.3/x64
2020-07-07T13:02:27.1607326Z Prepending PATH environment variable with directory: /opt/hostedtoolcache/Python/3.8.3/x64/bin
After adding the above step I get the following log
2020-07-07T13:02:31.6513097Z Collecting pip
2020-07-07T13:02:31.7236234Z Downloading pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
2020-07-07T13:02:32.0470915Z Installing collected packages: pip
2020-07-07T13:02:32.0471385Z Attempting uninstall: pip
2020-07-07T13:02:32.0484694Z Found existing installation: pip 20.1.1
2020-07-07T13:02:32.2325914Z Uninstalling pip-20.1.1:
2020-07-07T13:02:32.2701613Z Successfully uninstalled pip-20.1.1
2020-07-07T13:02:33.4108823Z Successfully installed pip-20.1.1
This solved my problem of updating pip (though Python 3 already had the latest version), and made me able to run the next steps too.

Related

Pip hangs on installing packages

I'm using django in a virtual environment. I'm using powershell and trying to install pyopenssl.
Inside Virtual environment:
pip version = 19.2.3
python version = 3.8.3
Outside Virtual environment:
pip version = 21.2.4
python version = 3.8.3
I tried to upgrade pip inside virtual environment using python -m pip install -U pip and pip install --upgrade pip but it is hanged without producing any output here is the screenshot.
I try pip install pyopenssl:
(bookmarks) bookmarks> pip install pyopenssl
Collecting pyopenssl
Using cached https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl
Collecting six>=1.5.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting cryptography>=3.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/cc/98/8a258ab4787e6f835d350639792527d2eb7946ff9fc0caca9c3f4cf5dcfe/cryptography-3.4.8.tar.gz
Installing build dependencies ...
it hangs on Installing build dependencies .... I've waited 30mins but nothing happened.
I've also tried python -m pip install pyopenssl
(bookmarks) bookmarks> python -m pip install pyopenssl
Collecting pyopenssl
Using cached https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl
Collecting cryptography>=3.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/cc/98/8a258ab4787e6f835d350639792527d2eb7946ff9fc0caca9c3f4cf5dcfe/cryptography-3.4.8.tar.gz
Installing build dependencies ... \
And when I try pip -v install pyopenssl:
(Since the ouput is large, i'm only showing the last part.)
Added semantic-version>=2.6.0 from https://files.pythonhosted.org/packages/a5/15/00ef3b7888a10363b7c402350eda3acf395ff05bebae312d1296e528516a/semantic_version-2.8.5-py2.py3-none-any.whl#sha256=45e4b32ee9d6d70ba5f440ec8cc5221074c7f4b0e8918bdab748cc37912440a9 (from setuptools-rust>=0.11.4) to build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
Removed semantic-version>=2.6.0 from https://files.pythonhosted.org/packages/a5/15/00ef3b7888a10363b7c402350eda3acf395ff05bebae312d1296e528516a/semantic_version-2.8.5-py2.py3-none-any.whl#sha256=45e4b32ee9d6d70ba5f440ec8cc5221074c7f4b0e8918bdab748cc37912440a9 (from setuptools-rust>=0.11.4) from build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
Installing collected packages: setuptools, wheel, pycparser, cffi, toml, semantic-version, setuptools-rust
Creating C:\Users\Suhail\AppData\Local\Temp\pip-build-env-fwbrqqmx\overlay\Scripts
Successfully installed cffi-1.14.6 pycparser-2.20 semantic-version-2.8.5 setuptools-58.1.0 setuptools-rust-0.12.1 toml-0.10.2 wheel-0.37.0
Cleaning up...
Cleaned build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/pip/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 304 0
Here again i'm stuck at this output, and pyOpenSSL is not installed.
However, pip install pyopenssl worked outside of the virtual environment screenshot
I'm stuck at this freeze for 2 days.
If you know the solution then please answer it. Thankyou
Here's what worked for me
Step 1: First I uninstalled pip:
pip uninstall pip
To make sure pip is uninstalled type pip and make sure you get ModuleNotFoundError: No module named 'pip'
Step 2: Download PIP get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Step 3: Install PIP:
python get-pip.py
To make sure pip is installed run pip --version make sure it is latest, (21.2.4) as of now.
Finally I was able to install pyopenssl :))
pip install pyopenssl

How to deal with error message - Missing required dependencies ['numpy'] - using pycharm and anacoda

I'm learning python and want this code to work.
import pandas
df =pandas.DataFrame([[2,4,6],[10,20,30]])
print(df)
This is what I get:
File "C:\Users\User\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
I'm using pycharm with anaconda environment. Hopefully I've set the environment and interpreter up right. It says I have numpy version 1.16.2 installed, however it won't let me upgrade to version 1.17.0
Tried installing, uninstalling and upgrading through packages and terminal and upgraded pip. This is what I get:
Installing collected packages: numpy
Found existing installation: numpy 1.16.4
Uninstalling numpy-1.16.4:
Successfully uninstalled numpy-1.16.4
Successfully installed numpy-1.17.0
WARNING: You are using pip version 19.1.1, however version 19.2.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\User\Documents\Python>python -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl (1.4MB)
|████████████████████████████████| 1.4MB 114kB/s
Installing collected packages: pip
Found existing installation: pip 19.1.1
Uninstalling pip-19.1.1:
Successfully uninstalled pip-19.1.1
Successfully installed pip-19.2.1
I'm very new to all this and probably doing something wrong, someone please help.
enter image description here
I would advise you to try and use the Anaconda GUI Navigator, available through the standard download of Anaconda Software Bundle.
You can easily manipulate virtual environments and install/uninstall different packages, using the self-explanatory GUI. I found it very simple and a good way to start using Anaconda and Python:

Installing Tensorflow problem : pip doesn't upgraded

(tensorflow) C:\Users>python -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Could not install packages due to an EnvironmentError: [WinError 5] 액세스가 거부되었습니다: 'c:\programdata\anaconda3\lib\site-packages\pip\_internal\basecommand.py'
Consider using the --user option or check the permissions.
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I installed Anaconda3.7 and now I'm trying to install the tensorflow, but it seems the version of pip is problem.
So I typed 'python -m pip install --upgrade pip' command several times but it didn't work at all. Is there a way to install it?
I'm sorry. You messed Anaconda up with your pip install.
I had to reset my machine to factory settings, as reinstalling Anaconda gave me some conflict errors.
Once I reset my machine the command I typed was:
conda install tensorflow
you might also look into keras and theano.
Good luck buddy. You are not the only one to have done this. Anaconda is tricky like that.

Sometimes pip updates but sometimes it doesn't

I installed ActiveState Python 3.4 on a lot of servers.
To bring pip up to date, I'm running this command on each server:
"C:\Python34\python.exe" -m pip install --upgrade pip
Some of the time, it upgrades to pip version 10.0.1:
Downloading/unpacking pip from https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl#sha256=717cdffb2833be8409433a93746744b59505f42146e8d37de6c62b430e25d6d7
Installing collected packages: pip
Found existing installation: pip 1.5.6
Uninstalling pip:
Successfully uninstalled pip
Successfully installed pip
Cleaning up...
But, some of the time it doesn't upgrade at all and it keeps pip at version 1.5.6:
Requirement already up-to-date: pip in c:\python34\lib\site-packages
Cleaning up...
Why is it behaving differently on different servers? Is there a way to force the upgrade to happen?
I see what happened. On some of the servers, when I tried to update pip the first time, there was an error in the middle of the process. And the folder C:\Python34\Lib\site-packages\pip-10.0.1.dist-info was created, even though the install hadn't finished. If I remove that folder and then run the upgrade, it works fine.

Pip says old version is installed after installing new version

I uninstalled pip and reinstalled it from get-pip.py, yet it reports the wrong version.
C:\>python get-pip.py
Collecting pip
Cache entry deserialization failed, entry ignored
Using cached pip-8.1.1-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.1.1
C:\>pause
Press any key to continue . . .
PS C:\> pip --version
pip 6.0.3 from c:\python33\lib (python 3.3)
Has the correct version been installed? Every time I use pip it still tells me to upgrade.
Deleting c:\python33\lib\pip solved the issue.

Categories