tox-dev / tox-conda

Make tox cooperate with conda envs
MIT License
152 stars 40 forks source link

tox + tox-conda + filelock=3.8 fail to install dependencies #140

Open rupertcw opened 2 years ago

rupertcw commented 2 years ago

Linking issue started in filelock

AntoineD commented 2 years ago

How could I reproduce this?

rupertcw commented 2 years ago

Conda environment: conda install --freeze-installed --channel conda-forge "tox" -y

Tox ini:

[tox]
envlist = py39
skipsdist = true
requires = tox-conda

[testenv]
conda_deps =
    pytest
    pytest-mock
conda_env = env.yaml
conda_channels =
    conda-forge
conda_install_args =
    --freeze-installed
    --override-channels
commands = pytest -s -v tests

Start the tests: conda run tox

Expected output:

[Container] 2022/08/18 09:23:06 Running command $CONDA run tox
ERROR conda.cli.main_run:execute(49): `conda run tox` failed. (See above for error)
.tox create: /codebuild/output/src003655152/src/github.com/org/repo/.tox/.tox
.tox installdeps: tox-conda, tox >= 3.25.1
py39 create: /codebuild/output/src003655152/src/github.com/org/repo/.tox/py39
ERROR: invocation failed (exit code -9), logfile: /codebuild/output/src003655152/src/github.com/org/repo/.tox/py39/log/py39-0.log
================================== log start ===================================
Collecting package metadata (repodata.json): ...working... 
=================================== log end ====================================
ERROR: InvocationError for command /root/miniconda3/bin/conda env create -p /codebuild/output/src003655152/src/github.com/org/repo/.tox/py39 --file /codebuild/output/src003655152/src/github.com/org/repo/env.yaml (exited with code -9 (SIGKILL)) (exited with code -9)
___________________________________ summary ____________________________________
ERROR:   py39: InvocationError for command /root/miniconda3/bin/conda env create -p /codebuild/output/src003655152/src/github.com/org/repo/.tox/py39 --file /codebuild/output/src003655152/src/github.com/org/repo/env.yaml (exited with code -9 (SIGKILL)) (exited with code -9)

Downgrading filelock fixes the issue: conda install --freeze-installed --channel conda-forge "filelock=3.7" "tox" -y

This happened on an AWS CodeBuild Linux machine

AntoineD commented 2 years ago

Thank you, what is in yourenv.yaml?

rupertcw commented 2 years ago

env.yaml

name: base
channels:
  - conda-forge
dependencies:
  - gdown=4.5.1
  - matplotlib=3.5
  - numpy
  - openpyxl
  - pandas
  - python=3.9
AntoineD commented 2 years ago

I cannot reproduce it, here is what I've done:

  1. conda create -p /tmp/toxenv -y since I do not want to pollute my base anaconda env
  2. conda activate /tmp/bug/toxenv
  3. conda install --freeze-installed --channel conda-forge "tox" -y
  4. conda deactivate
  5. conda run -p /tmp/bug/toxenv tox

The output is:

❯ conda run -p /tmp/bug/toxenv tox                               
py39 installed: attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1659291887007/work,iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1603384189793/work,packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1637239678211/work,pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1648772597647/work,py @ file:///home/conda/feedstock_root/build_artifacts/py_1636301881863/work,pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1652235407899/work,pytest==7.1.3,pytest-mock @ file:///home/conda/feedstock_root/build_artifacts/pytest-mock_1665065505275/work,tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1644342247877/work
py39 run-test-pre: PYTHONHASHSEED='527902652'
py39 run-test: commands[0] | pytest -s -v tests
============================= test session starts ==============================
platform linux -- Python 3.9.13, pytest-7.1.3, pluggy-1.0.0 -- /tmp/bug/.tox/py39/bin/python
cachedir: .tox/py39/.pytest_cache
rootdir: /tmp/bug
plugins: mock-3.10.0
collecting ... ERROR: file or directory not found: tests

collected 0 items

============================ no tests ran in 0.01s =============================
ERROR: InvocationError for command /tmp/bug/.tox/py39/bin/pytest -s -v tests (exited with code 4)
___________________________________ summary ____________________________________
ERROR:   py39: commands failed

ERROR conda.cli.main_run:execute(49): `conda run tox` failed. (See above for error)

with

❯ pip list         
Package                       Version
----------------------------- -------
alabaster                     0.7.12
colorama                      0.4.5
cycler                        0.11.0
distlib                       0.3.5
filelock                      3.8.0
imagesize                     1.3.0
importlib-metadata            4.11.4
joblib                        1.1.0
matplotlib                    3.5.2
numpydoc                      1.3.1
packaging                     21.3
pip                           22.3
platformdirs                  2.5.2
pluggy                        1.0.0
py                            1.11.0
pyDOE2                        1.3.0
pyparsing                     3.0.9
scikit-learn                  1.1.0
setuptools                    65.5.0
six                           1.16.0
smt                           1.2.0
snowballstemmer               2.2.0
Sphinx                        4.5.0
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
threadpoolctl                 3.1.0
tomli                         2.0.1
tox                           3.26.0
virtualenv                    20.16.5
wheel                         0.37.1
zipp                          3.9.0
rupertcw commented 2 years ago

The only other thing I can provide is that we are using Miniconda 4.11.0, installed from: Miniconda3-py39_4.11.0-Linux-x86_64.sh

AntoineD commented 2 years ago

Could you try to install tox from pip instead of conda?