Conda custom package installs into wrong python version directory

Viewed 246

After building a conda package and installing it into a new empty environment my package cannot be imported due to it being placed into the python3.8/site-packages directory whereas the environment's python executable and all of the package dependencies are under python3.7.

Starting from a an empty env.:

conda create -n myenv

conda install --use-local mypackage

The resulting install ends up with the following:

~/miniconda3/envs/myenv/lib/python3.8/site-packages
  |-mypackage/
  |-mypackage-0.0.0-py3.8.egg.info/

~/miniconda3/envs/myenv/lib/python3.7/site-packages
  |- all of the dependencies...

The resulting conda env also ends up having its python version set to 3.7 as well. So obviously, now when I open a python console and attempt to import my package it fails. The perplexing thing is that I do have an import test in my meta.yml that tests importing my package that seems to pass during the conda build process.

If I pin my meta.yml python version to python=3.7 instead of python>=3.7 it works. My package ends up installed in python3.7/site-packages with everything else and it works fine.


The relevant build requirements from my meta.yml:

requirements:
    build:
        - setuptools
        - nodejs>=14.5.0
        - mkdocs>=1.1.2
        - mkdocs-material>=5.4.0
        - mkdocs-material-extensions>=1.0
    host:
        - python
    run:
        - python>=3.7
        - rabbitmq-server>=3.7.16
        - pika>=1.1.0
        - pyzmq>=19.0.1
        - pyyaml>=5.3.1
        - numpy>=1.18.5
        - sqlalchemy>=1.3.18
        - sqlite>=3.28.0
        - netifaces>=0.10.9
        - psutil>=5.7.0
        - uvloop>=0.14.0
        - numexpr>=2.7.1
        - fastapi>=0.59.0
        - uvicorn>=0.11.3
test:
    imports:
        - mypackage

The relevant line from my conda recipe build.sh:

$PYTHON setup.py install
0 Answers
Related