Crashes with AttributeError: 'TestenvConfig' object has no attribute 'conda_exe'
SimonBin opened this issue · comments
If tox and tox-conda are installed,
this config
[tox]
requires = tox-conda
tox-run-before
crashes with
.tox create: ~/repro/.tox/.tox
Traceback (most recent call last):
File "~env/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "~env/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "~env/lib/python3.8/site-packages/tox/session/__init__.py", line 69, in main
exit_code = session.runcommand()
File "~env/lib/python3.8/site-packages/tox/session/__init__.py", line 187, in runcommand
return provision_tox(provision_tox_venv, self.config.args)
File "~env/lib/python3.8/site-packages/tox/session/commands/provision.py", line 10, in provision_tox
ensure_meta_env_up_to_date(provision_venv)
File "~env/lib/python3.8/site-packages/tox/session/commands/provision.py", line 24, in ensure_meta_env_up_to_date
if provision_venv.setupenv():
File "~env/lib/python3.8/site-packages/tox/venv.py", line 626, in setupenv
status = self.update(action=action)
File "~env/lib/python3.8/site-packages/tox/venv.py", line 270, in update
self.hook.tox_testenv_create(action=action, venv=self)
File "~env/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "~env/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "~env/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "~env/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "~env/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "~env/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "~env/lib/python3.8/site-packages/tox_conda/plugin.py", line 194, in tox_testenv_create
args = [venv.envconfig.conda_exe, "create", "--yes", "-p", envdir]
File "~env/lib/python3.8/site-packages/tox/config/__init__.py", line 1042, in __getattribute__
rv = object.__getattribute__(self, name)
AttributeError: 'TestenvConfig' object has no attribute 'conda_exe'
instead of self-provisioning a working tox env
I have this same problem, downgrading to ~=0.7.0
should fix this
I cannot reproduce it:
ll
total 8.0K
-rw-r--r-- 1 antoine 38 Nov 21 20:36 setup.py
-rw-r--r-- 1 antoine 53 Nov 21 22:07 tox.ini
cat setup.py
from setuptools import setup
setup()
cat tox.ini
[tox]
requires = tox-conda
tox-run-before
tox
.tox create: /tmp/0/.tox/.tox
.tox installdeps: tox-conda, tox-run-before, tox >= 3.24.4
GLOB sdist-make: /tmp/0/setup.py
python create: /tmp/0/.tox/python
python inst: /tmp/0/.tox/.tmp/package/1/UNKNOWN-0.0.0.zip
python installed: argcomplete==1.12.3,attrs==21.2.0,delta==0.4.2,iniconfig==1.1.1,jsonschema==3.2.0,pipx==0.16.4,py==1.11.0,pyrsistent==0.18.0,pytest==6.2.5,pytest-executable @ file:///home/antoine/PycharmProjects/pytest-executable,UNKNOWN @ file:///tmp/0/.tox/.tmp/package/1/UNKNOWN-0.0.0.zip,userpath==1.7.0
python run-test-pre: PYTHONHASHSEED='3731313267'
_________________________________________________________________ summary __________________________________________________________________
python: commands succeeded
congratulations :)
Please provide more context.
setup.py and tox.ini as yours
conda create --name toxcondabug python=3.8
conda activate toxcondabug
conda install tox-conda -c conda-forge
tox
(error appears)
Thank you, I can reproduce it now.
Meanwhile, just install tox
(no tox-conda
) in your anaconda environment:
conda create -c conda-forge -n toxcondabug python=3.8 tox
...
conda run -n toxcondabug --no-capture-output tox
.tox create: /tmp/0/.tox/.tox
.tox installdeps: tox-conda, tox-run-before, tox >= 3.24.4
GLOB sdist-make: /tmp/0/setup.py
python create: /tmp/0/.tox/python
python inst: /tmp/0/.tox/.tmp/package/1/UNKNOWN-0.0.0.zip
python installed: argcomplete==1.12.3,attrs==21.2.0,delta==0.4.2,iniconfig==1.1.1,jsonschema==3.2.0,pipx==0.16.4,py==1.11.0,pyrsistent==0.18.0,pytest==6.2.5,pytest-executable @ file:///home/antoine/PycharmProjects/pytest-executable,UNKNOWN @ file:///tmp/0/.tox/.tmp/package/1/UNKNOWN-0.0.0.zip,userpath==1.7.0
python run-test-pre: PYTHONHASHSEED='3611896972'
_________________________________________________________________ summary __________________________________________________________________
python: commands succeeded
congratulations :)
I have the same issue that is triggered when I try to specify a pip version:
[tox]
requires =
tox-conda
setuptools >= 40.8.0
pip < 22
Not setting pip
in the requires
list or removing tox-conda
from the environment fixes the issue.
> conda info
active environment : _taxonopy
active env location : C:\Anaconda3\envs\_taxonopy
shell level : 2
user config file : C:\Users\Work\.condarc
populated config files : C:\Users\Work\.condarc
C:\Anaconda3\envs\_taxonopy\.condarc
conda version : 4.12.0
conda-build version : 3.21.6
python version : 3.9.7.final.0
virtual packages : __win=0=0
__archspec=1=x86_64
base environment : C:\Anaconda3 (writable)
conda av data dir : C:\Anaconda3\etc\conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/win-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Anaconda3\pkgs
C:\Users\Work\.conda\pkgs
C:\Users\Work\AppData\Local\conda\conda\pkgs
envs directories : C:\Anaconda3\envs
C:\Users\Work\.conda\envs
C:\Users\Work\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.12.0 requests/2.26.0 CPython/3.9.7 Windows/10 Windows/10.0.19044
administrator : True
netrc file : None
offline mode : False
I also note that the pip version set in requires
is not respected.
> conda list
# packages in environment at E:\Programming\Python\git\taxonopy\.tox\py37:
#
# Name Version Build Channel
...
pip 22.0.4 pyhd8ed1ab_0 conda-forge
...
I think that requires refers to the packages installed in the provisional environment from where tox is executed from, and not to the environments from where the commands are executed.
@gaborbernat Is it correct?