tox-conda icon indicating copy to clipboard operation
tox-conda copied to clipboard

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

Open Huite opened this issue 3 years ago • 6 comments

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/

Huite avatar Dec 11 '22 19:12 Huite

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?

Huite avatar Dec 11 '22 20:12 Huite

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.

AntoineD avatar Dec 12 '22 10:12 AntoineD

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!

Huite avatar Dec 12 '22 11:12 Huite

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?

AntoineD avatar Dec 12 '22 12:12 AntoineD

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.

Huite avatar Dec 13 '22 09:12 Huite

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

AntoineD avatar Dec 14 '22 09:12 AntoineD