Pip extra index URL not working in alpine Docker images - python

I have a Dockerfile with the following contents:
FROM python:3.9-alpine3.15
COPY my-project/ ./my-project/
COPY setup.py .
RUN pip install -e "." --extra-index-url "<extra-index-URL>"
I have hosted my-package in a private registry, but I get the following error from the pip install command:
ERROR: Could not find a version that satisfies the requirement my-package>=1.5.0 (from my-project) (from versions: 0.0.1)
ERROR: No matching distribution found for my-package>=1.5.0
Version 0.0.1 is published to the official PyPI index, whereas higher versions are published to the private registry. The command succeeds locally on my Mac, as well as when I use the python:3.9-bullseye Docker image, so there's no issue with the registry itself. Apparently there is something preventing alpine to correctly use the private registry.
Since I want a more lightweight image, is there a way to make the command work with alpine?
Tried with Docker versions 20.10.11 on Mac and 20.10.17 on Ubuntu 20.04.

Related

Onnxruntime extensions are not installing on Arm Based Processor

Error when installing onnxruntime-extensions
I also tried different versions but everytime got same error
error: could not find a version that satisfies the requirement onnxruntime-extensions (from versions: none)
error: no matching distribution found for onnxruntime-extensions
server spec:
Architecture
64-bit (Arm) # Arm Based processor used in aws ec2 instance
CPU:
Core 16 and 1 thread per core
my enviroment:
python version 3.9
pip install onnxruntime-extensions # but got above error
#===============================================================
#Again deleted enviroment and created new enviroment with
python version 3.7
tried to install pip install onnxruntime-extensions # but same error arise
Any help would be appreciated thanks please don't ignore
it has been mentioned on the official GitHub page
NOTE: most ONNXRuntime-Extensions packages are in active development and most packages require building from source. The package information will be updated here if it is published.
So if you`re working on Windows, try
pip install --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/ onnxruntime-extensions
Or on Linux
python -m pip install git+https://github.com/microsoft/onnxruntime-extensions.git
Good Luck.

spaCy and Docker: can't "dockerize" Flask app that uses spaCy modules

I'm trying to install SpaCy on my docker image but it always fails. First it was on my requirements.txt file, but it failed right away. Later on I tried running a separate RUN instruction for pip to install it in isolation but it also failed.
Here's my Dockerfile content:
FROM python:3.6-alpine
WORKDIR /sentenceSimilarity
ADD . /sentenceSimilarity
RUN pip install -r requirements.txt
RUN pip install -U pip setuptools wheel
RUN pip install -U spacy
RUN python -m spacy download en_core_web_sm
CMD ["python", "app.py"]
I ended up deleting everything from my requirements.txt file except for Flask and the issue is always stumbled upon the line in which Spacy comes, the only difference now is that it takes a huge time to fail. See screenshot:
Observing a bit, I think pip has been iterating to check which version might suit, from newest to oldest. But none of those at the end gets installed.
I've seen others with similar issues with SpaCy, but no apparent solution.
Can someone suggest an approach I could use to fix this? Thanks in advance.
The spacy installation extremely slow in docker Github issue explains the problem with the Alpine Python docker (I see you have FROM python:3.6-alpine in your dockerfile):
If you're using an Alpine Linux container, you should probably not: it's a bad choice for Python because none of the PyPi wheels will work, so you'll have to rebuild everything. If you're determined to use Alpine Linux you should host yourself a wheelhouse so that you don't have to rebuild the wheels all the time.
So, you need to use another image, e.g. a slim docker image, as recommended by #mkkeffeler.

Meeting a pip requirement using an alternative module

I'm trying to install a python module, 'pyAudioProcessing' (https://github.com/jsingh811/pyAudioProcessing) on my Linux Mint distribution, and one of the items in requirements.txt is causing issues: python-magic-bin==0.4.14. When I run pip3 install -e pyAudioInstaller, I get an error:
ERROR: Could not find a version that satisfies the requirement python-magic-bin==0.4.14 (from pyAudioProcessing==1.1.5) (from versions: none)
ERROR: No matching distribution found for python-magic-bin==0.4.14 (from pyAudioProcessing==1.1.5)
The same error appears if I try to manually install the module using pip3 install python-magic-bin. The module installs without issues on my windows machine.
pypi.org lets me download files for it manually, however only Windows and MacOS .whl files are available. I tried simply removing the requirement from the list, but that resulted in a large number of other errors to appear, so I assume the module is legitimately required.
Thee is another module called python-magic-debian-bin that I can download. Is there a simple way to convince pyAudioInstaller to use this other module instead of the original? Like can I somehow rename python-magic-debian-bin to python-magic-bin and hope it works out?
python-magic-bin 0.4.14 provides wheels for OSX, w32 and w64, but not for Linux. And there is no source code at PyPI.
You need to install it from github:
pip install git+https://github.com/julian-r/python-magic.git
As for pyAudioProcessing I can see 2 ways to install it:
Clone the repository and edit requirements/requirements.txt, replace python-magic-bin==0.4.14 with pip install git+https://github.com/julian-r/python-magic.git#egg=python-magic;
Install requirements manually and then install pyAudioProcessing without dependencies:
pip install --no-deps pyAudioProcessing
or
pip install --no-deps git+https://github.com/jsingh811/pyAudioProcessing.git
The library has updated the requirements very recently for it to work on Linux.
pip install -U pyAudioProcessing
Should get it all set up for you.
Alternatively, https://github.com/jsingh811/pyAudioProcessing the readme describes other getting started methods as well.

Unable to install tensorflow-compression

I get this error every time I try to install tensorflow-compression
ERROR: Could not find a version that satisfies the requirement tensorflow-compression (from versions: none)
ERROR: No matching distribution found for tensorflow-compression
I'm using python 3.6.8 and tensorflow-gpu 1.14.0.
This package does exist and was recently updated:
https://pypi.org/project/tensorflow-compression/
I've tried to install it in a python 2.7 environment, but it didn't work.
Also tried to specify the latest version pip install tensorflow-compression==1.2, but it also didn't work.
At the time of writing this, prebuilt wheels of tensorflow-compression exist only for Linux/MacOS. Quoting the readme:
Installation
Note: Precompiled packages are currently only provided for Linux (Python 2.7, 3.3-3.7) and Darwin/Mac OS (Python 2.7, 3.7).
To use these packages on Windows, consider using a TensorFlow Docker image and installing tensorflow-compression using pip inside the Docker container.
Windows is currently not supported. Please use one of TensorFlow's Docker images (https://www.tensorflow.org/install/docker) and pip install tensorflow_compression there.

Why upload module in repository not found via pip install?

I upload module
example-framework.python.egg
via Jenkins in JFrog Artifactory.
Upload completed good without errors.
I checked in Artifactory, in repository browser saw in properties
pypi.name - example-framework
Tried to install module via artifactory.
pip install example-framework
pip returned error:
Collecting example-framework
Could not find a version that satisfies the requirement example-framework (from versions: )
No matching distribution found for example-framework
How solve this problem?
For the user running pip, make sure you have correctly setup your ~/.pip/pip.conf file to point to Artifactory. You can see an example of this in the Set Me Up box for the pipy repo.

Categories

Resources