Search code examples
pythoncondaconda-buildmamba

mamba installs package into wrong site-packages directory


I have a problem like so: I am in a conda environment that has mamba installed (let's call the environment mamba_env). I now want to use mamba to install a (self-built) package some_package into another conda environment called some_env.
The python version in some_env is python3.10 and site packages are stored in ~/.conda/envs/some_env/lib/python3.10/site-packages.

The command I am using is mamba install some_package -n some_env.

However, this command places the installation files for some_package into ~/.conda/envs/some_env/lib/python3.11/site-packages. Hence they are not visible to the python3.10 executable in some_env.

Why does this happen?
python3.11 is the system-wide python executable found in /usr/bin/python3.11.
Can it be related to an error in my build of some_package?
It does not happen when I e.g. do mamba install black -n some_env from inside mamba_env.
The black package is then nicely placed into ~/.conda/envs/some_env/lib/python3.10/site-packages.

Any pointers appreciated!


Solution

  • Problem was that I had built the package only against python3.11. In my meta.yaml I had to replace

    build:
      linux-64: python
    

    by

    build:
      noarch: python
    

    Resources:
    https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#architecture-independent-packages
    Create conda package across many versions