11Comprehensive Installation
22==========================
33
4- The fastest way to install Scancode-Toolkit is by using ``pip ``. You can also install
5- ScanCode-Toolkit by compiling it from source or by Downloading and Configuring the
6- latest release from GitHub.
4+ There are 3 main ways you can install ScanCode.
75
8- - :ref: `pip_install `
9- - :ref: `latest_release_download_install `
10- - :ref: `source_configure_install `
6+ - :ref: `app_install `
117
12- .. NOTE ::
8+ The recommended method for installing ScanCode is Downloading the latest release, as an
9+ application and then configure and use directly. This is easy because no knowledge of pip/git
10+ or other developer tools is necessary.
1311
14- After `` pip install ``, you can perform a scan using only::
12+ - :ref: ` pip_install `
1513
16- scancode [OPTIONS] <OUTPUT FORMAT OPTION(s)> <SCAN INPUT>
14+ The fastest way to install ScanCode as a python package, using ``pip ``. You can also install
15+ ScanCode by compiling it from source or by Downloading and Configuring the
16+ latest release from GitHub.
1717
18- This is unlike other install methods where path to scancode is provided by using
19- ``path/to/scancode ``, or by using ``./scancode `` inside the Scancode install directory.
18+ - :ref: `source_code_install `
2019
21- ---
20+ You can download/clone the source code repository via git/GitHub and then run a configure script
21+ to install ScanCode.
22+
23+ ----
2224
2325Before Installing
2426-----------------
2527
2628ScanCode requires either Python 3.6.x or Python 2.7.x and is tested on Linux, Mac, and Windows.
27- Make sure Python 2.7 or Python 3.6 is installed first.
29+ Make sure Python 3.6 or Python 2.7 is installed first.
2830
2931System Requirements
3032^^^^^^^^^^^^^^^^^^^
@@ -44,86 +46,82 @@ System Requirements
4446Prerequisites
4547^^^^^^^^^^^^^
4648
47- ScanCode needs a Python 3.6 or a Python 2.7 interpreter.
49+ ScanCode needs a Python 3.6 (* highly recommended *) or a Python 2.7 interpreter.
4850
4951.. Note ::
5052
51- ScanCode currently doesn't support Python 3.7.x, though support will be added soon.
53+ ScanCode currently doesn't support Python 3.7.x or 3.8.x , though support will be added soon.
5254
53- - On Linux: Use your package manager to install ``python2.7 `` or ``python3.6 ``. If they are not
54- available from your package manager, you must compile it from sources. For instance, visit
55- https://github.com/dejacode/about-code-tool/wiki/BuildingPython27OnCentos6 for instructions
56- to compile Python 2.7 from sources on Centos.
55+ - **On Linux **:
5756
58- - On Ubuntu 12.04, 14.04 and 16.04, you will need to install these packages first:
59- ``python-dev bzip2 xz-utils zlib1g libxml2-dev libxslt1-dev ``
57+ Use your package manager to install ``python3.6 `` (*Recommended *) or ``python2.7 ``.
6058
61- - On Debian and Debian-based distros you will need to install these packages first:
62- ``python-dev libbz2-1.0 xz-utils zlib1g libxml2-dev libxslt1-dev ``
59+ For ubuntu, it is ``sudo apt install python3.6-dev ``
6360
64- - On RPM-based distros, you will need to install these packages first :
65- `` python-devel zlib bzip2-libs xz-libs libxml2-devel libxslt-devel ``
61+ - On Ubuntu 14, 16 and 18, run :
62+ `` sudo apt install python3.6-dev bzip2 xz-utils zlib1g libxml2-dev libxslt1-dev ``
6663
67- - **On Windows **:
64+ - On Debian and Debian-based distros run:
65+ ``sudo apt-get install python3.6-dev libbz2-1.0 xz-utils zlib1g libxml2-dev libxslt1-dev ``
6866
69- Use the Python 2.7 32-bit (e.g. The Windows x86 MSI installer) for X86 regardless of whether
70- you run Windows on 32-bit or 64-bit. DO NOT USE Python X86_64 installer even if you run 64 bit
71- Windows. Download Python from this url:
72- https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi
67+ - On RPM-based distros run:
68+ ``sudo yum install python3.6-devel zlib bzip2-libs xz-libs libxml2-devel libxslt-devel ``
7369
74- Install Python on the c: drive and use all default installer options (scancode will try to find
75- python just in c:\p ython27\p ython.exe). See the Windows installation section for more
76- installation details.
70+ - On Fedora 22 and later run:
71+ ``sudo dnf install python3.6-devel xz-libs zlib libxml2-devel libxslt-devel bzip2-libs ``
7772
78- .. Note ::
79-
80- 64-bit Python interpreters (x86) are currently not supported by Scancode for Python 2.7 in
81- Windows. Use 32-bit Python isntead, even with 64-bit Windows.
73+ If they are not available from your package manager, you must compile it from sources.
74+ For instance, visit this `wiki <https://github.com/dejacode/about-code-tool/wiki/BuildingPython27OnCentos6 >`_
75+ for instructions to compile Python 2.7 from sources on Centos.
8276
83- - On Mac: Download and install Python from this url:
84- https://www.python.org/ftp/python/2.7.13/python-2.7.13-macosx10.6.pkg
85-
86- .. WARNING ::
77+ To install Python 2.7 instead, replace ``python3.6-dev `` with ``python-dev `` (or ``devel ``)
78+ according to your specific platform.
8779
88- Do not use Unicode, non-ASCII in your installation Path if you are using a Python 2.7 interpreter.
80+ - ** On Mac **:
8981
90- ---
82+ Download and install Python from this url:
9183
92- .. _pip_install :
84+ - Python 3.6.8 (*recommended *): https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.6.pkg
85+ - Python 2.7.17 : https://www.python.org/ftp/python/2.7.17/python-2.7.17-macosx10.6.pkg
9386
94- Installation by ``pip ``
95- -----------------------
87+ - **On Windows **:
9688
97- Scancode Toolkit can be easily installed using `` pip ``. The steps are :
89+ Download and install Python from this url :
9890
99- #. Create a Python 2.7 or Python 3.6 Virtual Environment::
91+ - Python 3.6.8 (* recommended *): https://www.python.org/ftp/python/3.6.8/python-3.6.8.exe
10092
101- virtualenv -p /usr/bin/python3.6 venv-scancode
93+ Add python to PATH, as ScanCode uses the python from PATH. The last Python you install
94+ registers itself in the environment is the default, if you select the "Add to PATH" option
95+ while installing.
10296
103- #. Activate the Virtual Environment you just created::
97+ - Python 2.7.17 : https://www.python.org/ftp/python/2.7.17/python-2.7.17.msi
10498
105- source venv-scancode/bin/activate
99+ Install Python on the c: drive and use all default installer options (ScanCode will try to
100+ find python just in c:python27python.exe).
106101
107- #. Run `` pip install scancode-toolkit `` to Install Scancode.
102+ .. Note ::
108103
109- .. NOTE ::
104+ 64-bit Python interpreters (x86-64) are currently not supported by Scancode for Python 3.6/2.7
105+ in Windows. Use 32-bit Python instead, even with 64-bit Windows. For Python 2.7, use the
106+ 32 bit MSI installer linked above.
110107
111- If you use Python 2.7, scancode-toolkit Version 3.0.2 is installed by default. For Python 3
112- the latest version of Scancode Toolkit is installed by default.
108+ See the :ref: `windows_app_install ` section for more installation details.
113109
114110.. WARNING ::
115111
116- Requesting a specific version through ``pip install `` for Python 3 will give Errors if the
117- Version isn't 3.1.x or later.
112+ Do not use Unicode, non-ASCII in your installation Path if you are using a Python 2.7 interpreter.
113+
114+ .. Note ::
118115
119- To uninstall, run ``pip uninstall scancode-toolkit ``.
116+ ScanCode comes with packaged with all dependencies, and so apart from downloading it as an
117+ application, only Python has to be downloaded and installed separately.
120118
121- ---
119+ ----
122120
123- .. _ latest_release_download_install :
121+ .. _ app_install :
124122
125- Download and Configure latest Release
126- -------------------------------------
123+ Installation as an Application: Downloading Releases
124+ ----------------------------------------------------
127125
128126Installation on Linux and Mac
129127^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -143,7 +141,7 @@ For ``.tar.bz2`` archive::
143141
144142 tar -xvf scancode-toolkit-3.1.1.tar.bz2
145143
146- Or Right Click and select "Extract Here".
144+ Or, Right Click and select "Extract Here".
147145
148146Check whether the :ref: `install_prerequisites ` are installed. Open a terminal in the extracted
149147directory and run::
@@ -152,6 +150,8 @@ directory and run::
152150
153151This will configure ScanCode and display the command line :ref: `cli_help_text `.
154152
153+ .. _windows_app_install :
154+
155155Installation on Windows
156156^^^^^^^^^^^^^^^^^^^^^^^
157157
@@ -191,12 +191,10 @@ Installation on Windows
191191
192192- A new 'cmd.exe' window ('Command Prompt' on Windows 10) pops up.
193193
194- - In this window (aka a 'command prompt'), type the following (i.e., 'cd' followed by a space)::
195-
196- cd
194+ - In this window (aka a 'command prompt'), type 'cd' followed by a space and then Right-click in
195+ this window and select Paste. This will paste the path where you extracted ScanCode::
197196
198- - Right-click in this window and select Paste.
199- This will paste the path where you extracted ScanCode.
197+ cd path/to/extracted_ScanCode
200198
201199- Press Enter.
202200
@@ -209,35 +207,87 @@ Installation on Windows
209207
210208- Press enter. This will configure your ScanCode installation.
211209
212- - Several messages are displayed followed by the scancode command help.
210+ - Several messages are displayed followed by the ScanCode command help.
213211
214212- The installation is complete.
215213
214+ This uses the default Python present in the PATH environment variable i.e. the last Python
215+ installed registers itself in the environment is the default. You can also use the ``configure ``
216+ script to explicitly provide the Python path to ScanCode.
217+
218+ - Follow the Instructions above till changing the current location of your command prompt to the
219+ root directory where ScanCode is installed.
220+
221+ - Run this command with the path to Python Executable::
222+
223+ configure --python path/to/python
224+
225+ - You can also use ``path `` instead of ``path/to/python `` to use the python from PATH environment
226+ variable. More information is available at the `configure <https://github.com/nexB/scancode-toolkit/blob/develop/configure.bat >`_ script (L6-L15).
227+
228+ - Now you can run ``scancode -h `` to display the Help Text, and here the installation is complete.
229+
216230Un-installation
217231^^^^^^^^^^^^^^^
218232
219233- Delete the directory in which you extracted ScanCode.
220234- Delete any temporary files created in your system temp directory under a ScanCode directory.
221235
222- ---
236+ ----
223237
224- .. _ source_configure_install :
238+ .. _ pip_install :
225239
226- Build From Source
227- -----------------
240+ Installation as a library: via ``pip ``
241+ --------------------------------------
242+
243+ ScanCode can be easily installed using ``pip ``. The steps are:
244+
245+ #. Create a Python 3.6 Virtual Environment::
246+
247+ virtualenv -p /usr/bin/python3.6 venv-scancode
248+
249+ For more information on Python virtualenv, visit this `page <https://docs.python-guide.org/dev/virtualenvs/#lower-level-virtualenv >`_.
250+
251+ #. Activate the Virtual Environment you just created::
252+
253+ source venv-scancode/bin/activate
254+
255+ #. Run ``pip install scancode-toolkit `` to install the latest version of Scancode.
256+
257+ .. NOTE ::
258+
259+ If you use Python 2.7, scancode-toolkit Version 3.0.2 is installed by default. For Python 3
260+ the latest version of Scancode Toolkit is installed by default. Requesting a specific version
261+ through ``pip install `` for Python 3 will give Errors if the Version isn't 3.1.x or later.
262+
263+ .. WARNING ::
264+
265+ Python 3.7.x and 3.8.x is not supported yet.
266+
267+ To uninstall, run ``pip uninstall scancode-toolkit ``.
268+
269+ ----
270+
271+ .. _source_code_install :
272+
273+ Installation from Source Code: Git Clone
274+ ----------------------------------------
228275
229276You can also download the Scancode Toolkit Source Code and build from it yourself. This is how you
230277would want to do it if:
231278
232- - You are Adding new patches to Scancode and want to test it.
233- - You want to test a specific Version/Checkpoint/Branch from the VCS
279+ - You are Adding new patches to Scancode and want to test it. So you build ScanCode locally
280+ with your added changes.
234281
282+ - You want to test a specific Version/Checkpoint/Branch from the VCS.
235283
236284Download the ScanCode-Toolkit Source Code
237285^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
238286
239- If you don't have the ScanCode Toolkit Source Code downloaded, get it from it's official Repository
240- (Downloaded as a .zip file) or run the following::
287+ If you don't have the ScanCode Toolkit Source Code downloaded, get it from its
288+ `official Repository <https://github.com/nexB/scancode-toolkit/ >`_ (Downloaded as a .zip file)
289+
290+ Or you can run the following if you have `Git <https://git-scm.com/ >`_ installed::
241291
242292 git clone https://github.com/nexB/scancode-toolkit.git
243293 cd scancode-toolkit
@@ -250,7 +300,7 @@ using the following command::
250300Here, ``master `` branch has the latest release of Scancode-Toolkit. You can also check out to any
251301of the following:
252302
253- - Branches (Locally created or already present)
303+ - Branches (Locally created or already present) [Example - `` master ``, `` develop `` etc]
254304- Tags (essentially Version Numbers) [Example - ``v3.1.1 ``, ``v3.1.0 `` etc]
255305- Commits (use the shortened commit hash) [Example - ``4502055 ``, ``f276398 `` etc]
256306
@@ -261,12 +311,68 @@ ScanCode use the Configure scripts to install a virtualenv, install required pac
261311as pip requirements and more configure tasks such that ScanCode can be installed in a
262312self-contained way with no network connectivity required.
263313
264- Open a terminal, clone the scancode-toolkit repository, cd to the clone directory and run: :
314+ On Linux/Mac :
265315
266- ./configure
316+ - Open a terminal
317+ - cd to the clone directory
318+ - run ``./configure ``
267319
268- On Windows open a command prompt, cd to the clone directory and run instead: :
320+ On Windows:
269321
270- configure
322+ - open a command prompt
323+ - cd to the clone directory
324+ - run instead ``configure ``
271325
272326Now you are ready to use the freshly configured scancode-toolkit.
327+
328+ ----
329+
330+ .. _commands_variation :
331+
332+ Commands Variation
333+ ------------------
334+
335+ The commands to run ScanCode varies for:
336+
337+ - Different Installation Methods
338+ - OS used
339+
340+ The two types of commands are:
341+
342+ - ``scancode [OPTIONS] <OUTPUT FORMAT OPTION(s)> <SCAN INPUT> ``
343+ - ``path/to/scancode OPTIONS] <OUTPUT FORMAT OPTION(s)> <SCAN INPUT> ``
344+
345+ In the second case, ``./scancode `` is used if already in the directory.
346+
347+ These variations are summed up in the following table:
348+
349+ .. list-table ::
350+ :widths: 10 5 10 50
351+ :header-rows: 1
352+
353+ * - Installation Methods
354+ - Application Install
355+ - Pip Install
356+ - Install from Source Code
357+
358+ * - Linux
359+ - `./scancode `
360+ - `scancode `
361+ - `./scancode `
362+
363+ * - Mac
364+ - `./scancode `
365+ - `scancode `
366+ - `./scancode `
367+
368+ * - Windows
369+ - `scancode `
370+ - `scancode `
371+ - `scancode `
372+
373+ To sum it up, ``scancode `` is used in these two cases:
374+
375+ - If ``pip `` install is used.
376+ - If the OS is Windows.
377+
378+ In all other cases, ``./scancode `` is used.
0 commit comments