Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Conda package help

79 views
Skip to first unread message

Amol Parnaik

unread,
Apr 7, 2022, 9:01:27 PM4/7/22
to conda...@googlegroups.com
Hi

I'm in a bit of a mess making a conda package

1) I have a raw set of python and ini files put together as follows

amol
    src
        amol
            apple
                conn.py
                __init__.py
            carrot
                conn.py
                __init__.py
            config
                apple.ini
                carrot.ini
        __init__.py
meta.yaml
MANIFEST.in
setup.cfg
pyproject.toml


I want to create a solid conda package out of this so that I can ultimately do

conda install amol


and have the avoid code and dependent packages installed

2) I'm using 'conda build .' in the first 'amol' dir with the meta.yaml entry


build:
    number:0
    script: python -m pip install --no-deps --ignore-installed

so for pip install, I have a simple setup.cfg which has

[metadata]
<stuff>

[options]
package=find:
python_requires = >=3.9
include_package_data = True

[options.package.find]
where = src

and the standard pyproject.toml

[build-system]
requires=["setuptools>42"]
build-backend="setuptools build_meta"

The build process works fine when I have a machine (docker image) with all the libs required. It creates a .tar.bz2 file locally.

3) I cannot connect to anaconda channels due to firm policy however the firm has a copy of conda-forge. We cannot upload to this conda-forge channel however. If I copy this .tar.bz2 to a new machine and do 

        conda install --use-local amol-0.0.1-0.tar.bz2

it installs fine, however I am having some issues


Issues

1) When I do a conda install, it doesn't install the dependencies. I've tried using

    [options]
    install_requires = 
        pandas


in setup.cfg and 

    requirements:
        build
            - pandas

in meta.yaml and neither works. What am I doing wrong?

2) I can, in theory, create a custom channel with a spare linux box as I think my lack of channel usage is causing noise. Do you think this will help? What's the best approach?

3) Any general tips and thoughts to tidy all this up?

Kind Regards



Yuri Pirola

unread,
Apr 8, 2022, 3:07:40 AM4/8/22
to conda...@googlegroups.com
HI,
as for issue (1), I believe the correct way to specify dependencies is
the second you tried (meta.yaml) but you should specify pandas as a
`run` dependency and not as a `build` one. (See, for example,
https://conda-forge.org/docs/maintainer/adding_pkgs.html#use-pip)

Hope this helps.
> --
> You received this message because you are subscribed to the Google Groups "conda-forge" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to conda-forge...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/conda-forge/1207033472.1295174.1649379624798%40mail.yahoo.com.

Chris Barker

unread,
Apr 8, 2022, 1:18:27 PM4/8/22
to Yuri Pirola, conda...@googlegroups.com
On Fri, Apr 8, 2022 at 12:07 AM Yuri Pirola <yuri....@gmail.com> wrote:
as for issue (1), I believe the correct way to specify dependencies is
the second you tried (meta.yaml) but you should specify pandas as a
`run` dependency and not as a `build` one. (See, for example,
https://conda-forge.org/docs/maintainer/adding_pkgs.html#use-pip)

Exactly.
 > 2) I can, in theory, create a custom channel with a spare linux box as I think my lack of channel usage is causing noise. Do you think this will help? What's the best approach?

You have three choices:

1) Put your package(s) on your own channel on Anaconda.org:


And then you can install directly by adding that channel to your conda config.

But it sounds like that's not an option for you, so:

2) Put the package files somewhere, and install them directly, as you have done. However:

"Installing packages directly from the file does not resolve dependencies."

So you'd need to install, e.g. Pandas by hand.

3) Set up a private conda channel -- this is more work to set up, but then your users could simply `conda install` your packages and all should work.

NOTE: if you are using a clone of the conda-forge channel -- you should be able to simply add your packages to your clone, rather than setting up another channel.

HTH,

-CHB

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
0 new messages