Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update guide for SCANOSS install on Ubuntu 24 #595

Closed
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion doc/quick-start-guide-and-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ You can now create a new pull request or update an existing one with commits. _L

Before building _LPVS_ from source code, ensure that you have the following prerequisites installed:

- SCANOSS Python package by following the [guidelines](https://github.com/scanoss/scanoss.py#installation). Install it using the command:
- SCANOSS Python package by following the [guidelines](https://github.com/scanoss/scanoss.py#installation).

For installing SCANOSS on Ubuntu 2023.04, Fedora 38, Debian 11, etc. or later versions of mentioned OSes please follow the note at the end of the paragraph otherwise install it using the command:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use such abbreviations.

Copy link
Collaborator Author

@o-konoval o-konoval Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clarify -is it related to names of OSes? I do not know how to inform an user if needed special steps if no information of OS name and version.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mention the abbreviation OS here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for comment. Is there a variant? And how to inform user that needed to use pipx instead pip if no OS reference? May be Python version? But on scanoss guide they referenced to name of OSes and versions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is the following.

Could you try to install ScanOSS using such a command? In case of failure, please refer to the official documentation of ScanOSS.

```bash
pip3 install scanoss
```
Expand All @@ -145,6 +147,29 @@ Before building _LPVS_ from source code, ensure that you have the following prer
sudo apt install mysql-server
```


> [!NOTE]
> For installing SCANOSS on Ubuntu 2023.04, Fedora 38, Debian 11, etc. or later versions of mentioned OSes, a few additional steps are required, as previously mentioned command : `pip3 install scanoss` will not work correctly. [More details](https://github.com/scanoss/scanoss.py/blob/main/PACKAGE.md#externally-managed-environments-on-linux)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


Installation steps:
- Install `pipx`:
```bash
sudo apt install pipx
```
- Install `scanoss` by using `pipx`:
```bash
pipx install scanoss
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use --require-hashes -r requirements.txt here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately pipx does not support such syntax. Need additionally check how to use pipx with specified requirements defined in file.

qa@qa-VirtualBox:~/Downloads/LPVS$ pipx install -help
usage: pipx install [-h] [--quiet] [--verbose] [--include-deps] [--force]
[--suffix SUFFIX] [--python PYTHON]
[--preinstall PREINSTALL] [--system-site-packages]
[--index-url INDEX_URL] [--editable] [--pip-args PIP_ARGS]
[package_spec ...]

The install command is the preferred way to globally install apps
from python packages on your system. It creates an isolated virtual
environment for the package, then ensures the package's apps are
accessible on your $PATH. The package's manual pages installed in
share/man/man[1-9] can be viewed with man on an operating system where
it is available and the path in the environment variable PIPX_MAN_DIR
(default: /home/qa/.local/share/man) is in the man search path
($MANPATH).

The result: apps you can run from anywhere, located in packages
you can cleanly upgrade or uninstall. Guaranteed to not have
dependency version conflicts or interfere with your OS's python
packages. 'sudo' is not required to do this.

pipx install PACKAGE_NAME ...
pipx install --python PYTHON PACKAGE_NAME
pipx install VCS_URL
pipx install ./LOCAL_PATH
pipx install ZIP_FILE
pipx install TAR_GZ_FILE

The PACKAGE_SPEC argument is passed directly to pip install.

The default virtual environment location is /home/qa/.local/share/pipx
and can be overridden by setting the environment variable PIPX_HOME
(Virtual Environments will be installed to $PIPX_HOME/venvs).

The default app location is /home/qa/.local/bin and can be
overridden by setting the environment variable PIPX_BIN_DIR.

The default manual pages location is /home/qa/.local/share/man and
can be overridden by setting the environment variable PIPX_MAN_DIR.

The default python executable used to install a package is
/usr/bin/python3 and can be overridden
by setting the environment variable PIPX_DEFAULT_PYTHON.

positional arguments:
package_spec package name(s) or pip installation spec(s)

options:
-h, --help show this help message and exit
--quiet, -q Give less output. May be used multiple times
corresponding to the WARNING, ERROR, and CRITICAL
logging levels.
--verbose, -v Give more output.
--include-deps Include apps of dependent packages
--force, -f Modify existing virtual environment and files in
PIPX_BIN_DIR and PIPX_MAN_DIR
--suffix SUFFIX Optional suffix for virtual environment and executable
names. NOTE: The suffix feature is experimental and
subject to change.
--python PYTHON Python to install with. Possible values can be the
executable name (python3.11), the version to pass to
py launcher (3.11), or the full path to the
executable.Requires Python 3.8 or above.
--preinstall PREINSTALL
Optional packages to be installed into the Virtual
Environment before installing the main package.
--system-site-packages
Give the virtual environment access to the system
site-packages dir.
--index-url INDEX_URL, -i INDEX_URL
Base URL of Python Package Index
--editable, -e Install a project in editable mode
--pip-args PIP_ARGS Arbitrary pip arguments to pass directly to pip
install/upgrade commands

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please find the solution first. This is a known issue. Please refer to pypa/pipx#359

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems pipx still does not have official solution for installing from a requirement file.

As confirmation of it-
recently opened PR and issue for: Preinstall from requirements file
pypa/pipx#1536
pypa/pipx#1525

If this PR will be merged seems will be standard possibility to use requirement file as syntax is:
pipx install -v --preinstall-from-file /tmp/httpx-req.txt --preinstall-from-file /tmp/attrs-req.txt dunk (it taken from the PR)

Another way by using additional packet:
pipx install cookiecutter
pipx runpip cookicutter install -r requirements.txt
But I can not run it as some downloaded packets have other hashes than in the file of requirements.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Will be added to the guide after pipx feature official release.

```
- Add to `PATH` `scanoss` installation:
```bash
pipx ensurepath
```
- Close the terminal, open new terminal and check if the command below is available from any location:
```bash
scanoss-py
```


### 2. Create Necessary MySQL Database and User (optional if not using a database)

2.1 Start the MySQL server:
Expand Down
Loading