[Python] Conda python package installs in wrong place

Discussão em 'Python' iniciado por Stack, Dezembro 18, 2024.

  1. Stack

    Stack Membro Participativo

    I have created a pure python conda package called ssstack using conda build, but when I install it (from the local build directory) using:

    conda create -n <env name> -c <path to local build> ssstack`


    the python package and CLI executables get put in the wrong place. Instead of it putting the python package in:

    <ENV_ROOT>/lib/python3.12/site-packages/ssstack


    it incorrectly puts them in the root of the environment, i.e.:

    <ENV_ROOT>/site-packages/ssstack


    It also puts the python CLI scripts in the wrong place; instead of it being put in

    <ENV_ROOT>/bin/ssstack


    It ends up being left in:

    <ENV_ROOT>/python-scripts/ssstack


    Obviously, neither the python module or the CLI scripts can be found when using the environment.

    It's almost like conda doesn't know that it is a python package, so doesn't put it under the lib/python3.xx directory.

    Oddly, if I create a new environment with just a python installation first, then activate it and install the ssstack package in to the existing environment then everything gets put in the correct place, i.e.:

    conda create -n ssstack_env python==3.12
    conda activate ssstack_env
    conda install -c <path to local build> ssstack ## WORKS!


    I can't for the life of me understand why the latter method works correctly, but not the former.

    I've spent a lot of time searching for a reason, but have come up with nothing. Any advice will be gratefully recieved!

    Here's my meta.yaml recipe for reference:

    {% set name = "ssstack" %}
    {% set version = "0.4.0" %}

    package:
    name: "{{ name|lower }}"
    version: "{{ version }}"

    source:
    path: ../../..

    build:
    noarch: python
    number: 1
    script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation


    requirements:
    host:
    - pip
    - python>=3.8
    - setuptools
    run:
    - conda
    - conda-lock
    - packaging
    - pydantic
    - pyyaml
    - requests
    - tabulate
    - tqdm
    - typer

    Continue reading...

Compartilhe esta Página