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
OK - after many frustrating hours I finally figured this out for myself.
The issue was that python
was missing as a dependency in requirements: -> run:
, i.e.:
requirements:
run:
- python
It appears that without this conda doesn't realise that it is a python package and doesn't put the site-packages
and CLI scripts in the right place.
This must be a change in behaviour of conda at some point because AFAIK this recipe used to work fine.
P.S. the thing that alerted to me to this was the lack of a _py
part to the build version of the generated conda package.