How to inspect package version installed in dockerfile - docker

In my Dockerfile I run:
RUN pip install requests pandas sqlalchemy psycopg2
But how can I find the versions of these packages ? Is there some command line like :
pip list

You should always do version pinning, so specify the exact version number when you install a package (with any package manager) to have reproducable builds otherwise a package might have breaking changes and break your app on the next build.

Related

Raspberry Pi Open CV Install

I installed opencv-python and opencv-python-contrib
after i installed them I realized I wasn't supposed to
How do I uninstall it
Also, which one should I keep, to do facial recongnition with raspberry pi
Import cv2 didn't work when I tried to run a python file, I don't know why it is happening!
If you are using armbian or raspbian, you can uninstall packages with apt:
apt uninstall opencv-python opencv-python-contrib
I suggest that if you want to completely uninstall and remove configuration files use purge:
apt purge opencv-python opencv-python-contrib
and aftter that, you can uninstall packages that came with opencv:
apt autoremove --purge
If you need Extra modules: just keep opencv-python-contrib
Extra modules https://docs.opencv.org/4.x/index.html
pypi.org https://pypi.org/project/opencv-contrib-python/
Installation and Usage
If you have previous/other manually installed (= not installed via pip) version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages), remove it before installation to avoid conflicts.
Make sure that your pip version is up-to-date (19.3 is the minimum supported version): pip install --upgrade pip. Check version with pip -V. For example Linux distributions ship usually with very old pip versions which cause a lot of unexpected problems especially with the manylinux format.
Select the correct package for your environment:
There are four different packages (see options 1, 2, 3 and 4 below) and you should SELECT ONLY ONE OF THEM. Do not install multiple different packages in the same environment. There is no plugin architecture: all the packages use the same namespace (cv2). If you installed multiple different packages in the same environment, uninstall them all with pip uninstall and reinstall only one package.
a. Packages for standard desktop environments (Windows, macOS, almost any GNU/Linux distribution)
Option 1 - Main modules package: pip install opencv-python
Option 2 - Full package (contains both main modules and contrib/extra modules): pip install opencv-contrib-python (check contrib/extra modules listing from OpenCV documentation)
b. Packages for server (headless) environments (such as Docker, cloud environments etc.), no GUI library dependencies
These packages are smaller than the two other packages above because they do not contain any GUI functionality (not compiled with Qt / other GUI components). This means that the packages avoid a heavy dependency chain to X11 libraries and you will have for example smaller Docker images as a result. You should always use these packages if you do not use cv2.imshow et al. or you are using some other package (such as PyQt) than OpenCV to create your GUI.
Option 3 - Headless main modules package: pip install opencv-python-headless
Option 4 - Headless full package (contains both main modules and contrib/extra modules): pip install opencv-contrib-python-headless (check contrib/extra modules listing from OpenCV documentation)

Installing Specific Docker Version via Puppet

While deploying docker using puppet, I encounter an interesting issue.
docker installs fine if I use: version => latest
docker install fails if I use: version => '20.10.16'
My setup is as follows:
puppet master is Ubuntu 20.04.
puppet agent is Ubuntu 22.04 (on which I am trying to install docker).
I believe puppet docker module supports this setup.
The version lines I tried:
version => '20.10.16'
version => '20.10.16~3-0~ubuntu'
version => '20.10.16~3-0~ubuntu-jammy'
The error I get when I specify a specific version is as follows:
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install docker-ce=20.10.16' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
docker-ce-cli
Anyone has any idea what can be done so that it installs specific version of docker instead of the latest one?
When running apt-cache madison docker-ce it appears that the version number is 5:20.10.16~3-0~ubuntu-jammy.
Running apt install docker-ce=20.10.16~3-0~ubuntu-jammy returns the same error as yours, but apt install docker-ce=5:20.10.16~3-0~ubuntu-jammy works.
I suggest trying with the 5: in front of the version number.

Cannot import MSTL from statsmodels

I am currently trying to import MSTL from statsmodels.tsa.seasonal the module of MSTL (https://www.statsmodels.org/devel/generated/statsmodels.tsa.seasonal.MSTL.html) but it returns an ImportError. I have installed statsmodels from conda on MAC M1 2020
I just had the same issue and did some research.
It seems that MSTL is only available on the most recent version of statsmodels: version 0.14.0
If you install statsmodels using conda install -c conda-forge statsmodels,
you will get the statsmodels 0.13.2 version.
(Using a script editor, try searching for 'MSTL' through C:\Users{username}\Anaconda3\Lib\site-packages\statsmodels, or wherever statsmodels is installed on your machine, you will probably not find it)
You'll need to install the most recent version from the latest source on statsmodels's github repository:
www.statsmodels.org/dev/install.html
From the anaconda prompt:
git clone https://github.com/statsmodels/statsmodels.git
pip install git+https://github.com/statsmodels/statsmodels
You will need a C compiler and git installed
For git you can use: conda install -c anaconda git
Be careful as the installation of the newest version may interfere with your other installed python packages.
I would recommend that you use a conda virtual environment for this.

Installing Tensorflow Windows "Nightly Build" using PIP

I need to install a Tensorflow nightly build since the latest stable release has a critical issue that doesn't allow me to work that seems fixed in nightly.
I want to avoid to try to compile myself Tensorflow from source and I have found a guide about installing Nightly build using PIP
Eg this command
pip install http://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-py3-none-any.whl
was for tensorflow 0.11 nightly build for Mac
Looking at this link and link for windows nightly build:
I have tried to adjust the command to install tensorflow 1.0.1 for windows nightly in this way:
pip install http://ci.tensorflow.org/view/Nightly/job/nightly-win/TF_BUILD_CONTAINER_TYPE=CPU,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3 /lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
with no success
Could someone help me?
I downloaded the latest Nightly Build from Jenkins (https://ci.tensorflow.org/view/Nightly/job/nightly-win/DEVICE=cpu,OS=windows/121/)
I put the file in C:\tensorflow\tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
And was able to successfully install with
pip3 install C:\tensorflow\tensorflow-1.0.1-cp35-cp35m-win_a
md64.whl

bower show package dependencies tree before install

Is it possible to get a list of package dependencies (as produced by bower list) before installing the packages?
bower install does not complete successfulfy in my project as some package has a dependency to a non existing package version, therefore I would like to be able to quickly find that package that has this incorrect dependency instead of having to inspect bower.json of every package.
You could try bower-dependency-tree. npm install -g bower-dependency-tree && bower-dependency-tree name_of_the_package_you_are_interested_in should do it.
disclosure: I am the maintainer of the project.

Resources