Installation¶
Stable release¶
Because nyuki relies on a number of geospatial python packages, the usual
pip
package manager does not work very well. Pip
works very well for
python-only packages, but when there are C
and C++
libraries involved,
then we rely on a more robust package manager such as conda
and the
Miniconda python distribution.
Anaconda.com, the company, provides the Miniconda
distribution for free to users.
To use nyuki, users must:
Install the
miniconda
python distribution.
2. Set the Anaconda channels from which to download nyuki and its python package dependencies.
Download and install nyuki.
Activate nyuki for usage.
We will walk the use through each of these four steps.
Step 1: Download the miniconda
python distribution.¶
The Anaconda python distribution saves data scientists a lot of time by bundling the most commonly used python package for scientific computing. Anaconda.com provides and maintains this distribution for users to download free of charge. Users on Windows, Macos, or Linux can find their appropriate installer by following the link above. Once Miniconda is installed, the user can move on to step 2. The video shows how to install Miniconda on a linux machine.
Note, nyuki
is not provided through the Python Package Index, and hence
users may not install the package using pip install nyuki.
This code will
certainly not work.
Step 2: Setting up the Anaconda channels to install nyuki
¶
Before installing nyuki
we need to tell the conda
package installer
where to look for both nyuki
and its dependencies. Anaconda Cloud
is a package repository that stores pre-built packages in the same way that
the Python Package Index (PyPI) stores most python package source files. Anaconda cloud
organizes packages by groupings known as “channels,” hence when installing
packages we generally like to specify the channel from which we are installing
the package. This point is especially true when installing geospatial packages,
because different channels may have subtly different versions of common
python packages. If users obtain packages from the wrong Anaconda channels,
then some software dependencies for nyuki` may be improperly installed and
``nyuki
will not function as expected–and understandably frustrating dilemma.
To specify the correct channel installation, we us the following code.
$ conda config --add channels conda-forge
The command will set the conda
package manager to look in the conda-forge
channel first, which is exactly what we would like. Nyuki
will also eventually
reside in the conda-forge
channel. Now we are ready for the next step.
Step 3: Creating a conda
environment and installing nyuki
¶
The Miniconda/Anaconda distribution allow users to create virtual environments
for their software project. A virtual environment creates small encapsulated
python installations that are completely independent and isolated from the main
python packages installed on the user’s computer. For example a user may create
one virtual conda
environment to test some legacy Python 2.7 code while
creating another conda
environment to develop some new Python 3.8 code. The
advantage of virtual environments is that they allow multiple versions of python
to reside on the same computer without interfering with each other.
To install nyuki
we will create our own ``conda``virtual environment. Enter
the following code at the command prompt:
$ conda create --yes -n nyuki-env python=3.7
This code will create a new conda
environment–named nyuki-env
that uses
python version 3.7. The --yes
flag just tells conda
to proceed with installing
the package instead of prompting the user to approve the installs.
Next we must activate the environment and then install the nyuki
package.
$ conda activate nyuki-env
Once we activate an environment, then all of the python commands issued will
refer to the packages in that environment–instead of referring the system
packages. The prompt itself will usually change to refer to (nyuki-env)
to remind the user that he/she is in the anaconda environment.
Next let’s install nyuki
itself with:
$ conda install -c krishnab75 nyuki
Note if the user chooses, he/she can change nyuki-env
to any python compliant name that he/she
desires. Currenty nyuki
is stored in my personal Anaconda cloud channel, but
that will soon change to conda-forge.
Congratulations, you have successfully installed the nyuki
package.
Step 4: Testing the install of nyuki
¶
To test whether nyuki
was successfully installed, the user can
check whether the help functionality work on the package.
$ nyuki --help
If the nyuki
help text fills the terminal, then the package is ready to use.
From sources¶
The sources for nyuki can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/00krishna-tools/nyuki
Or download the tarball:
$ curl -OL https://github.com/00krishna-tools/nyuki/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install