tox-dev / tox-conda

Make tox cooperate with conda envs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py.path has been renamed? (ModuleNotFoundError: No module named 'py')

Huite opened this issue · comments

commented

My CI pipelines using tox-conda don't seem to work anymore as of recently, as I get the following error:

  File "/home/runner/work/xugrid/xugrid/.tox/.tox/lib/python3.10/site-packages/tox_conda/plugin.py", line 10, in <module>
    import py.path
ModuleNotFoundError: No module named 'py'

I have a suspicion this is because py.path has been renamed to path?

See: https://pypi.org/project/path.py/
and: https://pypi.org/project/path/

commented

After looking a little more: it seems like py.path was being used before, but I don't see it mentioned in setup.cfg.

Maybe it was present due to an other dependency, but not anymore?

py.path is part of the py package that is a dependency of tox version 3 and tox-conda only supports this version for now.

commented

Ah right, that explains it -- it would've taken quite some time to figure it out.

Maybe it's worthwhile to mention this in the README? Currently, I guess I could've figured it by checking the setup.cfg, but that's not quite obvious.

I'll install tox < 4. Thanks!

I'm surprised the current tox-conda could be installed with tox 4 because tox-conda has a constraint on the version of tox.
Do you know why this happens?

commented

My ci.yml looks like this:

  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: install mamba
        uses: mamba-org/provision-with-micromamba@main

      - name: Test and build with tox
        run: |
          pip install tox
          tox -e build
      - uses: codecov/codecov-action@v1

The start of my tox.ini:

[tox]
requires = tox-conda
isolated_build = True
setenv =
    CONDA_EXE=mamba

I think I could've avoided it by using pip install tox-conda instead of pip install tox.
In this case, it must be tox installing tox-conda. I'm not sure why I set it up this way, most likely because I started with a standard tox configuration, and then found a way to use tox-conda.

It turns out that when tox creates the provisional env to install tox-condapip find an old version (0.8.1) of tox-conda that has no constraint on the version of tox.

So it seems the only solution to this is what you already did, i.e. install tox<4