Anaconda Environment Installing Packages Numpy-Base - numpy

After having installed a few packages and the TensorFlow package updates with conda install, when running the command conda list I see that have two numpy packages:
numpy-base
numpy
numpy 1.14.3 py35h9bb19eb_2
numpy-base 1.14.3 py35h7ef55bc_1
Questions:
Why do I have two numpy versions?
which one is being used and why got numpy-base package even installed?

numpy, here, is an example of a metapackage, while numpy-base is the original numpy library package.
When a conda package is used for metadata alone and does not contain any files, it is referred to as a metapackage. The metapackage may contain dependencies to several core, low-level libraries and can contain links to software files that are automatically downloaded when executed. Metapackages are used to capture metadata and make complicated package specifications simpler.
The structure of a conda package is as follows, a metapackage only contains the info folder.
.
├── bin
│ └── f2py
├── info
│ ├── LICENSE.txt
│ ├── files
│ ├── index.json
│ ├── paths.json
│ └── recipe
└── lib
└── python3.x
If you look at meta.yaml file of numpy, it, in fact, has a comment saying
numpy is a metapackage that may include mkl_fft and mkl_random both of which require numpy-base to build.
Read more about conda packages.

Related

serverless framework with multiple requirements.txt files

I have a python project with structure as below:
/project/
/function-group-1/
lambda-A.py
requirements.txt
/function-group-2/
lambda-B.py
lambda-C.py
requirements.txt
Can you have some ways to install packages from requirements.txt, then packaging it as separated layers? I used serverless-python-requirements plugin, but maybe it not help to create multiple layers with multiple requirements.txt files

Failed to install Numpy 1.20.2 with Poetry on Python 3.9

When I try to install Numpy 1.20.2 module with Python Poetry 1.1.4 package manager (poetry add numpy) in a Python 3.9.0 virtual environment, I get:
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
I read a few threads like this one, but since then it seems the latest Numpy versions are supposed to be able to be built with 3.9 (see this official Numpy release doc, and this answer).
Did I miss something?
EDIT: using pip 21.0.1 (latest)

uninstall postgresql-10 in kali linux

Im have problem postgresql-10 in kali linux
│
│ The PostgreSQL version 10 is obsolete, but the server or client packages
│ are still installed. Please install the latest packages (postgresql-11
│ and postgresql-client-11) and upgrade the existing clusters with
│ pg_upgradecluster (see manpage).
│
│ Please be aware that the installation of postgresql-11 will
│ automatically create a default cluster 11/main. If you want to upgrade
│ the 10/main cluster, you need to remove the already existing 11 cluster
│ (pg_dropcluster --stop 11 main, see manpage for details).
│
│ The old server and client packages are no longer supported. After the
│ existing clusters are upgraded, the postgresql-10 and postgresql-client-10 packages should be removed.
│
│ Please see /usr/share/doc/postgresql-common/README.Debian.gz for
│ details.
How to fix it?
Capture screenshoot: https://imgur.com/Xq0mztb
You can apt-get remove postgresql-10 and postgresql-client-10, making the warning go away. You should first install the postgresql-11 packages and migrate your databases if you use any.
You can install the postgresql-11 using apt-get install.
Migrating the db could be done by following the instructions here:
https://www.postgresql.org/docs/10/upgrading.html
so that program works better if you update your kali linux first before installation.
sudo su
apt-get update
that trick always works in my case

Difference between MKL numpy from Conda and Gohlke's distributions

I've setup a conda environment and used conda install numpy. This includes the mkl package, which is quite large, 100s of MBs. Conda installs these into Library/bin in the environment when on Windows. In another conda environment I installed numpy+mkl from Christoph Gohlke's binaries. What's the difference between these two numpy builds that are both linked against MKL? Is there a preferred version to use?
The install from Christoph's binaries don't put all the mkl_* DLLs in Library/bin. Christoph's website says all the MKL libraries are included in the numpy.core folder after the pip install. I checked and there are a few DLL files in there, but none with the mkl_* prefix.
The conda version ends up using 100s of MBs more than the other install so I'm curious what benefits there are to using the Conda version.

Cython, remove numpy dependency in setup.py

In order to build a Cython extension using numpy, one has to add numpy.get_include() in "setup.py":
from setuptools import setup, Extension
setup(
...
include_dirs = [numpy.get_include()]
)
Otherwise, one gets this error:
fatal error: numpy/arrayobject.h: No such file or directory
even if one builds the Extension directly from the precompiled .c file.
The obvious solution is to install numpy beforehand.
But setup.py install to install a package is the usual way to install all the package dependencies (including numpy). Is there any way to get rid of the dependency to numpy when distributing the package, i.e. so that people don't have to install numpy before running setup.py install ?
I was thinking about including the numpy .h files into the distribution, but I am afraid of version clashes with an existing numpy version of the user.
Maybe try to import, and if I get an ImportError, include the packaged .h files? Any standard/simpler way?
Edit: or is there any way to force the installation of numpy before setup() runs?
It may be ugly but I did this to force the install/upgrade:
from pkg_resources import parse_version
## Install numpy if it is not found or too old
try:
import numpy
if parse_version(numpy.__version__) < parse_version('1.10'):
print("numpy {} was found but is too old. Upgrading.".format(numpy.__version__))
raise ImportError
print("Numpy was found. Build extensions.")
except ImportError:
print("Building Cython extensions requires numpy. Installing numpy.")
import pip
pip_args = ['install', numpy_req]
pip.main(pip_args)
import numpy