|
|
| (2 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| = Introduction = | | = Introduction = |
|
| |
|
| <code>Inline::Python</code> is a Perl module which allows interactions between Perl code and Python code. SPADS uses it to communicate with plugins coded in Python. | | <code>Inline::Python</code> is a Perl module which allows interactions between Perl code and Python code. SPADS uses it to communicate with plugins coded in Python. This document will detail the different ways to install <code>Inline::Python</code> on Linux and Windows. |
| | |
| Unfortunately the current stable release of this module suffers from a bug which makes Perl strings appear as byte strings when used with Python 3 (Python 2 is unaffected). This is not a blocking problem, as Python can easily convert these data if needed and SPADS plugin API offers dedicated functions to deal with the problem (cf the [http://planetspads.free.fr/spads/doc/spadsPluginApiDoc.html#Perl-strings-conversions PYTHON SPECIFIC NOTES - Perl strings conversions] section of the Plugin API documentation). However, a cleaner way to solve this problem is to install a fixed version of the module, directly from the official module maintainer repository. The remaining of this document will detail the different ways to install <code>Inline::Python</code>, on Linux and Windows.
| |
|
| |
|
| <br> | | <br> |
| = Installing Inline::Python on Linux = | | = Installing Inline::Python on Linux = |
| <br> | | <br> |
| == Method 1: Using cpanminus to install latest version from GitHub == | | == Method 1: Using the package manager of your Linux distribution == |
| <code>cpanminus</code> is a lightweight package manager for Perl, which is able to install Perl modules directly from Git repositories. This is very useful for <code>Inline::Python</code> installation because only the latest version from the module maintainer repository includes the fix for Perl string conversions with Python 3.
| | This is the easiest way to install <code>Inline::Python</code> (if your distribution supports it), as it automatically downloads and installs a package specifically prepared for your distribution. |
| | |
| The first step consists in installing <code>cpanminus</code> (if not already installed on your system). To do that you can usually use the package manager of your Linux distribution. For example, for Debian based distributions: <code>apt-get install cpanminus</code>, or for Red Hat based distributions: <code>dnf install perl-App-cpanminus</code> (for other cases, check [https://metacpan.org/pod/App::cpanminus#INSTALLATION the INSTALLATION section of cpanminus documentation]).
| |
| | |
| Once <code>cpanminus</code> is installed, it can be used to install the latest version of <code>Inline::Python</code> from module maintainer's repository. This can be done simply by entering following command (with root privileges if you are using the system Perl):<br>
| |
| <code><nowiki>cpanm https://github.com/niner/inline-python-pm.git</nowiki></code>
| |
| | |
| <br>
| |
| == Method 2: Using the package manager of your Linux distribution ==
| |
| This is the easiest way to install <code>Inline::Python</code> (if your distribution supports it), as it automatically downloads and installs a package specifically prepared for your distribution. However, this method installs the stable release of <code>Inline::Python</code>, which suffers from the string conversion bug with Python 3 explained in introduction. So this method is only recommended if you don't plan to use Python 3 or if the installation method based on <code>cpanminus</code> failed. | |
|
| |
|
| For this method you just need to find the name of the system package containing the <code>Inline::Python</code> Perl module and install it on your system.<br> | | For this method you just need to find the name of the system package containing the <code>Inline::Python</code> Perl module and install it on your system.<br> |
| Line 25: |
Line 14: |
|
| |
|
| <br> | | <br> |
| == Method 3: Using cpan == | | == Method 2: Using cpan == |
| <code>cpan</code> is the standard tool included with Perl to install modules from the [https://www.cpan.org/ Comprehensive Perl Archive Network]. Unfortunately, only the current stable releases of the modules can easily be installed this way, so this method should only be reserved to cases where all other installation methods failed. | | <code>cpan</code> is the standard tool included with Perl to install modules from the [https://www.cpan.org/ Comprehensive Perl Archive Network]. |
|
| |
|
| To install <code>Inline::Python</code> using <code>cpan</code>, simply enter following command (with root privileges if you are using the system Perl):<br> | | To install the latest stable release of <code>Inline::Python</code> using <code>cpan</code>, enter following command (with root privileges if you are using the system Perl):<br> |
| <code>cpan Inline::Python</code> | | <code>cpan Inline::Python</code> |
|
| |
|
| Line 34: |
Line 23: |
| = Installing Inline::Python on Windows = | | = Installing Inline::Python on Windows = |
| <br> | | <br> |
| == Step 1: Installing cpanminus ==
| | To install the latest stable release of <code>Inline::Python</code> using <code>cpanminus</code>, enter following command:<br> |
| <code>cpanminus</code> is a lightweight module manager for Perl, which is able to install Perl modules directly from Git repositories and allows interactive mode installations.
| | <code><nowiki>cpanm Inline::Python</nowiki></code> |
| | |
| If your are using Strawberry Perl, <code>cpanminus</code> should be pre-installed (you can check it by trying the <code>cpanm</code> command in a console windows). If you are using another Perl distribution and <code>cpanminus</code> isn't pre-installed, you should be able to use the packet manager of your Perl distribution (<code>ppm</code> for example for old ActiveState Perl releases) to install <code>cpanminus</code>. You can also use the generic default Perl module manager <code>cpan</code> to install it using following command: <code>cpan cpanminus</code>
| |
| | |
| <br>
| |
| == Step 2: Using cpanminus to install Inline::Python ==
| |
| As explained in introduction, the current stable release of <code>Inline::Python</code> suffers from the string conversion bug with Python 3, so it is recommended to install the latest version instead. Unfortunately, the installation script included in the latest version on the module maintainer repository has some problems when installing on Windows. I created my own fork on GitHub to fix these installation problems. As long as the module maintainer didn't merge my fixes in his repository, I recommend using my fork to install the latest version of <code>Inline::Python</code> on Windows, using following command:<br>
| |
| <code><nowiki>cpanm https://github.com/Yaribz/inline-python-pm.git</nowiki></code> | |
| | |
| <br>
| |
| If for some reason the installation from my fork fails, you can try to install the stable release of <code>Inline::Python</code> instead. Unfortunately, the current stable release of <code>Inline::Python</code> doesn't install automatically on Windows due to broken Python installation detection and one test which is coded for Linux system only and which must be skipped. Consequently, <code>cpanminus</code> must be run in interactive mode and with a flag to force installation despite the failing test, using this command:<br>
| |
| <code>cpanm --interactive -f Inline::Python</code>
| |
| | |
| The install script will then ask 4 questions:
| |
| # <code>Use which? [1]</code> Here you must enter the full path of your <code>python.exe</code> file from your Python installation (warning: paths containing spaces are not supported by the installer). For example: <code>C:\Python\python.exe</code>
| |
| # <code>Enter extra libraries (e.g. -lfoo -lbar) [None]</code> Here you can press enter, as no additional library should be needed for standard Python installation.
| |
| # <code>Which? Or enter another. [1]</code> Here you need to enter the digit corresponding to the library with 2 digits in its name. For example: <code>2</code> (to select entry <code>2) C:/Python/libs/python39.lib</code>)
| |
| # <code>Which? Or enter another. [1]</code> Here you can press enter as the install script should have auto-detected the include location of your Python installation correctly.
| |
Introduction
Inline::Python is a Perl module which allows interactions between Perl code and Python code. SPADS uses it to communicate with plugins coded in Python. This document will detail the different ways to install Inline::Python on Linux and Windows.
Installing Inline::Python on Linux
Method 1: Using the package manager of your Linux distribution
This is the easiest way to install Inline::Python (if your distribution supports it), as it automatically downloads and installs a package specifically prepared for your distribution.
For this method you just need to find the name of the system package containing the Inline::Python Perl module and install it on your system.
For example, for Debian based distributions: apt-get install libinline-python-perl
For Red Hat based distributions: dnf install perl-Inline-Python
Method 2: Using cpan
cpan is the standard tool included with Perl to install modules from the Comprehensive Perl Archive Network.
To install the latest stable release of Inline::Python using cpan, enter following command (with root privileges if you are using the system Perl):
cpan Inline::Python
Installing Inline::Python on Windows
To install the latest stable release of Inline::Python using cpanminus, enter following command:
cpanm Inline::Python