Installation#
Note
If you’re familiar with the python ecosystem that’s all you need.
$> pip install luxos
These are detailed end-to-end instructions how to:
install a python interpreter (usually done once per python release, eg. 3.10.1, 3.12.1 etc.)
create as many virtual environment venv needed (this is done once per new environment)
install luxos package in a venv
Install a python interpreter#
This step is done usually once per new python release, and it can be done by an administrator (in which case the install might be read-only to the user).
Head to python and download the most recent installer following the on-screen instructions.
MacOS comes pre-installed with python (3.9 under /usr/bin/python), which is supported.. just.
You’d better off installing an updated version from python, and follow the instructions.
Brew is a very popular tool to install packages, including python. Once brew is setup (please follow the instructions on their website), it should be possible to install python just typing:
brew install python
You can use the distro package manager to install your python interpter, something like:
$> yum install python
(or)
$> zypper install python
(or)
$> apt install python
Conda is a multiplatform package manager, like brew but supporting environments.
You might consider using conda for an advanced way to maintain python stacks, see details here.
It allows to use pip to install packages in an environment, as well the conda install command.
It has support for cross toolchains as well.
Once you have your system wide python installed, you can work creating a virtual env.
Hint
No matter how you installed your main python interpreter, just make sure you’re installing python3.x and not python2.x, this command should show something reasonable:
$> python3 --version
Python 3.12.3
Virtual environments#
A virtual environment is a filesystem directory holding executable, libraries and all sort of ancillary files (”data”): it is initially created using the python interpreter itself, activated using an activate script (that sets the PATH to the directory) and files are installed using a package manager that installs a package.
In case of python:
a package manager could be
pip
orconda
a package can be a python wheel
.whl
file or a conda file (.conda
)
In general you can have multiple virtual environments with different installed packages like an environment to run tests, another to create documentation and so on.
The lifecycle of a virtual environment is pretty simple once a python interpreter is installed:
create a new environment in a directory (this is usually done once per environment)
activate the newly create environmen (this step is needed every time you start a new shell process)
install/remove packages using the package manager
Create a new environment#
This will create a new environment under venv under the current directory
This will create a new venv directory in the current working dir:
$> python3 -m venv $(pwd)/venv
This will create a new venv directory in the current working dir:
$> python3 -m venv %CD%\venv
Activate the environment#
Once the environment has been created, every time a new shell is started, some configuration has
to be done in order to set the correct environmnetal variables as PATH
.
This configuration is called activate the environment.
$> source $(pwd)/venv/bin/activate
$> %CD%\venv\Scripts\activate.bat
Uisng the newly creating environemn#
Once activate an environment you can use the packages manager to install/uninstall/update
the packages in such environment: changes will happen only in the environment directory (in our case
$(pwd)/venv
or %CD%\venv
).
to list currently installed packages
pip list
to install a package
pip install luxos
to upgrade a package
pip install --upgrade luxos
to remove a package
pip uninstall luxos