I am trying to install package inside a docker container(python:rc-slim).
As of now I see that most recent azureml-core wheel uploaded to PyPI is:
azureml_core-1.13.0-py3-none-any.whl
but when I run pip install azureml-core==1.13.0 I get following error:
ERROR: Could not find a version that satisfies the requirement
azureml-core==1.13.0 (from versions: 0.1.50, 0.1.57, 0.1.58, 0.1.59,
0.1.65, 0.1.68, 0.1.74, 0.1.80, 1.0rc83, 1.0rc85, 1.0.2, 1.0.6, 1.0.8, 1.0.10, 1.0.15, 1.0.17, 1.0.17.1, 1.0.18, 1.0.21, 1.0.23, 1.0.30, 1.0.33, 1.0.33.1, 1.0.39, 1.0.41, 1.0.41.1, 1.0.43, 1.0.43.1, 1.0.45, 1.0.48, 1.0.53, 1.0.55, 1.0.57, 1.0.57.1, 1.0.60, 1.0.62, 1.0.62.1, 1.0.65, 1.0.65.1, 1.0.69, 1.0.72, 1.0.74, 1.0.76, 1.0.76.1, 1.0.79, 1.0.81, 1.0.81.1, 1.0.83, 1.0.85, 1.0.85.1, 1.0.85.2, 1.0.85.3, 1.0.85.4, 1.0.85.5, 1.0.85.6, 1.1.0rc0, 1.1.1rc0, 1.1.1.1rc0, 1.1.1.2rc0, 1.1.2rc0, 1.1.5, 1.1.5.1, 1.1.5.2, 1.1.5.3, 1.1.5.4, 1.1.5.5, 1.1.5.6, 1.1.5.7)
When installing packages from 'apt-get' I usually have to update the index first but I can't find a comparable command to do that with pip.
azureml-core version 1.1.5.7 supports Python 2.7 and 3.4+.
Starting from version 1.2.0 it only supports Python 3.5+.
From your list of versions I can guess you use Python 2.7 or 3.4. To use a later version of azureml-core you need a later version of Python.
Two possibilities:
the package needs you to use an underscore (since hyphens don't behave) so pip can download it: so run pip install azureml_core==1.13.0
Run with the --no-cache-dir argument, so pip install --no-cache-dir azureml_core==1.13.0. This argument forces pip to refresh it's package cache.
when trying to install python project, python setup.py install
I get the error,
error: httplib2 0.15.0 is installed but httplib2<0.10,>=0.8 is required by set(['apache-beam'])
However, looking at the pip dependencies
Imrans-MacBook-Pro:appengine imran$ pip freeze | grep httplib2
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: Could not generate requirement for distribution -ix 1.13.0 (/usr/local/lib/python2.7/site-packages): Parse error at "'-ix==1.1'": Expected W:(abcd...)
WARNING: Could not generate requirement for distribution - x (/usr/local/lib/python2.7/site-packages): Parse error at "'-===x'": Expected W:(abcd...)
google-auth-httplib2==0.0.3
httplib2==0.9.2
Could you please let me know from where it is taking the version 0.15.0, and why it is not using 0.9.2 instead ?
I installed Ansible 2.8.2 using dnf on Fedora 30. I have an Ansible plug-in that requires a library. Using pip3 install I installed the required library.
When I run ansible-playbook directly, I see a ModuleNotFoundError for that module.
But if I run python3 /usr/bin/ansible-playbook, the module is found.
How can I get Ansible as installed by dnf to see this library?
Edit: further info: as installed from dnf, the main Ansible script has a shebang for /usr/bin/python3 -s. If I remove the -s, this problem is solved.
What's the benefit that the repo maintainers were seeking in adding this -s flag?
Is there a case to be made for asking the repo maintainers to omit the flag?
How can I get pip3 to install the library I need into a directory that will be seen when the -s flag is in effect?
Edit: Here's the output of ansible --version, and thanks for asking.
ansible 2.8.2
config file = /home/jdashton/proj/ansible-ccharacter/ansible.cfg
configured module search path = ['/home/jdashton/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.7.4 (default, Jul 9 2019, 16:32:37) [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
This is different from the suggested duplicate question because that question describes a "remote" task being run on localhost, in which case Ansible uses the default "remote" python interpreter. In this question, the library is being called from a local plugin, under Ansible's own python process. The -s flag in the shebang line at the top of the /usr/bin/ansible script is preventing Ansible from seeing some local libraries.
Edit: Following the suggestion from #zigarn I tried removing the library and reinstalling it as root. This resulted in the library being reinstalled into the same directory /usr/local/lib/... as before. Is there a way to get pip3 to install into the system library?
Here are the commands I attempted:
# pip3 uninstall tenacity
Uninstalling tenacity-5.0.4:
Would remove:
/usr/local/lib/python3.7/site-packages/tenacity-5.0.4.dist-info/*
/usr/local/lib/python3.7/site-packages/tenacity/*
Proceed (y/n)? y
Successfully uninstalled tenacity-5.0.4
# pip3 install tenacity
Collecting tenacity
Using cached https://files.pythonhosted.org/packages/6a/93/dfcf5b1b46ab29196274b78dcba69fab5e54b6dc303a7eed90a79194d277/tenacity-5.0.4-py2.py3-none-any.whl
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3.7/site-packages (from tenacity) (1.12.0)
Installing collected packages: tenacity
Successfully installed tenacity-5.0.4
# pip show tenacity
Name: tenacity
Version: 5.0.4
Summary: Retry code until it succeeeds
Home-page: https://github.com/jd/tenacity
Author: Julien Danjou
Author-email: julien#danjou.info
License: Apache 2.0
Location: /usr/local/lib/python3.7/site-packages
Requires: six
Required-by:
Also, for clarity, here is the source for the Ansible installation:
# dnf list ansible
Last metadata expiration check: 0:09:48 ago on Mon 12 Aug 2019 11:12:58 AM EDT.
Installed Packages
ansible.noarch 2.8.2-1.fc30 #updates
According to the documentation -s option of python is "Don’t add the user site-packages directory to sys.path."
So I would guess that you did pip3 install as your user instead as root, so the library was installed at your user side instead of system wide.
Try to reinstall the library with pip3 as root and it should be ok.
On a production server, I am forced to use python3.2. Sadly several of my dependencies require >=python3.4.
Is there a way to find out what the latest version of a package is that can be used with a specific python version?
For instance, with python3.2, what version of numpy should be used?
(This is only an example, answers would ideally not focus on the example, but on the actual question).
Perhaps you could use environment markers to solve the problem?
These are strings that can be used in requirements.txt and setup.py files (under the install_requires argument) and look like:
numpy>=1.7,<2; python_version > '3.4'
numpy>=1.7,<1.12; python_version < '3.4'
They can help you match packages to Python versions with some flexibility.
This should work with pip>=22.2 (tested with Python 3.10.8 + pip 22.2.2) and give you the latest version of a package compatible with a given Python version:
python -m pip install numpy --dry-run --python-version 3.2 --no-deps --target foo
Output:
Collecting numpy
Downloading numpy-1.12.1.zip (4.8 MB)
---------------------------------------- 4.8/4.8 MB 3.6 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Would install numpy-1.12.1
Extracted from this answer.
You can go to individual package and check requirement. Like for Numpy you can check on github which tells Python version 2.7 or >= 3.4 required.
This question already has answers here:
Why is pip installing an old version of my package?
(15 answers)
Closed 2 years ago.
Pip installs old version of my package
$ pip install pywps
Collecting pywps
Downloading pywps-3.2.6.tar.gz (123kB)
...
If you go to https://pypi.python.org/pypi/pywps/ the version 3.2.6 is not even mentioned there.
It's only mentioned at https://pypi.python.org/simple/pywps/
Any idea, why 3.2.6 is prefered over 4.0.0?
Thanks
P.S. Older responses do not seem to apply to this case.
If you run the command with a verbose option (and an up to date pip), you can see what's happening.
pip install -v pywps
It gives the following output:
1 location(s) to search for versions of pywps:
* https://pypi.python.org/simple/pywps/
...
Skipping link https://pypi.python.org/packages/f9/93/5c2c4c95e53b6193bf239ecc49cb859fd77d181311145edd13ba4cd39e09/pywps-4.0.0-py3.5.egg#md5=338eb2e56a36abc684800961b7e4ee0a (from https://pypi.python.org/simple/pywps/); unsupported archive format: .egg
...
Found link https://pypi.python.org/packages/c8/e6/8b88bc134f714f73e296466ab6b5b5a5ad96c44d35dcbcf41ccf9b76a283/pywps-3.2.6.tar.gz#md5=32bbbefacce633baa9147c74e4416c98 (from https://pypi.python.org/simple/pywps/), version: 3.2.6
Using version 3.2.6 (newest of versions: 3.2.6)
"GET /packages/c8/e6/8b88bc134f714f73e296466ab6b5b5a5ad96c44d35dcbcf41ccf9b76a283/pywps-3.2.6.tar.gz HTTP/1.1" 200 123280
Downloading pywps-3.2.6.tar.gz (123kB)
The egg file is ignored because .egg files are not supported in pip. They were supported by easy_install. I think the best solution is to start producing wheel files, which I think for pywps can be universal. If you also want to keep supporting the easy_install command, you can upload the tar.gz file or keep producing eggs.
You can install version 4.0.0 via pip straight from github:
sudo pip install git+https://github.com/geopython/pywps.git#master#egg=pywps