From a17615954b611e056268dcf618fb0e6f8829f2de Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Mon, 29 Aug 2022 17:49:26 +0200 Subject: [PATCH 1/3] Add how-to for OSM client installation on Windows Signed-off-by: garciadeblas --- 10-osm-client-commands-reference.md | 84 +++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/10-osm-client-commands-reference.md b/10-osm-client-commands-reference.md index 9c202fc..59768db 100644 --- a/10-osm-client-commands-reference.md +++ b/10-osm-client-commands-reference.md @@ -272,6 +272,90 @@ sudo snap install charm --classic which osm ``` +### How to install OSM Client in Windows with WSL + +OSM client can be easily installed in Windows by installing an Ubuntu distro on Linux with [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/install). + +Once WSL is installed with an Ubuntu 20.04 distro, you can install OSM following the instruccions in (#how-to-install-osm-client-in-ubuntu-2004) + +### How to install OSM Client directly in Windows with Conda and Git + +OSM can also be installed in Windows with [Miniconda](https://docs.conda.io/en/latest/miniconda.html) and [Git](https://git-scm.com/) + +You can install both programs with [Chocolatey](https://chocolatey.org/), the package manager for Windows. Open a CMD window and run the following commands: + +```cmd +choco install -y git make wget +choco install -y miniconda3 +``` + +Then, add the followig entries to the Path user environment variable in Windows to make Conda executables reachable from all terminals: + +- `C:\tools\miniconda3` +- `C:\tools\miniconda3\Scripts` +- `C:\tools\miniconda3\Library\bin` + +Open Git Bash and run the following commands to create a Conda environment with Python 3.8 and initialize all shells to work with Conda: + +```bash +conda create -n osm-env python=3.8 +conda init --all +# Logout +``` + +Add an alias for python3 to Git Bash, by adding the following entry to the file `.bashrc`: + +```bash +alias 'python3=python' +``` + +This is required because OSM client and OSM IM requires python3 interpreter to be found. + +Open Git bash again and install OSM client as follows: + +```bash +# Install conda and install some packages via conda (which will install dependent libraries) +conda activate osm-env +conda install pycurl==7.45.1 + +# Upgrade pip to the latest version (with sudo, to install it globally for all users) +python -m pip install -U pip + +# Decide which version to use (e.g., v12.0) +export OSM_CLIENT_VERSION=v12.0 + +# Clone IM repo and checkut the desired version +git clone https://osm.etsi.org/gerrit/osm/IM +git -C IM checkout ${OSM_CLIENT_VERSION} + +# Install OSM IM using pip +python -m pip install -r IM/requirements.txt +python -m pip install ./IM + +# Clone osmclient repo and checkut the desired version +git clone https://osm.etsi.org/gerrit/osm/osmclient +git -C osmclient checkout ${OSM_CLIENT_VERSION} + +# Install osmclient using pip +python -m pip install -r osmclient/requirements.txt +# Required DLLs for python-magic +python -m pip install python-magic-bin +python -m pip install ./osmclient + +# Try OSM client +python -m osmclient.scripts.osm +# Logout from Git Bash +``` + +Open Git Bash again and edit .bashrc to activate the Conda environment persistently. If desired, add an alias to osm executable: + +```bash +conda activate osm-env +alias 'osm=python -m osmclient.scripts.osm' +``` + +That will complete OSM client installation for Windows. + ## Getting help Options `-h` or `--help`can be used globally to know the global options and commands, or after a command to know the specific options and args of a command -- GitLab From c9722fbd94e78cae9309323f3b0d60440e6131da Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Tue, 30 Aug 2022 10:36:44 +0000 Subject: [PATCH 2/3] Update 10-osm-client-commands-reference.md --- 10-osm-client-commands-reference.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/10-osm-client-commands-reference.md b/10-osm-client-commands-reference.md index 59768db..1b233f0 100644 --- a/10-osm-client-commands-reference.md +++ b/10-osm-client-commands-reference.md @@ -295,6 +295,8 @@ Then, add the followig entries to the Path user environment variable in Windows - `C:\tools\miniconda3\Scripts` - `C:\tools\miniconda3\Library\bin` +Make sure that aliases for Python are disabled in Windows Configuration. Go to Settings > Apps > Apps & features, and click on "Manage app execution aliases". Then disable aliases for Python. + Open Git Bash and run the following commands to create a Conda environment with Python 3.8 and initialize all shells to work with Conda: ```bash @@ -303,15 +305,7 @@ conda init --all # Logout ``` -Add an alias for python3 to Git Bash, by adding the following entry to the file `.bashrc`: - -```bash -alias 'python3=python' -``` - -This is required because OSM client and OSM IM requires python3 interpreter to be found. - -Open Git bash again and install OSM client as follows: +Then install OSM client as follows: ```bash # Install conda and install some packages via conda (which will install dependent libraries) @@ -330,6 +324,7 @@ git -C IM checkout ${OSM_CLIENT_VERSION} # Install OSM IM using pip python -m pip install -r IM/requirements.txt +# make -C IM clean python -m pip install ./IM # Clone osmclient repo and checkut the desired version @@ -347,7 +342,7 @@ python -m osmclient.scripts.osm # Logout from Git Bash ``` -Open Git Bash again and edit .bashrc to activate the Conda environment persistently. If desired, add an alias to osm executable: +Open Git Bash again and edit `.bash_profile` to activate the Conda environment persistently. If desired, add an alias to osm executable: ```bash conda activate osm-env -- GitLab From 1193838d7d4cd7825f0b4341f58d74dbd8fd4b91 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 6 Oct 2022 08:38:13 +0000 Subject: [PATCH 3/3] Update instructions for osmclient in Windows related to Path user env variable --- 10-osm-client-commands-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10-osm-client-commands-reference.md b/10-osm-client-commands-reference.md index 1b233f0..f94cc95 100644 --- a/10-osm-client-commands-reference.md +++ b/10-osm-client-commands-reference.md @@ -289,7 +289,7 @@ choco install -y git make wget choco install -y miniconda3 ``` -Then, add the followig entries to the Path user environment variable in Windows to make Conda executables reachable from all terminals: +Then, open Windows environment variables > User environment variables, and add the following entries to the `Path` user environment variable in order to make Conda executables reachable from all terminals: - `C:\tools\miniconda3` - `C:\tools\miniconda3\Scripts` -- GitLab