Skip to content
Advertisement

How to precise the Perl version when creating a package using conda-build

I am trying to create a package for a Perl module I have and then put it in a local channel to be able to install it in a conda environement. I am trying to follow the conda documentation but as it’s the first time I’m trying to do that, I kind of lost myself.

Doc to create a conda package from scratch : https://docs.conda.io/projects/conda-build/en/latest/user-guide/tutorials/build-pkgs.html

Doc to understand the metadata of a meta.yaml file : https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#build-section

Doc to conda-build : https://conda.io/projects/conda-build/en/latest/resources/commands/conda-build.html

So first I created a recipe with a meta.yaml file and a build.sh file. The version of Perl included in my conda is 5.26.2. However the Perl module has been written with Perl 5.18.2. I can’t find a way to modify the version of Perl…

I tried to :

$ conda-build <path_to_perl_module>/recipe --perl=5.18.2

I also tried to put in the meta.yaml file some specifications for Perl in the requirements section.

requirements:
  host:
    perl >=5.18.2

But in both cases (I also tried to change the run/build section of the requirements with the same result) when I install the package in a conda environment, the console prompt :

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    pmp-0.8.2_BSP              |                0           5 KB  file:///home/usr/BSP-channel
    ------------------------------------------------------------
                                           Total:           5 KB

The following NEW packages will be INSTALLED:

  libgcc-ng          pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
  perl               conda-forge/linux-64::perl-5.26.2-h516909a_1006
  pmp                BSP-channel/linux-64::pmp-0.8.2_BSP-0

As you can see, the package manager wants to install Perl 5.26.2. I guess I don’t do it the right way but the documentation doesn’t really help me or I haven’t found the corresponding part.

Any leads would be greatly appreciate.

Have a good day/night !

edit : What Could I do ?

  1. Use my local Perl located in usr/bin/Perl ?

  2. Download the Perl 5.18.2 package from : https://www.cpan.org/src/README.html and linked it somehow inside the meta.yaml file ?

Advertisement

Answer

I have found a solution to my issue. I’m not sure it’s the right way to do though.

I download the conda package for Perl 5.18.2 here : https://anaconda.org/Nersc/perl/files

I also indicate in the meta.yaml in the requirements field :

requirements:
  run:
    perl x.x

I put the package in my custom channel. Then I create the package using conda-build <path_to_Perl_module>/recipe/ --perl=5.18.2. When I install the package using conda instal <perl_module> I get this output :

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    perl-5.18.2                |                3        14.2 MB  file:///home/usr/BSP-channel
    pmp-0.8.2_BSP              |                0           5 KB  file:///home/usr/BSP-channel
    ------------------------------------------------------------
                                           Total:        14.2 MB

The following NEW packages will be INSTALLED:

  perl               BSP-channel/linux-64::perl-5.18.2-3
  pmp                BSP-channel/linux-64::pmp-0.8.2_BSP-0

If I create the module without indicating --perl=5.18.2 we then look for the newest Perl version available in conda-forge.

I hope it will help you if you are stuck with the same issue.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement