after_merge
stringlengths 28
79.6k
| before_merge
stringlengths 20
79.6k
| url
stringlengths 38
71
| full_traceback
stringlengths 43
922k
| traceback_type
stringclasses 555
values |
|---|---|---|---|---|
def __init__(
self,
classifier,
norm=np.inf,
eps=0.3,
targeted=False,
random_init=False,
batch_size=128,
expectation=None,
):
"""
Create a :class:`FastGradientMethod` instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Attack step size (input variation)
:type eps: `float`
:param targeted: Should the attack target one specific class
:type targeted: `bool`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
:param batch_size: Batch size
:type batch_size: `int`
:param expectation: An expectation over transformations to be applied when computing
classifier gradients and predictions.
:type expectation: :class:`ExpectationOverTransformations`
"""
super(FastGradientMethod, self).__init__(classifier, expectation=expectation)
self.norm = norm
self.eps = eps
self.targeted = targeted
self.random_init = random_init
self.batch_size = batch_size
|
def __init__(
self,
classifier,
norm=np.inf,
eps=0.3,
targeted=False,
random_init=False,
batch_size=128,
):
"""
Create a :class:`FastGradientMethod` instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Attack step size (input variation)
:type eps: `float`
:param targeted: Should the attack target one specific class
:type targeted: `bool`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
:param batch_size: Batch size
:type batch_size: `int`
"""
super(FastGradientMethod, self).__init__(classifier)
self.norm = norm
self.eps = eps
self.targeted = targeted
self.random_init = random_init
self.batch_size = batch_size
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _minimal_perturbation(self, x, y, eps_step=0.1, eps_max=1.0, **kwargs):
"""Iteratively compute the minimal perturbation necessary to make the class prediction change. Stop when the
first adversarial example was found.
:param x: An array with the original inputs
:type x: `np.ndarray`
:param y:
:type y:
:param eps_step: The increase in the perturbation for each iteration
:type eps_step: `float`
:param eps_max: The maximum accepted perturbation
:type eps_max: `float`
:return: An array holding the adversarial examples
:rtype: `np.ndarray`
"""
self.set_params(**kwargs)
adv_x = x.copy()
# Compute perturbation with implicit batching
for batch_id in range(int(np.ceil(adv_x.shape[0] / float(self.batch_size)))):
batch_index_1, batch_index_2 = (
batch_id * self.batch_size,
(batch_id + 1) * self.batch_size,
)
batch = adv_x[batch_index_1:batch_index_2]
batch_labels = y[batch_index_1:batch_index_2]
# Get perturbation
perturbation = self._compute_perturbation(batch, batch_labels)
# Get current predictions
active_indices = np.arange(len(batch))
current_eps = eps_step
while len(active_indices) != 0 and current_eps <= eps_max:
# Adversarial crafting
current_x = self._apply_perturbation(
x[batch_index_1:batch_index_2], perturbation, current_eps
)
# Update
batch[active_indices] = current_x[active_indices]
adv_preds = self._predict(batch)
# If targeted active check to see whether we have hit the target, otherwise head to anything but
if self.targeted:
active_indices = np.where(
np.argmax(batch_labels, axis=1) != np.argmax(adv_preds, axis=1)
)[0]
else:
active_indices = np.where(
np.argmax(batch_labels, axis=1) == np.argmax(adv_preds, axis=1)
)[0]
current_eps += eps_step
adv_x[batch_index_1:batch_index_2] = batch
return adv_x
|
def _minimal_perturbation(self, x, y, eps_step=0.1, eps_max=1.0, **kwargs):
"""Iteratively compute the minimal perturbation necessary to make the class prediction change. Stop when the
first adversarial example was found.
:param x: An array with the original inputs
:type x: `np.ndarray`
:param y:
:type y:
:param eps_step: The increase in the perturbation for each iteration
:type eps_step: `float`
:param eps_max: The maximum accepted perturbation
:type eps_max: `float`
:return: An array holding the adversarial examples
:rtype: `np.ndarray`
"""
self.set_params(**kwargs)
adv_x = x.copy()
# Compute perturbation with implicit batching
for batch_id in range(int(np.ceil(adv_x.shape[0] / float(self.batch_size)))):
batch_index_1, batch_index_2 = (
batch_id * self.batch_size,
(batch_id + 1) * self.batch_size,
)
batch = adv_x[batch_index_1:batch_index_2]
batch_labels = y[batch_index_1:batch_index_2]
# Get perturbation
perturbation = self._compute_perturbation(batch, batch_labels)
# Get current predictions
active_indices = np.arange(len(batch))
current_eps = eps_step
while len(active_indices) != 0 and current_eps <= eps_max:
# Adversarial crafting
current_x = self._apply_perturbation(
x[batch_index_1:batch_index_2], perturbation, current_eps
)
# Update
batch[active_indices] = current_x[active_indices]
adv_preds = self.classifier.predict(batch)
# If targeted active check to see whether we have hit the target, otherwise head to anything but
if self.targeted:
active_indices = np.where(
np.argmax(batch_labels, axis=1) != np.argmax(adv_preds, axis=1)
)[0]
else:
active_indices = np.where(
np.argmax(batch_labels, axis=1) == np.argmax(adv_preds, axis=1)
)[0]
current_eps += eps_step
adv_x[batch_index_1:batch_index_2] = batch
return adv_x
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def generate(self, x, **kwargs):
"""Generate adversarial samples and return them in an array.
:param x: An array with the original inputs.
:type x: `np.ndarray`
:param eps: Attack step size (input variation)
:type eps: `float`
:param norm: Order of the norm (mimics Numpy). Possible values: np.inf, 1 or 2.
:type norm: `int`
:param y: The labels for the data `x`. Only provide this parameter if you'd like to use true
labels when crafting adversarial samples. Otherwise, model predictions are used as labels to avoid the
"label leaking" effect (explained in this paper: https://arxiv.org/abs/1611.01236). Default is `None`.
Labels should be one-hot-encoded.
:type y: `np.ndarray`
:param minimal: `True` if only the minimal perturbation should be computed. In that case, use `eps_step` for the
step size and `eps_max` for the total allowed perturbation.
:type minimal: `bool`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
:param batch_size: Batch size
:type batch_size: `int`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
self.set_params(**kwargs)
params_cpy = dict(kwargs)
if "y" not in params_cpy or params_cpy[str("y")] is None:
# Throw error if attack is targeted, but no targets are provided
if self.targeted:
raise ValueError(
"Target labels `y` need to be provided for a targeted attack."
)
# Use model predictions as correct outputs
logger.info("Using model predictions as correct labels for FGM.")
y = get_labels_np_array(self._predict(x))
else:
y = params_cpy.pop(str("y"))
y = y / np.sum(y, axis=1, keepdims=True)
# Return adversarial examples computed with minimal perturbation if option is active
if "minimal" in params_cpy and params_cpy[str("minimal")]:
logger.info("Performing minimal perturbation FGM.")
x_adv = self._minimal_perturbation(x, y, **params_cpy)
else:
x_adv = self._compute(x, y, self.eps, self.random_init)
adv_preds = np.argmax(self._predict(x_adv), axis=1)
if self.targeted:
rate = np.sum(adv_preds == np.argmax(y, axis=1)) / x_adv.shape[0]
else:
rate = np.sum(adv_preds != np.argmax(y, axis=1)) / x_adv.shape[0]
logger.info("Success rate of FGM attack: %.2f%%", rate)
return x_adv
|
def generate(self, x, **kwargs):
"""Generate adversarial samples and return them in an array.
:param x: An array with the original inputs.
:type x: `np.ndarray`
:param eps: Attack step size (input variation)
:type eps: `float`
:param norm: Order of the norm (mimics Numpy). Possible values: np.inf, 1 or 2.
:type norm: `int`
:param y: The labels for the data `x`. Only provide this parameter if you'd like to use true
labels when crafting adversarial samples. Otherwise, model predictions are used as labels to avoid the
"label leaking" effect (explained in this paper: https://arxiv.org/abs/1611.01236). Default is `None`.
Labels should be one-hot-encoded.
:type y: `np.ndarray`
:param minimal: `True` if only the minimal perturbation should be computed. In that case, use `eps_step` for the
step size and `eps_max` for the total allowed perturbation.
:type minimal: `bool`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
:param batch_size: Batch size
:type batch_size: `int`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
self.set_params(**kwargs)
params_cpy = dict(kwargs)
if "y" not in params_cpy or params_cpy[str("y")] is None:
# Throw error if attack is targeted, but no targets are provided
if self.targeted:
raise ValueError(
"Target labels `y` need to be provided for a targeted attack."
)
# Use model predictions as correct outputs
logger.info("Using model predictions as correct labels for FGM.")
y = get_labels_np_array(self.classifier.predict(x))
else:
y = params_cpy.pop(str("y"))
y = y / np.sum(y, axis=1, keepdims=True)
# Return adversarial examples computed with minimal perturbation if option is active
if "minimal" in params_cpy and params_cpy[str("minimal")]:
logger.info("Performing minimal perturbation FGM.")
x_adv = self._minimal_perturbation(x, y, **params_cpy)
else:
x_adv = self._compute(x, y, self.eps, self.random_init)
adv_preds = np.argmax(self.classifier.predict(x_adv), axis=1)
if self.targeted:
rate = np.sum(adv_preds == np.argmax(y, axis=1)) / x_adv.shape[0]
else:
rate = np.sum(adv_preds != np.argmax(y, axis=1)) / x_adv.shape[0]
logger.info("Success rate of FGM attack: %.2f%%", rate)
return x_adv
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _compute_perturbation(self, batch, batch_labels):
# Pick a small scalar to avoid division by 0
tol = 10e-8
# Get gradient wrt loss; invert it if attack is targeted
grad = self._loss_gradient(batch, batch_labels) * (1 - 2 * int(self.targeted))
# Apply norm bound
if self.norm == np.inf:
grad = np.sign(grad)
elif self.norm == 1:
ind = tuple(range(1, len(batch.shape)))
grad = grad / (np.sum(np.abs(grad), axis=ind, keepdims=True) + tol)
elif self.norm == 2:
ind = tuple(range(1, len(batch.shape)))
grad = grad / (np.sqrt(np.sum(np.square(grad), axis=ind, keepdims=True)) + tol)
assert batch.shape == grad.shape
return grad
|
def _compute_perturbation(self, batch, batch_labels):
# Pick a small scalar to avoid division by 0
tol = 10e-8
# Get gradient wrt loss; invert it if attack is targeted
grad = self.classifier.loss_gradient(batch, batch_labels) * (
1 - 2 * int(self.targeted)
)
# Apply norm bound
if self.norm == np.inf:
grad = np.sign(grad)
elif self.norm == 1:
ind = tuple(range(1, len(batch.shape)))
grad = grad / (np.sum(np.abs(grad), axis=ind, keepdims=True) + tol)
elif self.norm == 2:
ind = tuple(range(1, len(batch.shape)))
grad = grad / (np.sqrt(np.sum(np.square(grad), axis=ind, keepdims=True)) + tol)
assert batch.shape == grad.shape
return grad
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(
self,
classifier,
norm=np.inf,
eps=0.3,
eps_step=0.1,
max_iter=20,
targeted=False,
random_init=False,
batch_size=128,
expectation=None,
):
"""
Create a :class:`BasicIterativeMethod` instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Maximum perturbation that the attacker can introduce.
:type eps: `float`
:param eps_step: Attack step size (input variation) at each iteration.
:type eps_step: `float`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:param targeted: Should the attack target one specific class
:type targeted: `bool`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
:param batch_size: Batch size
:type batch_size: `int`
:param expectation: An expectation over transformations to be applied when computing
classifier gradients and predictions.
:type expectation: :class:`ExpectationOverTransformations`
"""
super(BasicIterativeMethod, self).__init__(
classifier,
norm=norm,
eps=eps,
targeted=targeted,
random_init=random_init,
batch_size=batch_size,
expectation=expectation,
)
if eps_step > eps:
raise ValueError(
"The iteration step `eps_step` has to be smaller than the total attack `eps`."
)
self.eps_step = eps_step
if max_iter <= 0:
raise ValueError(
"The number of iterations `max_iter` has to be a positive integer."
)
self.max_iter = int(max_iter)
self._project = False
|
def __init__(
self,
classifier,
norm=np.inf,
eps=0.3,
eps_step=0.1,
max_iter=20,
targeted=False,
random_init=False,
):
"""
Create a :class:`BasicIterativeMethod` instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Maximum perturbation that the attacker can introduce.
:type eps: `float`
:param eps_step: Attack step size (input variation) at each iteration.
:type eps_step: `float`
:param targeted: Should the attack target one specific class
:type targeted: `bool`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
"""
super(BasicIterativeMethod, self).__init__(
classifier, norm=norm, eps=eps, targeted=targeted, random_init=random_init
)
if eps_step > eps:
raise ValueError(
"The iteration step `eps_step` has to be smaller than the total attack `eps`."
)
self.eps_step = eps_step
if max_iter <= 0:
raise ValueError(
"The number of iterations `max_iter` has to be a positive integer."
)
self.max_iter = int(max_iter)
self._project = False
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in an array.
:param x: An array with the original inputs.
:type x: `np.ndarray`
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Maximum perturbation that the attacker can introduce.
:type eps: `float`
:param eps_step: Attack step size (input variation) at each iteration.
:type eps_step: `float`
:param y: The labels for the data `x`. Only provide this parameter if you'd like to use true
labels when crafting adversarial samples. Otherwise, model predictions are used as labels to avoid the
"label leaking" effect (explained in this paper: https://arxiv.org/abs/1611.01236). Default is `None`.
Labels should be one-hot-encoded.
:type y: `np.ndarray`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
:param batch_size: Batch size
:type batch_size: `int`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
from art.utils import projection
self.set_params(**kwargs)
adv_x = x.copy()
if "y" not in kwargs or kwargs[str("y")] is None:
# Throw error if attack is targeted, but no targets are provided
if self.targeted:
raise ValueError(
"Target labels `y` need to be provided for a targeted attack."
)
# Use model predictions as correct outputs
targets = get_labels_np_array(self._predict(x))
else:
targets = kwargs["y"]
target_labels = np.argmax(targets, axis=1)
for i in range(self.max_iter):
# Adversarial crafting
adv_x = self._compute(
adv_x, targets, self.eps_step, self.random_init and i == 0
)
if self._project:
noise = projection(adv_x - x, self.eps, self.norm)
adv_x = x + noise
adv_preds = np.argmax(self._predict(adv_x), axis=1)
if self.targeted:
rate = np.sum(adv_preds == target_labels) / adv_x.shape[0]
else:
rate = np.sum(adv_preds != target_labels) / adv_x.shape[0]
logger.info("Success rate of BIM attack: %.2f%%", rate)
return adv_x
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in an array.
:param x: An array with the original inputs.
:type x: `np.ndarray`
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Maximum perturbation that the attacker can introduce.
:type eps: `float`
:param eps_step: Attack step size (input variation) at each iteration.
:type eps_step: `float`
:param y: The labels for the data `x`. Only provide this parameter if you'd like to use true
labels when crafting adversarial samples. Otherwise, model predictions are used as labels to avoid the
"label leaking" effect (explained in this paper: https://arxiv.org/abs/1611.01236). Default is `None`.
Labels should be one-hot-encoded.
:type y: `np.ndarray`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
from art.utils import projection
self.set_params(**kwargs)
adv_x = x.copy()
if "y" not in kwargs or kwargs[str("y")] is None:
# Throw error if attack is targeted, but no targets are provided
if self.targeted:
raise ValueError(
"Target labels `y` need to be provided for a targeted attack."
)
# Use model predictions as correct outputs
targets = get_labels_np_array(self.classifier.predict(x))
else:
targets = kwargs["y"]
target_labels = np.argmax(targets, axis=1)
for i in range(self.max_iter):
# Adversarial crafting
adv_x = self._compute(
adv_x, targets, self.eps_step, self.random_init and i == 0
)
if self._project:
noise = projection(adv_x - x, self.eps, self.norm)
adv_x = x + noise
adv_preds = np.argmax(self.classifier.predict(adv_x), axis=1)
if self.targeted:
rate = np.sum(adv_preds == target_labels) / adv_x.shape[0]
else:
rate = np.sum(adv_preds != target_labels) / adv_x.shape[0]
logger.info("Success rate of BIM attack: %.2f%%", rate)
return adv_x
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Maximum perturbation that the attacker can introduce.
:type eps: `float`
:param eps_step: Attack step size (input variation) at each iteration.
:type eps_step: `float`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
:param batch_size: Batch size
:type batch_size: `int`
"""
# Save attack-specific parameters
super(BasicIterativeMethod, self).set_params(**kwargs)
if self.eps_step > self.eps:
raise ValueError(
"The iteration step `eps_step` has to be smaller than the total attack `eps`."
)
if self.max_iter <= 0:
raise ValueError(
"The number of iterations `max_iter` has to be a positive integer."
)
return True
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Maximum perturbation that the attacker can introduce.
:type eps: `float`
:param eps_step: Attack step size (input variation) at each iteration.
:type eps_step: `float`
"""
# Save attack-specific parameters
super(BasicIterativeMethod, self).set_params(**kwargs)
if self.eps_step > self.eps:
raise ValueError(
"The iteration step `eps_step` has to be smaller than the total attack `eps`."
)
if self.max_iter <= 0:
raise ValueError(
"The number of iterations `max_iter` has to be a positive integer."
)
return True
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(
self, classifier, max_iter=1000, eta=0.01, batch_size=128, expectation=None
):
"""
Create a NewtonFool attack instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:param eta: The eta coefficient.
:type eta: `float`
:param batch_size: Batch size
:type batch_size: `int`
:param expectation: An expectation over transformations to be applied when computing
classifier gradients and predictions.
:type expectation: :class:`ExpectationOverTransformations`
"""
super(NewtonFool, self).__init__(classifier)
params = {
"max_iter": max_iter,
"eta": eta,
"batch_size": batch_size,
"expectation": expectation,
}
self.set_params(**params)
|
def __init__(self, classifier, max_iter=1000, eta=0.01, batch_size=128):
"""
Create a NewtonFool attack instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:param eta: The eta coefficient.
:type eta: `float`
:param batch_size: Batch size
:type batch_size: `int`
"""
super(NewtonFool, self).__init__(classifier)
params = {"max_iter": max_iter, "eta": eta, "batch_size": batch_size}
self.set_params(**params)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in a Numpy array.
:param x: An array with the original inputs to be attacked.
:type x: `np.ndarray`
:param kwargs: Attack-specific parameters used by child classes.
:type kwargs: `dict`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
self.set_params(**kwargs)
x_adv = x.copy()
# Initialize variables
clip_min, clip_max = self.classifier.clip_values
y_pred = self._predict(x, logits=False)
pred_class = np.argmax(y_pred, axis=1)
# Compute perturbation with implicit batching
for batch_id in range(int(np.ceil(x_adv.shape[0] / float(self.batch_size)))):
batch_index_1, batch_index_2 = (
batch_id * self.batch_size,
(batch_id + 1) * self.batch_size,
)
batch = x_adv[batch_index_1:batch_index_2]
# Main algorithm for each batch
norm_batch = np.linalg.norm(np.reshape(batch, (batch.shape[0], -1)), axis=1)
l = pred_class[batch_index_1:batch_index_2]
l_b = to_categorical(l, self.classifier.nb_classes).astype(bool)
# Main loop of the algorithm
for _ in range(self.max_iter):
# Compute score
score = self._predict(batch, logits=False)[l_b]
# Compute the gradients and norm
grads = self._class_gradient(batch, label=l, logits=False)
grads = np.squeeze(grads, axis=1)
norm_grad = np.linalg.norm(np.reshape(grads, (batch.shape[0], -1)), axis=1)
# Theta
theta = self._compute_theta(norm_batch, score, norm_grad)
# Pertubation
di_batch = self._compute_pert(theta, grads, norm_grad)
# Update xi and pertubation
batch += di_batch
# Apply clip
x_adv[batch_index_1:batch_index_2] = np.clip(batch, clip_min, clip_max)
preds = np.argmax(self._predict(x), axis=1)
preds_adv = np.argmax(self._predict(x_adv), axis=1)
logger.info(
"Success rate of NewtonFool attack: %.2f%%",
(np.sum(preds != preds_adv) / x.shape[0]),
)
return x_adv
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in a Numpy array.
:param x: An array with the original inputs to be attacked.
:type x: `np.ndarray`
:param kwargs: Attack-specific parameters used by child classes.
:type kwargs: `dict`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
self.set_params(**kwargs)
x_adv = x.copy()
# Initialize variables
clip_min, clip_max = self.classifier.clip_values
y_pred = self.classifier.predict(x, logits=False)
pred_class = np.argmax(y_pred, axis=1)
# Compute perturbation with implicit batching
for batch_id in range(int(np.ceil(x_adv.shape[0] / float(self.batch_size)))):
batch_index_1, batch_index_2 = (
batch_id * self.batch_size,
(batch_id + 1) * self.batch_size,
)
batch = x_adv[batch_index_1:batch_index_2]
# Main algorithm for each batch
norm_batch = np.linalg.norm(np.reshape(batch, (batch.shape[0], -1)), axis=1)
l = pred_class[batch_index_1:batch_index_2]
l_b = to_categorical(l, self.classifier.nb_classes).astype(bool)
# Main loop of the algorithm
for _ in range(self.max_iter):
# Compute score
score = self.classifier.predict(batch, logits=False)[l_b]
# Compute the gradients and norm
grads = self.classifier.class_gradient(batch, label=l, logits=False)
grads = np.squeeze(grads, axis=1)
norm_grad = np.linalg.norm(np.reshape(grads, (batch.shape[0], -1)), axis=1)
# Theta
theta = self._compute_theta(norm_batch, score, norm_grad)
# Pertubation
di_batch = self._compute_pert(theta, grads, norm_grad)
# Update xi and pertubation
batch += di_batch
# Apply clip
x_adv[batch_index_1:batch_index_2] = np.clip(batch, clip_min, clip_max)
preds = np.argmax(self.classifier.predict(x), axis=1)
preds_adv = np.argmax(self.classifier.predict(x_adv), axis=1)
logger.info(
"Success rate of NewtonFool attack: %.2f%%",
(np.sum(preds != preds_adv) / x.shape[0]),
)
return x_adv
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def set_params(self, **kwargs):
"""Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:param eta: The eta coefficient.
:type eta: `float`
:param batch_size: Internal size of batches on which adversarial samples are generated.
:type batch_size: `int`
"""
# Save attack-specific parameters
super(NewtonFool, self).set_params(**kwargs)
if not isinstance(self.max_iter, (int, np.int)) or self.max_iter <= 0:
raise ValueError("The number of iterations must be a positive integer.")
if not isinstance(self.eta, (float, int, np.int)) or self.eta <= 0:
raise ValueError("The eta coefficient must be a positive float.")
if self.batch_size <= 0:
raise ValueError("The batch size `batch_size` has to be positive.")
return True
|
def set_params(self, **kwargs):
"""Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:param eta: The eta coefficient.
:type eta: `float`
"""
# Save attack-specific parameters
super(NewtonFool, self).set_params(**kwargs)
if not isinstance(self.max_iter, (int, np.int)) or self.max_iter <= 0:
raise ValueError("The number of iterations must be a positive integer.")
if not isinstance(self.eta, (float, int, np.int)) or self.eta <= 0:
raise ValueError("The eta coefficient must be a positive float.")
if self.batch_size <= 0:
raise ValueError("The batch size `batch_size` has to be positive.")
return True
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(
self,
classifier,
norm=np.inf,
eps=0.3,
eps_step=0.1,
max_iter=20,
targeted=False,
random_init=False,
batch_size=128,
expectation=None,
):
"""
Create a :class:`ProjectedGradientDescent` instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Maximum perturbation that the attacker can introduce.
:type eps: `float`
:param eps_step: Attack step size (input variation) at each iteration.
:type eps_step: `float`
:param targeted: Should the attack target one specific class
:type targeted: `bool`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
:param batch_size: Batch size
:type batch_size: `int`
:param expectation: An expectation over transformations to be applied when computing
classifier gradients and predictions.
:type expectation: :class:`ExpectationOverTransformations`
"""
super(ProjectedGradientDescent, self).__init__(
classifier,
norm=norm,
eps=eps,
eps_step=eps_step,
max_iter=max_iter,
targeted=targeted,
random_init=random_init,
batch_size=batch_size,
expectation=expectation,
)
self._project = True
|
def __init__(
self,
classifier,
norm=np.inf,
eps=0.3,
eps_step=0.1,
max_iter=20,
targeted=False,
random_init=False,
):
"""
Create a :class:`ProjectedGradientDescent` instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param norm: Order of the norm. Possible values: np.inf, 1 or 2.
:type norm: `int`
:param eps: Maximum perturbation that the attacker can introduce.
:type eps: `float`
:param eps_step: Attack step size (input variation) at each iteration.
:type eps_step: `float`
:param targeted: Should the attack target one specific class
:type targeted: `bool`
:param random_init: Whether to start at the original input or a random point within the epsilon ball
:type random_init: `bool`
"""
super(ProjectedGradientDescent, self).__init__(
classifier,
norm=norm,
eps=eps,
eps_step=eps_step,
max_iter=max_iter,
targeted=targeted,
random_init=random_init,
)
self._project = True
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(self, classifier, theta=0.1, gamma=1.0, batch_size=128, expectation=None):
"""
Create a SaliencyMapMethod instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param theta: Perturbation introduced to each modified feature per step (can be positive or negative).
:type theta: `float`
:param gamma: Maximum percentage of perturbed features (between 0 and 1).
:type gamma: `float`
:param batch_size: Batch size
:type batch_size: `int`
:param expectation: An expectation over transformations to be applied when computing
classifier gradients and predictions.
:type expectation: :class:`ExpectationOverTransformations`
"""
super(SaliencyMapMethod, self).__init__(classifier)
kwargs = {
"theta": theta,
"gamma": gamma,
"batch_size": batch_size,
"expectation": expectation,
}
self.set_params(**kwargs)
|
def __init__(self, classifier, theta=0.1, gamma=1.0):
"""
Create a SaliencyMapMethod instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param theta: Perturbation introduced to each modified feature per step (can be positive or negative).
:type theta: `float`
:param gamma: Maximum percentage of perturbed features (between 0 and 1).
:type gamma: `float`
"""
super(SaliencyMapMethod, self).__init__(classifier)
kwargs = {"theta": theta, "gamma": gamma}
self.set_params(**kwargs)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in an array.
:param x: An array with the original inputs to be attacked.
:type x: `np.ndarray`
:param y: Target values if the attack is targeted
:type y: `np.ndarray`
:param theta: Perturbation introduced to each modified feature per step (can be positive or negative)
:type theta: `float`
:param gamma: Maximum percentage of perturbed features (between 0 and 1)
:type gamma: `float`
:param batch_size: Batch size
:type batch_size: `int`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
# Parse and save attack-specific parameters
self.set_params(**kwargs)
clip_min, clip_max = self.classifier.clip_values
# Initialize variables
dims = list(x.shape[1:])
self._nb_features = np.product(dims)
x_adv = np.reshape(np.copy(x), (-1, self._nb_features))
preds = np.argmax(self._predict(x), axis=1)
# Determine target classes for attack
if "y" not in kwargs or kwargs[str("y")] is None:
# Randomly choose target from the incorrect classes for each sample
from art.utils import random_targets
targets = np.argmax(random_targets(preds, self.classifier.nb_classes), axis=1)
else:
targets = np.argmax(kwargs[str("y")], axis=1)
# Compute perturbation with implicit batching
for batch_id in range(int(np.ceil(x_adv.shape[0] / float(self.batch_size)))):
batch_index_1, batch_index_2 = (
batch_id * self.batch_size,
(batch_id + 1) * self.batch_size,
)
batch = x_adv[batch_index_1:batch_index_2]
# Main algorithm for each batch
# Initialize the search space; optimize to remove features that can't be changed
search_space = np.zeros_like(batch)
if self.theta > 0:
search_space[batch < clip_max] = 1
else:
search_space[batch > clip_min] = 1
# Get current predictions
current_pred = preds[batch_index_1:batch_index_2]
target = targets[batch_index_1:batch_index_2]
active_indices = np.where(current_pred != target)[0]
all_feat = np.zeros_like(batch)
while len(active_indices) != 0:
# Compute saliency map
feat_ind = self._saliency_map(
np.reshape(batch, [batch.shape[0]] + dims)[active_indices],
target[active_indices],
search_space[active_indices],
)
# Update used features
all_feat[active_indices][np.arange(len(active_indices)), feat_ind[:, 0]] = 1
all_feat[active_indices][np.arange(len(active_indices)), feat_ind[:, 1]] = 1
# Prepare update depending of theta
if self.theta > 0:
clip_func, clip_value = np.minimum, clip_max
else:
clip_func, clip_value = np.maximum, clip_min
# Update adversarial examples
tmp_batch = batch[active_indices]
tmp_batch[np.arange(len(active_indices)), feat_ind[:, 0]] = clip_func(
clip_value,
tmp_batch[np.arange(len(active_indices)), feat_ind[:, 0]] + self.theta,
)
tmp_batch[np.arange(len(active_indices)), feat_ind[:, 1]] = clip_func(
clip_value,
tmp_batch[np.arange(len(active_indices)), feat_ind[:, 1]] + self.theta,
)
batch[active_indices] = tmp_batch
# Remove indices from search space if max/min values were reached
search_space[batch == clip_value] = 0
# Recompute model prediction
current_pred = np.argmax(
self._predict(np.reshape(batch, [batch.shape[0]] + dims)), axis=1
)
# Update active_indices
active_indices = np.where(
(current_pred != target)
* (np.sum(all_feat, axis=1) / self._nb_features <= self.gamma)
* (np.sum(search_space, axis=1) > 0)
)[0]
x_adv[batch_index_1:batch_index_2] = batch
x_adv = np.reshape(x_adv, x.shape)
preds = np.argmax(self._predict(x), axis=1)
preds_adv = np.argmax(self._predict(x_adv), axis=1)
logger.info(
"Success rate of JSMA attack: %.2f%%", (np.sum(preds != preds_adv) / x.shape[0])
)
return x_adv
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in an array.
:param x: An array with the original inputs to be attacked.
:type x: `np.ndarray`
:param y: Target values if the attack is targeted
:type y: `np.ndarray`
:param theta: Perturbation introduced to each modified feature per step (can be positive or negative)
:type theta: `float`
:param gamma: Maximum percentage of perturbed features (between 0 and 1)
:type gamma: `float`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
# Parse and save attack-specific parameters
self.set_params(**kwargs)
clip_min, clip_max = self.classifier.clip_values
# Initialize variables
dims = [1] + list(x.shape[1:])
self._nb_features = np.product(dims)
x_adv = np.reshape(np.copy(x), (-1, self._nb_features))
preds = np.argmax(self.classifier.predict(x), axis=1)
# Determine target classes for attack
if "y" not in kwargs or kwargs[str("y")] is None:
# Randomly choose target from the incorrect classes for each sample
from art.utils import random_targets
targets = np.argmax(random_targets(preds, self.classifier.nb_classes), axis=1)
else:
targets = np.argmax(kwargs[str("y")], axis=1)
# Generate the adversarial samples
for ind, val in enumerate(x_adv):
# Initialize the search space; optimize to remove features that can't be changed
if self.theta > 0:
search_space = {i for i in range(self._nb_features) if val[i] < clip_max}
else:
search_space = {i for i in range(self._nb_features) if val[i] > clip_min}
current_pred = preds[ind]
target = targets[ind]
all_feat = set()
while (
current_pred != target
and len(all_feat) / self._nb_features <= self.gamma
and bool(search_space)
):
# Compute saliency map
feat1, feat2 = self._saliency_map(
np.reshape(val, dims), target, search_space
)
# Move on to next examples if there are no more features to change
if feat1 == feat2 == 0:
break
all_feat = all_feat.union(set([feat1, feat2]))
# Prepare update depending of theta
if self.theta > 0:
clip_func, clip_value = np.minimum, clip_max
else:
clip_func, clip_value = np.maximum, clip_min
# Update adversarial example
for feature_ind in [feat1, feat2]:
val[feature_ind] = clip_func(clip_value, val[feature_ind] + self.theta)
# Remove indices from search space if max/min values were reached
if val[feature_ind] == clip_value:
search_space.discard(feature_ind)
# Recompute model prediction
current_pred = np.argmax(
self.classifier.predict(np.reshape(val, dims)), axis=1
)
x_adv = np.reshape(x_adv, x.shape)
preds = np.argmax(self.classifier.predict(x), axis=1)
preds_adv = np.argmax(self.classifier.predict(x_adv), axis=1)
logger.info(
"Success rate of JSMA attack: %.2f%%", (np.sum(preds != preds_adv) / x.shape[0])
)
return x_adv
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param theta: Perturbation introduced to each modified feature per step (can be positive or negative)
:type theta: `float`
:param gamma: Maximum percentage of perturbed features (between 0 and 1)
:type gamma: `float`
:param batch_size: Internal size of batches on which adversarial samples are generated.
:type batch_size: `int`
"""
# Save attack-specific parameters
super(SaliencyMapMethod, self).set_params(**kwargs)
if self.gamma <= 0 or self.gamma > 1:
raise ValueError(
"The total perturbation percentage `gamma` must be between 0 and 1."
)
if self.batch_size <= 0:
raise ValueError("The batch size `batch_size` has to be positive.")
return True
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param theta: Perturbation introduced to each modified feature per step (can be positive or negative)
:type theta: `float`
:param gamma: Maximum percentage of perturbed features (between 0 and 1)
:type gamma: `float`
"""
# Save attack-specific parameters
super(SaliencyMapMethod, self).set_params(**kwargs)
if self.gamma <= 0 or self.gamma > 1:
raise ValueError(
"The total perturbation percentage `gamma` must be between 0 and 1."
)
return True
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _saliency_map(self, x, target, search_space):
"""
Compute the saliency map of `x`. Return the top 2 coefficients in `search_space` that maximize / minimize
the saliency map.
:param x: A batch of input samples
:type x: `np.ndarray`
:param target: Target class for `x`
:type target: `np.ndarray`
:param search_space: The set of valid pairs of feature indices to search
:type search_space: `np.ndarray`
:return: The top 2 coefficients in `search_space` that maximize / minimize the saliency map
:rtype: `np.ndarray`
"""
grads = self._class_gradient(x, label=target, logits=False)
grads = np.reshape(grads, (-1, self._nb_features))
# Remove gradients for already used features
used_features = 1 - search_space
coeff = 2 * int(self.theta > 0) - 1
grads[used_features == 1] = -np.inf * coeff
if self.theta > 0:
ind = np.argpartition(grads, -2, axis=1)[:, -2:]
else:
ind = np.argpartition(-grads, -2, axis=1)[:, -2:]
return ind
|
def _saliency_map(self, x, target, search_space):
"""
Compute the saliency map of `x`. Return the top 2 coefficients in `search_space` that maximize / minimize
the saliency map.
:param x: One input sample
:type x: `np.ndarray`
:param target: Target class for `x`
:type target: `int`
:param search_space: The set of valid pairs of feature indices to search
:type search_space: `set(tuple)`
:return: The top 2 coefficients in `search_space` that maximize / minimize the saliency map
:rtype: `tuple`
"""
grads = self.classifier.class_gradient(x, label=target, logits=False)
grads = np.reshape(grads, (-1, self._nb_features))[0]
# Remove gradients for already used features
used_features = list(set(range(self._nb_features)) - search_space)
coeff = 2 * int(self.theta > 0) - 1
grads[used_features] = -np.inf * coeff
if self.theta > 0:
ind = np.argpartition(grads, -2)[-2:]
else:
ind = np.argpartition(-grads, -2)[-2:]
return tuple(ind)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(
self,
classifier,
attacker="deepfool",
attacker_params=None,
delta=0.2,
max_iter=20,
eps=10.0,
norm=np.inf,
expectation=None,
):
"""
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param attacker: Adversarial attack name. Default is 'deepfool'. Supported names: 'carlini', 'carlini_inf',
'deepfool', 'fgsm', 'bim', 'pgd', 'margin', 'ead', 'newtonfool', 'jsma', 'vat'.
:type attacker: `str`
:param attacker_params: Parameters specific to the adversarial attack.
:type attacker_params: `dict`
:param delta: desired accuracy
:type delta: `float`
:param max_iter: The maximum number of iterations for computing universal perturbation.
:type max_iter: `int`
:param eps: Attack step size (input variation)
:type eps: `float`
:param norm: Order of the norm. Possible values: np.inf, 2 (default is np.inf)
:type norm: `int`
:param expectation: An expectation over transformations to be applied when computing
classifier gradients and predictions.
:type expectation: :class:`ExpectationOverTransformations`
"""
super(UniversalPerturbation, self).__init__(classifier)
kwargs = {
"attacker": attacker,
"attacker_params": attacker_params,
"delta": delta,
"max_iter": max_iter,
"eps": eps,
"norm": norm,
"expectation": expectation,
}
self.set_params(**kwargs)
|
def __init__(
self,
classifier,
attacker="deepfool",
attacker_params=None,
delta=0.2,
max_iter=20,
eps=10.0,
norm=np.inf,
):
"""
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param attacker: Adversarial attack name. Default is 'deepfool'. Supported names: 'carlini', 'deepfool', 'fgsm',
'newtonfool', 'jsma', 'vat'.
:type attacker: `str`
:param attacker_params: Parameters specific to the adversarial attack.
:type attacker_params: `dict`
:param delta: desired accuracy
:type delta: `float`
:param max_iter: The maximum number of iterations for computing universal perturbation.
:type max_iter: `int`
:param eps: Attack step size (input variation)
:type eps: `float`
:param norm: Order of the norm. Possible values: np.inf, 2 (default is np.inf)
:type norm: `int`
"""
super(UniversalPerturbation, self).__init__(classifier)
kwargs = {
"attacker": attacker,
"attacker_params": attacker_params,
"delta": delta,
"max_iter": max_iter,
"eps": eps,
"norm": norm,
}
self.set_params(**kwargs)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in an array.
:param x: An array with the original inputs.
:type x: `np.ndarray`
:param attacker: Adversarial attack name. Default is 'deepfool'. Supported names: 'carlini', 'deepfool', 'fgsm',
'newtonfool', 'jsma', 'vat'.
:type attacker: `str`
:param attacker_params: Parameters specific to the adversarial attack.
:type attacker_params: `dict`
:param delta: desired accuracy
:type delta: `float`
:param max_iter: The maximum number of iterations for computing universal perturbation.
:type max_iter: `int`
:param eps: Attack step size (input variation)
:type eps: `float`
:param norm: Order of the norm. Possible values: np.inf, 1 and 2 (default is np.inf).
:type norm: `int`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
logger.info("Computing universal perturbation based on %s attack.", self.attacker)
self.set_params(**kwargs)
# Init universal perturbation
v = 0
fooling_rate = 0.0
nb_instances = len(x)
# Instantiate the middle attacker and get the predicted labels
attacker = self._get_attack(self.attacker, self.attacker_params)
pred_y = self._predict(x, logits=False)
pred_y_max = np.argmax(pred_y, axis=1)
# Start to generate the adversarial examples
nb_iter = 0
while fooling_rate < 1.0 - self.delta and nb_iter < self.max_iter:
# Go through all the examples randomly
rnd_idx = random.sample(range(nb_instances), nb_instances)
# Go through the data set and compute the perturbation increments sequentially
for j, ex in enumerate(x[rnd_idx]):
xi = ex[None, ...]
current_label = np.argmax(self._predict(xi + v, logits=True)[0])
original_label = np.argmax(pred_y[rnd_idx][j])
if current_label == original_label:
# Compute adversarial perturbation
adv_xi = attacker.generate(xi + v)
new_label = np.argmax(self._predict(adv_xi, logits=True)[0])
# If the class has changed, update v
if current_label != new_label:
v = adv_xi - xi
# Project on L_p ball
v = projection(v, self.eps, self.norm)
nb_iter += 1
# Compute the error rate
adv_x = x + v
adv_y = np.argmax(self._predict(adv_x, logits=False), axis=1)
fooling_rate = np.sum(pred_y_max != adv_y) / nb_instances
self.fooling_rate = fooling_rate
self.converged = nb_iter < self.max_iter
self.v = v
logger.info("Success rate of universal perturbation attack: %.2f%%", fooling_rate)
return adv_x
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in an array.
:param x: An array with the original inputs.
:type x: `np.ndarray`
:param attacker: Adversarial attack name. Default is 'deepfool'. Supported names: 'carlini', 'deepfool', 'fgsm',
'newtonfool', 'jsma', 'vat'.
:type attacker: `str`
:param attacker_params: Parameters specific to the adversarial attack.
:type attacker_params: `dict`
:param delta: desired accuracy
:type delta: `float`
:param max_iter: The maximum number of iterations for computing universal perturbation.
:type max_iter: `int`
:param eps: Attack step size (input variation)
:type eps: `float`
:param norm: Order of the norm. Possible values: np.inf, 1 and 2 (default is np.inf).
:type norm: `int`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
logger.info("Computing universal perturbation based on %s attack.", self.attacker)
self.set_params(**kwargs)
# Init universal perturbation
v = 0
fooling_rate = 0.0
nb_instances = len(x)
# Instantiate the middle attacker and get the predicted labels
attacker = self._get_attack(self.attacker, self.attacker_params)
pred_y = self.classifier.predict(x, logits=False)
pred_y_max = np.argmax(pred_y, axis=1)
# Start to generate the adversarial examples
nb_iter = 0
while fooling_rate < 1.0 - self.delta and nb_iter < self.max_iter:
# Go through all the examples randomly
rnd_idx = random.sample(range(nb_instances), nb_instances)
# Go through the data set and compute the perturbation increments sequentially
for j, ex in enumerate(x[rnd_idx]):
xi = ex[None, ...]
f_xi = self.classifier.predict(xi + v, logits=True)
fk_i_hat = np.argmax(f_xi[0])
fk_hat = np.argmax(pred_y[rnd_idx][j])
if fk_i_hat == fk_hat:
# Compute adversarial perturbation
adv_xi = attacker.generate(xi + v)
adv_f_xi = self.classifier.predict(adv_xi, logits=True)
adv_fk_i_hat = np.argmax(adv_f_xi[0])
# If the class has changed, update v
if fk_i_hat != adv_fk_i_hat:
v += adv_xi - xi
# Project on L_p ball
v = projection(v, self.eps, self.norm)
nb_iter += 1
# Compute the error rate
adv_x = x + v
adv_y = np.argmax(self.classifier.predict(adv_x, logits=False))
fooling_rate = np.sum(pred_y_max != adv_y) / nb_instances
self.fooling_rate = fooling_rate
self.converged = nb_iter < self.max_iter
self.v = v
logger.info("Success rate of universal perturbation attack: %.2f%%", fooling_rate)
return adv_x
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(
self,
classifier,
max_iter=1,
finite_diff=1e-6,
eps=0.1,
batch_size=128,
expectation=None,
):
"""
Create a VirtualAdversarialMethod instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param eps: Attack step (max input variation).
:type eps: `float`
:param finite_diff: The finite difference parameter.
:type finite_diff: `float`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:param batch_size: Batch size
:type batch_size: `int`
:param expectation: An expectation over transformations to be applied when computing
classifier gradients and predictions.
:type expectation: :class:`ExpectationOverTransformations`
"""
super(VirtualAdversarialMethod, self).__init__(classifier)
kwargs = {
"finite_diff": finite_diff,
"eps": eps,
"max_iter": max_iter,
"batch_size": batch_size,
"expectation": expectation,
}
self.set_params(**kwargs)
|
def __init__(self, classifier, max_iter=1, finite_diff=1e-6, eps=0.1):
"""
Create a VirtualAdversarialMethod instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param eps: Attack step (max input variation).
:type eps: `float`
:param finite_diff: The finite difference parameter.
:type finite_diff: `float`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
"""
super(VirtualAdversarialMethod, self).__init__(classifier)
kwargs = {"finite_diff": finite_diff, "eps": eps, "max_iter": max_iter}
self.set_params(**kwargs)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in an array.
:param x: An array with the original inputs to be attacked.
:type x: `np.ndarray`
:param eps: Attack step (max input variation).
:type eps: `float`
:param finite_diff: The finite difference parameter.
:type finite_diff: `float`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
# Parse and save attack-specific parameters
assert self.set_params(**kwargs)
clip_min, clip_max = self.classifier.clip_values
x_adv = np.copy(x)
dims = list(x.shape[1:])
preds = self._predict(x_adv, logits=False)
# Pick a small scalar to avoid division by 0
tol = 1e-10
# Compute perturbation with implicit batching
for batch_id in range(int(np.ceil(x_adv.shape[0] / float(self.batch_size)))):
batch_index_1, batch_index_2 = (
batch_id * self.batch_size,
(batch_id + 1) * self.batch_size,
)
batch = x_adv[batch_index_1:batch_index_2]
# Main algorithm for each batch
d = np.random.randn(*batch.shape)
# Main loop of the algorithm
for _ in range(self.max_iter):
d = self._normalize(d)
preds_new = self._predict(batch + d, logits=False)
from scipy.stats import entropy
kl_div1 = entropy(
np.transpose(preds[batch_index_1:batch_index_2]),
np.transpose(preds_new),
)
d_new = np.zeros_like(d)
for w in range(d.shape[1]):
for h in range(d.shape[2]):
for c in range(d.shape[3]):
d[:, w, h, c] += self.finite_diff
preds_new = self._predict(batch + d, logits=False)
kl_div2 = entropy(
np.transpose(preds[batch_index_1:batch_index_2]),
np.transpose(preds_new),
)
d_new[:, w, h, c] = (kl_div2 - kl_div1) / (
self.finite_diff + tol
)
d[:, w, h, c] -= self.finite_diff
d = d_new
# Apply perturbation and clip
x_adv[batch_index_1:batch_index_2] = np.clip(
batch + self.eps * self._normalize(d), clip_min, clip_max
)
return x_adv
|
def generate(self, x, **kwargs):
"""
Generate adversarial samples and return them in an array.
:param x: An array with the original inputs to be attacked.
:type x: `np.ndarray`
:param eps: Attack step (max input variation).
:type eps: `float`
:param finite_diff: The finite difference parameter.
:type finite_diff: `float`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
# TODO Consider computing attack for a batch of samples at a time (no for loop)
# Parse and save attack-specific parameters
assert self.set_params(**kwargs)
clip_min, clip_max = self.classifier.clip_values
x_adv = np.copy(x)
dims = list(x.shape[1:])
preds = self.classifier.predict(x_adv, logits=False)
tol = 1e-10
for ind, val in enumerate(x_adv):
d = np.random.randn(*dims)
for _ in range(self.max_iter):
d = self._normalize(d)
preds_new = self.classifier.predict((val + d)[None, ...], logits=False)
from scipy.stats import entropy
kl_div1 = entropy(preds[ind], preds_new[0])
# TODO remove for loop
d_new = np.zeros_like(d)
array_iter = np.nditer(d, op_flags=["readwrite"], flags=["multi_index"])
for x in array_iter:
x[...] += self.finite_diff
preds_new = self.classifier.predict((val + d)[None, ...], logits=False)
kl_div2 = entropy(preds[ind], preds_new[0])
d_new[array_iter.multi_index] = (kl_div2 - kl_div1) / (
self.finite_diff + tol
)
x[...] -= self.finite_diff
d = d_new
# Apply perturbation and clip
val = np.clip(val + self.eps * self._normalize(d), clip_min, clip_max)
x_adv[ind] = val
return x_adv
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _normalize(x):
"""
Apply L_2 batch normalization on `x`.
:param x: The input array batch to normalize.
:type x: `np.ndarray`
:return: The normalized version of `x`.
:rtype: `np.ndarray`
"""
tol = 1e-10
dims = x.shape
x = x.reshape(dims[0], -1)
inverse = (np.sum(x**2, axis=1) + tol) ** -0.5
x = x * inverse[:, None]
x = np.reshape(x, dims)
return x
|
def _normalize(x):
"""
Apply L_2 batch normalization on `x`.
:param x: The input array to normalize.
:type x: `np.ndarray`
:return: The normalized version of `x`.
:rtype: `np.ndarray`
"""
tol = 1e-10
dims = x.shape
x = x.flatten()
inverse = (np.sum(x**2) + tol) ** -0.5
x = x * inverse
x = np.reshape(x, dims)
return x
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param eps: Attack step (max input variation).
:type eps: `float`
:param finite_diff: The finite difference parameter.
:type finite_diff: `float`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
:param batch_size: Internal size of batches on which adversarial samples are generated.
:type batch_size: `int`
"""
# Save attack-specific parameters
super(VirtualAdversarialMethod, self).set_params(**kwargs)
if not isinstance(self.max_iter, (int, np.int)) or self.max_iter <= 0:
raise ValueError("The number of iterations must be a positive integer.")
if self.eps <= 0:
raise ValueError("The attack step must be positive.")
if not isinstance(self.finite_diff, float) or self.finite_diff <= 0:
raise ValueError("The finite difference parameter must be a positive float.")
if self.batch_size <= 0:
raise ValueError("The batch size `batch_size` has to be positive.")
return True
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param eps: Attack step (max input variation).
:type eps: `float`
:param finite_diff: The finite difference parameter.
:type finite_diff: `float`
:param max_iter: The maximum number of iterations.
:type max_iter: `int`
"""
# Save attack-specific parameters
super(VirtualAdversarialMethod, self).set_params(**kwargs)
return True
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def predict(self, x, logits=False, batch_size=128):
"""
Perform prediction for a batch of inputs.
:param x: Test set.
:type x: `np.ndarray`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:param batch_size: Size of batches.
:type batch_size: `int`
:return: Array of predictions of shape `(nb_inputs, self.nb_classes)`.
:rtype: `np.ndarray`
"""
# Apply defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Run predictions with batching
preds = np.zeros((x_.shape[0], self.nb_classes), dtype=np.float32)
for b in range(int(np.ceil(x_.shape[0] / float(batch_size)))):
begin, end = b * batch_size, min((b + 1) * batch_size, x_.shape[0])
preds[begin:end] = self._preds([x_[begin:end]])[0]
if not logits and not self._custom_activation:
exp = np.exp(
preds[begin:end] - np.max(preds[begin:end], axis=1, keepdims=True)
)
preds[begin:end] = exp / np.sum(exp, axis=1, keepdims=True)
return preds
|
def predict(self, x, logits=False, batch_size=128):
"""
Perform prediction for a batch of inputs.
:param x: Test set.
:type x: `np.ndarray`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:param batch_size: Size of batches.
:type batch_size: `int`
:return: Array of predictions of shape `(nb_inputs, self.nb_classes)`.
:rtype: `np.ndarray`
"""
import keras.backend as k
k.set_learning_phase(0)
# Apply defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Run predictions with batching
preds = np.zeros((x_.shape[0], self.nb_classes), dtype=np.float32)
for b in range(int(np.ceil(x_.shape[0] / float(batch_size)))):
begin, end = b * batch_size, min((b + 1) * batch_size, x_.shape[0])
preds[begin:end] = self._preds([x_[begin:end]])[0]
if not logits and not self._custom_activation:
exp = np.exp(
preds[begin:end] - np.max(preds[begin:end], axis=1, keepdims=True)
)
preds[begin:end] = exp / np.sum(exp, axis=1, keepdims=True)
return preds
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit(self, x, y, batch_size=128, nb_epochs=20):
"""
Fit the classifier on the training set `(x, y)`.
:param x: Training data.
:type x: `np.ndarray`
:param y: Labels, one-vs-rest encoding.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
# Apply preprocessing and defences
x_ = self._apply_processing(x)
x_, y_ = self._apply_defences_fit(x_, y)
gen = generator_fit(x_, y_, batch_size)
self._model.fit_generator(
gen, steps_per_epoch=x_.shape[0] / batch_size, epochs=nb_epochs
)
|
def fit(self, x, y, batch_size=128, nb_epochs=20):
"""
Fit the classifier on the training set `(x, y)`.
:param x: Training data.
:type x: `np.ndarray`
:param y: Labels, one-vs-rest encoding.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
import keras.backend as k
k.set_learning_phase(1)
# Apply preprocessing and defences
x_ = self._apply_processing(x)
x_, y_ = self._apply_defences_fit(x_, y)
gen = generator_fit(x_, y_, batch_size)
self._model.fit_generator(
gen, steps_per_epoch=x_.shape[0] / batch_size, epochs=nb_epochs
)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit_generator(self, generator, nb_epochs=20):
"""
Fit the classifier using the generator that yields batches as specified.
:param generator: Batch generator providing `(x, y)` for each epoch. If the generator can be used for native
training in Keras, it will.
:type generator: `DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
from art.data_generators import KerasDataGenerator
# Try to use the generator as a Keras native generator, otherwise use it through the `DataGenerator` interface
# TODO Testing for preprocessing defenses is currently hardcoded; this should be improved (add property)
if isinstance(generator, KerasDataGenerator) and not (
hasattr(self, "label_smooth") or hasattr(self, "feature_squeeze")
):
try:
self._model.fit_generator(generator.generator, epochs=nb_epochs)
except ValueError:
logger.info(
"Unable to use data generator as Keras generator. Now treating as framework-independent."
)
super(KerasClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
else:
super(KerasClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
|
def fit_generator(self, generator, nb_epochs=20):
"""
Fit the classifier using the generator that yields batches as specified.
:param generator: Batch generator providing `(x, y)` for each epoch. If the generator can be used for native
training in Keras, it will.
:type generator: `DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
import keras.backend as k
from art.data_generators import KerasDataGenerator
k.set_learning_phase(1)
# Try to use the generator as a Keras native generator, otherwise use it through the `DataGenerator` interface
# TODO Testing for preprocessing defenses is currently hardcoded; this should be improved (add property)
if isinstance(generator, KerasDataGenerator) and not (
hasattr(self, "label_smooth") or hasattr(self, "feature_squeeze")
):
try:
self._model.fit_generator(generator.generator, epochs=nb_epochs)
except ValueError:
logger.info(
"Unable to use data generator as Keras generator. Now treating as framework-independent."
)
super(KerasClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
else:
super(KerasClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def get_activations(self, x, layer):
"""
Return the output of the specified layer for input `x`. `layer` is specified by layer index (between 0 and
`nb_layers - 1`) or by name. The number of layers can be determined by counting the results returned by
calling `layer_names`.
:param x: Input for computing the activations.
:type x: `np.ndarray`
:param layer: Layer for computing the activations
:type layer: `int` or `str`
:return: The output of `layer`, where the first dimension is the batch size corresponding to `x`.
:rtype: `np.ndarray`
"""
import keras.backend as k
if isinstance(layer, six.string_types):
if layer not in self._layer_names:
raise ValueError("Layer name %s is not part of the graph." % layer)
layer_name = layer
elif isinstance(layer, int):
if layer < 0 or layer >= len(self._layer_names):
raise ValueError(
"Layer index %d is outside of range (0 to %d included)."
% (layer, len(self._layer_names) - 1)
)
layer_name = self._layer_names[layer]
else:
raise TypeError("Layer must be of type `str` or `int`.")
layer_output = self._model.get_layer(layer_name).output
output_func = k.function([self._input], [layer_output])
# Apply preprocessing and defences
if x.shape == self.input_shape:
x_ = np.expand_dims(x, 0)
else:
x_ = x
x_ = self._apply_processing(x_)
x_ = self._apply_defences_predict(x_)
return output_func([x_])[0]
|
def get_activations(self, x, layer):
"""
Return the output of the specified layer for input `x`. `layer` is specified by layer index (between 0 and
`nb_layers - 1`) or by name. The number of layers can be determined by counting the results returned by
calling `layer_names`.
:param x: Input for computing the activations.
:type x: `np.ndarray`
:param layer: Layer for computing the activations
:type layer: `int` or `str`
:return: The output of `layer`, where the first dimension is the batch size corresponding to `x`.
:rtype: `np.ndarray`
"""
import keras.backend as k
k.set_learning_phase(0)
if isinstance(layer, six.string_types):
if layer not in self._layer_names:
raise ValueError("Layer name %s is not part of the graph." % layer)
layer_name = layer
elif isinstance(layer, int):
if layer < 0 or layer >= len(self._layer_names):
raise ValueError(
"Layer index %d is outside of range (0 to %d included)."
% (layer, len(self._layer_names) - 1)
)
layer_name = self._layer_names[layer]
else:
raise TypeError("Layer must be of type `str` or `int`.")
layer_output = self._model.get_layer(layer_name).output
output_func = k.function([self._input], [layer_output])
# Apply preprocessing and defences
if x.shape == self.input_shape:
x_ = np.expand_dims(x, 0)
else:
x_ = x
x_ = self._apply_processing(x_)
x_ = self._apply_defences_predict(x_)
return output_func([x_])[0]
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _init_class_grads(self, label=None, logits=False):
import keras.backend as k
if len(self._output.shape) == 2:
nb_outputs = self._output.shape[1]
else:
raise ValueError("Unexpected output shape for classification in Keras model.")
if label is None:
logger.debug("Computing class gradients for all %i classes.", self.nb_classes)
if logits:
if not hasattr(self, "_class_grads_logits"):
class_grads_logits = [
k.gradients(self._preds_op[:, i], self._input)[0]
for i in range(nb_outputs)
]
self._class_grads_logits = k.function([self._input], class_grads_logits)
else:
if not hasattr(self, "_class_grads"):
class_grads = [
k.gradients(k.softmax(self._preds_op)[:, i], self._input)[0]
for i in range(nb_outputs)
]
self._class_grads = k.function([self._input], class_grads)
else:
if isinstance(label, int):
unique_labels = [label]
logger.debug("Computing class gradients for class %i.", label)
else:
unique_labels = np.unique(label)
logger.debug(
"Computing class gradients for classes %s.", str(unique_labels)
)
if logits:
if not hasattr(self, "_class_grads_logits_idx"):
self._class_grads_logits_idx = [None for _ in range(nb_outputs)]
for l in unique_labels:
if self._class_grads_logits_idx[l] is None:
class_grads_logits = [
k.gradients(self._preds_op[:, l], self._input)[0]
]
self._class_grads_logits_idx[l] = k.function(
[self._input], class_grads_logits
)
else:
if not hasattr(self, "_class_grads_idx"):
self._class_grads_idx = [None for _ in range(nb_outputs)]
for l in unique_labels:
if self._class_grads_idx[l] is None:
class_grads = [
k.gradients(k.softmax(self._preds_op)[:, l], self._input)[0]
]
self._class_grads_idx[l] = k.function([self._input], class_grads)
|
def _init_class_grads(self, label=None, logits=False):
import keras.backend as k
k.set_learning_phase(0)
if len(self._output.shape) == 2:
nb_outputs = self._output.shape[1]
else:
raise ValueError("Unexpected output shape for classification in Keras model.")
if label is None:
logger.debug("Computing class gradients for all %i classes.", self.nb_classes)
if logits:
if not hasattr(self, "_class_grads_logits"):
class_grads_logits = [
k.gradients(self._preds_op[:, i], self._input)[0]
for i in range(nb_outputs)
]
self._class_grads_logits = k.function([self._input], class_grads_logits)
else:
if not hasattr(self, "_class_grads"):
class_grads = [
k.gradients(k.softmax(self._preds_op)[:, i], self._input)[0]
for i in range(nb_outputs)
]
self._class_grads = k.function([self._input], class_grads)
else:
if isinstance(label, int):
unique_labels = [label]
logger.debug("Computing class gradients for class %i.", label)
else:
unique_labels = np.unique(label)
logger.debug(
"Computing class gradients for classes %s.", str(unique_labels)
)
if logits:
if not hasattr(self, "_class_grads_logits_idx"):
self._class_grads_logits_idx = [None for _ in range(nb_outputs)]
for l in unique_labels:
if self._class_grads_logits_idx[l] is None:
class_grads_logits = [
k.gradients(self._preds_op[:, l], self._input)[0]
]
self._class_grads_logits_idx[l] = k.function(
[self._input], class_grads_logits
)
else:
if not hasattr(self, "_class_grads_idx"):
self._class_grads_idx = [None for _ in range(nb_outputs)]
for l in unique_labels:
if self._class_grads_idx[l] is None:
class_grads = [
k.gradients(k.softmax(self._preds_op)[:, l], self._input)[0]
]
self._class_grads_idx[l] = k.function([self._input], class_grads)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit(self, x, y, batch_size=128, nb_epochs=20):
"""
Fit the classifier on the training set `(inputs, outputs)`.
:param x: Training data.
:type x: `np.ndarray`
:param y: Labels, one-vs-rest encoding.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
if self._optimizer is None:
raise ValueError("An MXNet optimizer is required for fitting the model.")
from mxnet import autograd, nd
train_mode = self._learning_phase if hasattr(self, "_learning_phase") else True
# Apply preprocessing and defences
x_ = self._apply_processing(x)
x_, y_ = self._apply_defences_fit(x_, y)
y_ = np.argmax(y_, axis=1)
nb_batch = int(np.ceil(len(x_) / batch_size))
ind = np.arange(len(x_))
for _ in range(nb_epochs):
# Shuffle the examples
np.random.shuffle(ind)
# Train for one epoch
for m in range(nb_batch):
x_batch = nd.array(
x_[ind[m * batch_size : (m + 1) * batch_size]]
).as_in_context(self._ctx)
y_batch = nd.array(
y_[ind[m * batch_size : (m + 1) * batch_size]]
).as_in_context(self._ctx)
with autograd.record(train_mode=train_mode):
preds = self._model(x_batch)
loss = nd.softmax_cross_entropy(preds, y_batch)
loss.backward()
# Update parameters
self._optimizer.step(batch_size)
|
def fit(self, x, y, batch_size=128, nb_epochs=20):
"""
Fit the classifier on the training set `(inputs, outputs)`.
:param x: Training data.
:type x: `np.ndarray`
:param y: Labels, one-vs-rest encoding.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
if self._optimizer is None:
raise ValueError("An MXNet optimizer is required for fitting the model.")
from mxnet import autograd, nd
# Apply preprocessing and defences
x_ = self._apply_processing(x)
x_, y_ = self._apply_defences_fit(x_, y)
y_ = np.argmax(y_, axis=1)
nb_batch = int(np.ceil(len(x_) / batch_size))
ind = np.arange(len(x_))
for _ in range(nb_epochs):
# Shuffle the examples
np.random.shuffle(ind)
# Train for one epoch
for m in range(nb_batch):
x_batch = nd.array(
x_[ind[m * batch_size : (m + 1) * batch_size]]
).as_in_context(self._ctx)
y_batch = nd.array(
y_[ind[m * batch_size : (m + 1) * batch_size]]
).as_in_context(self._ctx)
with autograd.record(train_mode=True):
preds = self._model(x_batch)
loss = nd.softmax_cross_entropy(preds, y_batch)
loss.backward()
# Update parameters
self._optimizer.step(batch_size)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit_generator(self, generator, nb_epochs=20):
"""
Fit the classifier using the generator that yields batches as specified.
:param generator: Batch generator providing `(x, y)` for each epoch.
:type generator: `DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
from mxnet import autograd, nd
from art.data_generators import MXDataGenerator
train_mode = self._learning_phase if hasattr(self, "_learning_phase") else True
if isinstance(generator, MXDataGenerator) and not (
hasattr(self, "label_smooth") or hasattr(self, "feature_squeeze")
):
# Train directly in MXNet
for _ in range(nb_epochs):
for x_batch, y_batch in generator.data_loader:
x_batch = nd.array(x_batch).as_in_context(self._ctx)
y_batch = np.argmax(y_batch, axis=1)
y_batch = nd.array(y_batch).as_in_context(self._ctx)
with autograd.record(train_mode=train_mode):
preds = self._model(x_batch)
loss = nd.softmax_cross_entropy(preds, y_batch)
loss.backward()
# Update parameters
self._optimizer.step(x_batch.shape[0])
else:
# Fit a generic data generator through the API
super(MXClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
|
def fit_generator(self, generator, nb_epochs=20):
"""
Fit the classifier using the generator that yields batches as specified.
:param generator: Batch generator providing `(x, y)` for each epoch.
:type generator: `DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
from mxnet import autograd, nd
from art.data_generators import MXDataGenerator
if isinstance(generator, MXDataGenerator) and not (
hasattr(self, "label_smooth") or hasattr(self, "feature_squeeze")
):
# Train directly in MXNet
for _ in range(nb_epochs):
for x_batch, y_batch in generator.data_loader:
x_batch = nd.array(x_batch).as_in_context(self._ctx)
y_batch = np.argmax(y_batch, axis=1)
y_batch = nd.array(y_batch).as_in_context(self._ctx)
with autograd.record(train_mode=True):
preds = self._model(x_batch)
loss = nd.softmax_cross_entropy(preds, y_batch)
loss.backward()
# Update parameters
self._optimizer.step(x_batch.shape[0])
else:
# Fit a generic data generator through the API
super(MXClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def predict(self, x, logits=False, batch_size=128):
"""
Perform prediction for a batch of inputs.
:param x: Test set.
:type x: `np.ndarray`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:param batch_size: Size of batches.
:type batch_size: `int`
:return: Array of predictions of shape `(nb_inputs, self.nb_classes)`.
:rtype: `np.ndarray`
"""
from mxnet import autograd, nd
train_mode = self._learning_phase if hasattr(self, "_learning_phase") else False
# Apply preprocessing and defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Run prediction with batch processing
results = np.zeros((x_.shape[0], self.nb_classes), dtype=np.float32)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
for m in range(num_batch):
# Batch indexes
begin, end = m * batch_size, min((m + 1) * batch_size, x_.shape[0])
# Predict
x_batch = nd.array(x_[begin:end], ctx=self._ctx)
x_batch.attach_grad()
with autograd.record(train_mode=train_mode):
preds = self._model(x_batch)
if logits is False:
preds = preds.softmax()
results[begin:end] = preds.asnumpy()
return results
|
def predict(self, x, logits=False, batch_size=128):
"""
Perform prediction for a batch of inputs.
:param x: Test set.
:type x: `np.ndarray`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:param batch_size: Size of batches.
:type batch_size: `int`
:return: Array of predictions of shape `(nb_inputs, self.nb_classes)`.
:rtype: `np.ndarray`
"""
from mxnet import autograd, nd
# Apply preprocessing and defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Run prediction with batch processing
results = np.zeros((x_.shape[0], self.nb_classes), dtype=np.float32)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
for m in range(num_batch):
# Batch indexes
begin, end = m * batch_size, min((m + 1) * batch_size, x_.shape[0])
# Predict
x_batch = nd.array(x_[begin:end], ctx=self._ctx)
x_batch.attach_grad()
with autograd.record(train_mode=False):
preds = self._model(x_batch)
if logits is False:
preds = preds.softmax()
results[begin:end] = preds.asnumpy()
return results
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def class_gradient(self, x, label=None, logits=False):
"""
Compute per-class derivatives w.r.t. `x`.
:param x: Sample input with shape as expected by the model.
:type x: `np.ndarray`
:param label: Index of a specific per-class derivative. If an integer is provided, the gradient of that class
output is computed for all samples. If multiple values as provided, the first dimension should
match the batch size of `x`, and each value will be used as target for its corresponding sample in
`x`. If `None`, then gradients for all classes will be computed for each sample.
:type label: `int` or `list`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:return: Array of gradients of input features w.r.t. each class in the form
`(batch_size, nb_classes, input_shape)` when computing for all classes, otherwise shape becomes
`(batch_size, 1, input_shape)` when `label` parameter is specified.
:rtype: `np.ndarray`
"""
from mxnet import autograd, nd
# Check value of label for computing gradients
if not (
label is None
or (isinstance(label, (int, np.integer)) and label in range(self.nb_classes))
or (
isinstance(label, np.ndarray)
and len(label.shape) == 1
and (label < self.nb_classes).all()
and label.shape[0] == x.shape[0]
)
):
raise ValueError("Label %s is out of range." % str(label))
train_mode = self._learning_phase if hasattr(self, "_learning_phase") else False
x_ = self._apply_processing(x)
x_ = nd.array(x_, ctx=self._ctx)
x_.attach_grad()
if label is None:
with autograd.record(train_mode=False):
if logits is True:
preds = self._model(x_)
else:
preds = self._model(x_).softmax()
class_slices = [preds[:, i] for i in range(self.nb_classes)]
grads = []
for slice_ in class_slices:
slice_.backward(retain_graph=True)
grad = x_.grad.asnumpy()
grads.append(grad)
grads = np.swapaxes(np.array(grads), 0, 1)
elif isinstance(label, (int, np.integer)):
with autograd.record(train_mode=train_mode):
if logits is True:
preds = self._model(x_)
else:
preds = self._model(x_).softmax()
class_slice = preds[:, label]
class_slice.backward()
grads = np.expand_dims(x_.grad.asnumpy(), axis=1)
else:
unique_labels = list(np.unique(label))
with autograd.record(train_mode=train_mode):
if logits is True:
preds = self._model(x_)
else:
preds = self._model(x_).softmax()
class_slices = [preds[:, i] for i in unique_labels]
grads = []
for slice_ in class_slices:
slice_.backward(retain_graph=True)
grad = x_.grad.asnumpy()
grads.append(grad)
grads = np.swapaxes(np.array(grads), 0, 1)
lst = [unique_labels.index(i) for i in label]
grads = grads[np.arange(len(grads)), lst]
grads = np.expand_dims(grads, axis=1)
grads = self._apply_processing_gradient(grads)
grads = self._apply_processing_gradient(grads)
return grads
|
def class_gradient(self, x, label=None, logits=False):
"""
Compute per-class derivatives w.r.t. `x`.
:param x: Sample input with shape as expected by the model.
:type x: `np.ndarray`
:param label: Index of a specific per-class derivative. If an integer is provided, the gradient of that class
output is computed for all samples. If multiple values as provided, the first dimension should
match the batch size of `x`, and each value will be used as target for its corresponding sample in
`x`. If `None`, then gradients for all classes will be computed for each sample.
:type label: `int` or `list`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:return: Array of gradients of input features w.r.t. each class in the form
`(batch_size, nb_classes, input_shape)` when computing for all classes, otherwise shape becomes
`(batch_size, 1, input_shape)` when `label` parameter is specified.
:rtype: `np.ndarray`
"""
from mxnet import autograd, nd
# Check value of label for computing gradients
if not (
label is None
or (isinstance(label, (int, np.integer)) and label in range(self.nb_classes))
or (
isinstance(label, np.ndarray)
and len(label.shape) == 1
and (label < self.nb_classes).all()
and label.shape[0] == x.shape[0]
)
):
raise ValueError("Label %s is out of range." % str(label))
x_ = self._apply_processing(x)
x_ = nd.array(x_, ctx=self._ctx)
x_.attach_grad()
if label is None:
with autograd.record(train_mode=False):
if logits is True:
preds = self._model(x_)
else:
preds = self._model(x_).softmax()
class_slices = [preds[:, i] for i in range(self.nb_classes)]
grads = []
for slice_ in class_slices:
slice_.backward(retain_graph=True)
grad = x_.grad.asnumpy()
grads.append(grad)
grads = np.swapaxes(np.array(grads), 0, 1)
elif isinstance(label, (int, np.integer)):
with autograd.record(train_mode=False):
if logits is True:
preds = self._model(x_)
else:
preds = self._model(x_).softmax()
class_slice = preds[:, label]
class_slice.backward()
grads = np.expand_dims(x_.grad.asnumpy(), axis=1)
else:
unique_labels = list(np.unique(label))
with autograd.record(train_mode=False):
if logits is True:
preds = self._model(x_)
else:
preds = self._model(x_).softmax()
class_slices = [preds[:, i] for i in unique_labels]
grads = []
for slice_ in class_slices:
slice_.backward(retain_graph=True)
grad = x_.grad.asnumpy()
grads.append(grad)
grads = np.swapaxes(np.array(grads), 0, 1)
lst = [unique_labels.index(i) for i in label]
grads = grads[np.arange(len(grads)), lst]
grads = np.expand_dims(grads, axis=1)
grads = self._apply_processing_gradient(grads)
grads = self._apply_processing_gradient(grads)
return grads
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def loss_gradient(self, x, y):
"""
Compute the gradient of the loss function w.r.t. `x`.
:param x: Sample input with shape as expected by the model.
:type x: `np.ndarray`
:param y: Correct labels, one-vs-rest encoding.
:type y: `np.ndarray`
:return: Array of gradients of the same shape as `x`.
:rtype: `np.ndarray`
"""
from mxnet import autograd, gluon, nd
train_mode = self._learning_phase if hasattr(self, "_learning_phase") else False
x_ = nd.array(x, ctx=self._ctx)
y_ = nd.array([np.argmax(y, axis=1)]).T
x_.attach_grad()
loss = gluon.loss.SoftmaxCrossEntropyLoss()
with autograd.record(train_mode=train_mode):
preds = self._model(x_)
loss = loss(preds, y_)
loss.backward()
grads = x_.grad.asnumpy()
grads = self._apply_processing_gradient(grads)
assert grads.shape == x.shape
return grads
|
def loss_gradient(self, x, y):
"""
Compute the gradient of the loss function w.r.t. `x`.
:param x: Sample input with shape as expected by the model.
:type x: `np.ndarray`
:param y: Correct labels, one-vs-rest encoding.
:type y: `np.ndarray`
:return: Array of gradients of the same shape as `x`.
:rtype: `np.ndarray`
"""
from mxnet import autograd, gluon, nd
x_ = nd.array(x, ctx=self._ctx)
y_ = nd.array([np.argmax(y, axis=1)]).T
x_.attach_grad()
loss = gluon.loss.SoftmaxCrossEntropyLoss()
with autograd.record(train_mode=False):
preds = self._model(x_)
loss = loss(preds, y_)
loss.backward()
grads = x_.grad.asnumpy()
grads = self._apply_processing_gradient(grads)
assert grads.shape == x.shape
return grads
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def predict(self, x, logits=False, batch_size=128):
"""
Perform prediction for a batch of inputs.
:param x: Test set.
:type x: `np.ndarray`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:param batch_size: Size of batches.
:type batch_size: `int`
:return: Array of predictions of shape `(nb_inputs, self.nb_classes)`.
:rtype: `np.ndarray`
"""
import torch
# Apply defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Run prediction with batch processing
results = np.zeros((x_.shape[0], self.nb_classes), dtype=np.float32)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
for m in range(num_batch):
# Batch indexes
begin, end = m * batch_size, min((m + 1) * batch_size, x_.shape[0])
model_outputs = self._model(
torch.from_numpy(x_[begin:end]).to(self._device).float()
)
(logit_output, output) = (model_outputs[-2], model_outputs[-1])
if logits:
results[begin:end] = logit_output.detach().cpu().numpy()
else:
results[begin:end] = output.detach().cpu().numpy()
return results
|
def predict(self, x, logits=False, batch_size=128):
"""
Perform prediction for a batch of inputs.
:param x: Test set.
:type x: `np.ndarray`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:param batch_size: Size of batches.
:type batch_size: `int`
:return: Array of predictions of shape `(nb_inputs, self.nb_classes)`.
:rtype: `np.ndarray`
"""
import torch
# Apply defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Set test phase
self._model.train(False)
# Run prediction
# preds = self._forward_at(torch.from_numpy(inputs), self._logit_layer).detach().numpy()
# if not logits:
# exp = np.exp(preds - np.max(preds, axis=1, keepdims=True))
# preds = exp / np.sum(exp, axis=1, keepdims=True)
# Run prediction with batch processing
results = np.zeros((x_.shape[0], self.nb_classes), dtype=np.float32)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
for m in range(num_batch):
# Batch indexes
begin, end = m * batch_size, min((m + 1) * batch_size, x_.shape[0])
model_outputs = self._model(
torch.from_numpy(x_[begin:end]).to(self._device).float()
)
(logit_output, output) = (model_outputs[-2], model_outputs[-1])
if logits:
results[begin:end] = logit_output.detach().cpu().numpy()
else:
results[begin:end] = output.detach().cpu().numpy()
return results
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit(self, x, y, batch_size=128, nb_epochs=10):
"""
Fit the classifier on the training set `(x, y)`.
:param x: Training data.
:type x: `np.ndarray`
:param y: Labels, one-vs-rest encoding.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
import torch
# Apply defences
x_ = self._apply_processing(x)
x_, y_ = self._apply_defences_fit(x_, y)
y_ = np.argmax(y_, axis=1)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
ind = np.arange(len(x_))
# Start training
for _ in range(nb_epochs):
# Shuffle the examples
random.shuffle(ind)
# Train for one epoch
for m in range(num_batch):
i_batch = torch.from_numpy(
x_[ind[m * batch_size : (m + 1) * batch_size]]
).to(self._device)
o_batch = torch.from_numpy(
y_[ind[m * batch_size : (m + 1) * batch_size]]
).to(self._device)
# Cast to float
i_batch = i_batch.float()
# Zero the parameter gradients
self._optimizer.zero_grad()
# Actual training
model_outputs = self._model(i_batch)
loss = self._loss(model_outputs[-1], o_batch)
loss.backward()
self._optimizer.step()
|
def fit(self, x, y, batch_size=128, nb_epochs=10):
"""
Fit the classifier on the training set `(x, y)`.
:param x: Training data.
:type x: `np.ndarray`
:param y: Labels, one-vs-rest encoding.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
import torch
# Apply defences
x_ = self._apply_processing(x)
x_, y_ = self._apply_defences_fit(x_, y)
y_ = np.argmax(y_, axis=1)
# Set train phase
self._model.train(True)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
ind = np.arange(len(x_))
# Start training
for _ in range(nb_epochs):
# Shuffle the examples
random.shuffle(ind)
# Train for one epoch
for m in range(num_batch):
i_batch = torch.from_numpy(
x_[ind[m * batch_size : (m + 1) * batch_size]]
).to(self._device)
o_batch = torch.from_numpy(
y_[ind[m * batch_size : (m + 1) * batch_size]]
).to(self._device)
# Cast to float
i_batch = i_batch.float()
# Zero the parameter gradients
self._optimizer.zero_grad()
# Actual training
model_outputs = self._model(i_batch)
loss = self._loss(model_outputs[-1], o_batch)
loss.backward()
self._optimizer.step()
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit_generator(self, generator, nb_epochs=20):
"""
Fit the classifier using the generator that yields batches as specified.
:param generator: Batch generator providing `(x, y)` for each epoch.
:type generator: `DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
import torch
from art.data_generators import PyTorchDataGenerator
# Train directly in PyTorch
if isinstance(generator, PyTorchDataGenerator) and not (
hasattr(self, "label_smooth") or hasattr(self, "feature_squeeze")
):
for _ in range(nb_epochs):
for i_batch, o_batch in generator.data_loader:
if isinstance(i_batch, np.ndarray):
i_batch = torch.from_numpy(i_batch).to(self._device).float()
else:
i_batch = i_batch.to(self._device).float()
if isinstance(o_batch, np.ndarray):
o_batch = torch.argmax(
torch.from_numpy(o_batch).to(self._device), dim=1
)
else:
o_batch = torch.argmax(o_batch.to(self._device), dim=1)
# Zero the parameter gradients
self._optimizer.zero_grad()
# Actual training
model_outputs = self._model(i_batch)
loss = self._loss(model_outputs[-1], o_batch)
loss.backward()
self._optimizer.step()
else:
# Fit a generic data generator through the API
super(PyTorchClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
|
def fit_generator(self, generator, nb_epochs=20):
"""
Fit the classifier using the generator that yields batches as specified.
:param generator: Batch generator providing `(x, y)` for each epoch.
:type generator: `DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
import torch
from art.data_generators import PyTorchDataGenerator
# Train directly in PyTorch
if isinstance(generator, PyTorchDataGenerator) and not (
hasattr(self, "label_smooth") or hasattr(self, "feature_squeeze")
):
for _ in range(nb_epochs):
# Set train phase
self._model.train(True)
for i_batch, o_batch in generator.data_loader:
if isinstance(i_batch, np.ndarray):
i_batch = torch.from_numpy(i_batch).to(self._device).float()
else:
i_batch = i_batch.to(self._device).float()
if isinstance(o_batch, np.ndarray):
o_batch = torch.argmax(
torch.from_numpy(o_batch).to(self._device), dim=1
)
else:
o_batch = torch.argmax(o_batch.to(self._device), dim=1)
# Zero the parameter gradients
self._optimizer.zero_grad()
# Actual training
model_outputs = self._model(i_batch)
loss = self._loss(model_outputs[-1], o_batch)
loss.backward()
self._optimizer.step()
else:
# Fit a generic data generator through the API
super(PyTorchClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def get_activations(self, x, layer):
"""
Return the output of the specified layer for input `x`. `layer` is specified by layer index (between 0 and
`nb_layers - 1`) or by name. The number of layers can be determined by counting the results returned by
calling `layer_names`.
:param x: Input for computing the activations.
:type x: `np.ndarray`
:param layer: Layer for computing the activations
:type layer: `int` or `str`
:return: The output of `layer`, where the first dimension is the batch size corresponding to `x`.
:rtype: `np.ndarray`
"""
import torch
# Apply defences
x = self._apply_defences_predict(x)
# Run prediction
model_outputs = self._model(torch.from_numpy(x).to(self._device).float())[:-1]
if isinstance(layer, six.string_types):
if layer not in self._layer_names:
raise ValueError("Layer name %s not supported" % layer)
layer_index = self._layer_names.index(layer)
elif isinstance(layer, (int, np.integer)):
layer_index = layer
else:
raise TypeError("Layer must be of type str or int")
return model_outputs[layer_index].detach().cpu().numpy()
|
def get_activations(self, x, layer):
"""
Return the output of the specified layer for input `x`. `layer` is specified by layer index (between 0 and
`nb_layers - 1`) or by name. The number of layers can be determined by counting the results returned by
calling `layer_names`.
:param x: Input for computing the activations.
:type x: `np.ndarray`
:param layer: Layer for computing the activations
:type layer: `int` or `str`
:return: The output of `layer`, where the first dimension is the batch size corresponding to `x`.
:rtype: `np.ndarray`
"""
import torch
# Apply defences
x = self._apply_defences_predict(x)
# Set test phase
self._model.train(False)
# Run prediction
model_outputs = self._model(torch.from_numpy(x).to(self._device).float())[:-1]
if isinstance(layer, six.string_types):
if layer not in self._layer_names:
raise ValueError("Layer name %s not supported" % layer)
layer_index = self._layer_names.index(layer)
elif isinstance(layer, (int, np.integer)):
layer_index = layer
else:
raise TypeError("Layer must be of type str or int")
return model_outputs[layer_index].detach().cpu().numpy()
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(
self,
clip_values,
input_ph,
logits,
output_ph=None,
train=None,
loss=None,
learning=None,
sess=None,
channel_index=3,
defences=None,
preprocessing=(0, 1),
):
"""
Initialization specifically for the Tensorflow-based implementation.
:param clip_values: Tuple of the form `(min, max)` representing the minimum and maximum values allowed
for features.
:type clip_values: `tuple`
:param input_ph: The input placeholder.
:type input_ph: `tf.Placeholder`
:param logits: The logits layer of the model.
:type logits: `tf.Tensor`
:param output_ph: The labels placeholder of the model. This parameter is necessary when training the model and
when computing gradients w.r.t. the loss function.
:type output_ph: `tf.Tensor`
:param train: The train tensor for fitting, including an optimizer. Use this parameter only when training the
model.
:type train: `tf.Tensor`
:param loss: The loss function for which to compute gradients. This parameter is necessary when training the
model and when computing gradients w.r.t. the loss function.
:type loss: `tf.Tensor`
:param learning: The placeholder to indicate if the model is training.
:type learning: `tf.Placeholder` of type bool.
:param sess: Computation session.
:type sess: `tf.Session`
:param channel_index: Index of the axis in data containing the color channels or features.
:type channel_index: `int`
:param defences: Defences to be activated with the classifier.
:type defences: `str` or `list(str)`
:param preprocessing: Tuple of the form `(substractor, divider)` of floats or `np.ndarray` of values to be
used for data preprocessing. The first value will be substracted from the input. The input will then
be divided by the second one.
:type preprocessing: `tuple`
"""
import tensorflow as tf
super(TFClassifier, self).__init__(
clip_values=clip_values,
channel_index=channel_index,
defences=defences,
preprocessing=preprocessing,
)
self._nb_classes = int(logits.get_shape()[-1])
self._input_shape = tuple(input_ph.get_shape()[1:])
self._input_ph = input_ph
self._logits = logits
self._output_ph = output_ph
self._train = train
self._loss = loss
self._learning = learning
self._feed_dict = {}
# Assign session
if sess is None:
# self._sess = tf.get_default_session()
raise ValueError("A session cannot be None.")
else:
self._sess = sess
# Get the internal layers
self._layer_names = self._get_layers()
# Must be set here for the softmax output
self._probs = tf.nn.softmax(logits)
# Get the loss gradients graph
if self._loss is not None:
self._loss_grads = tf.gradients(self._loss, self._input_ph)[0]
|
def __init__(
self,
clip_values,
input_ph,
logits,
output_ph=None,
train=None,
loss=None,
learning=None,
sess=None,
channel_index=3,
defences=None,
preprocessing=(0, 1),
):
"""
Initialization specifically for the Tensorflow-based implementation.
:param clip_values: Tuple of the form `(min, max)` representing the minimum and maximum values allowed
for features.
:type clip_values: `tuple`
:param input_ph: The input placeholder.
:type input_ph: `tf.Placeholder`
:param logits: The logits layer of the model.
:type logits: `tf.Tensor`
:param output_ph: The labels placeholder of the model. This parameter is necessary when training the model and
when computing gradients w.r.t. the loss function.
:type output_ph: `tf.Tensor`
:param train: The train tensor for fitting, including an optimizer. Use this parameter only when training the
model.
:type train: `tf.Tensor`
:param loss: The loss function for which to compute gradients. This parameter is necessary when training the
model and when computing gradients w.r.t. the loss function.
:type loss: `tf.Tensor`
:param learning: The placeholder to indicate if the model is training.
:type learning: `tf.Placeholder` of type bool.
:param sess: Computation session.
:type sess: `tf.Session`
:param channel_index: Index of the axis in data containing the color channels or features.
:type channel_index: `int`
:param defences: Defences to be activated with the classifier.
:type defences: `str` or `list(str)`
:param preprocessing: Tuple of the form `(substractor, divider)` of floats or `np.ndarray` of values to be
used for data preprocessing. The first value will be substracted from the input. The input will then
be divided by the second one.
:type preprocessing: `tuple`
"""
import tensorflow as tf
super(TFClassifier, self).__init__(
clip_values=clip_values,
channel_index=channel_index,
defences=defences,
preprocessing=preprocessing,
)
self._nb_classes = int(logits.get_shape()[-1])
self._input_shape = tuple(input_ph.get_shape()[1:])
self._input_ph = input_ph
self._logits = logits
self._output_ph = output_ph
self._train = train
self._loss = loss
self._learning = learning
# Assign session
if sess is None:
# self._sess = tf.get_default_session()
raise ValueError("A session cannot be None.")
else:
self._sess = sess
# Get the internal layers
self._layer_names = self._get_layers()
# Must be set here for the softmax output
self._probs = tf.nn.softmax(logits)
# Get the loss gradients graph
if self._loss is not None:
self._loss_grads = tf.gradients(self._loss, self._input_ph)[0]
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def predict(self, x, logits=False, batch_size=128):
"""
Perform prediction for a batch of inputs.
:param x: Test set.
:type x: `np.ndarray`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:param batch_size: Size of batches.
:type batch_size: `int`
:return: Array of predictions of shape `(nb_inputs, self.nb_classes)`.
:rtype: `np.ndarray`
"""
# Apply defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Run prediction with batch processing
results = np.zeros((x_.shape[0], self.nb_classes), dtype=np.float32)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
for m in range(num_batch):
# Batch indexes
begin, end = m * batch_size, min((m + 1) * batch_size, x_.shape[0])
# Create feed_dict
fd = {self._input_ph: x_[begin:end]}
fd.update(self._feed_dict)
# Run prediction
if logits:
results[begin:end] = self._sess.run(self._logits, feed_dict=fd)
else:
results[begin:end] = self._sess.run(self._probs, feed_dict=fd)
return results
|
def predict(self, x, logits=False, batch_size=128):
"""
Perform prediction for a batch of inputs.
:param x: Test set.
:type x: `np.ndarray`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:param batch_size: Size of batches.
:type batch_size: `int`
:return: Array of predictions of shape `(nb_inputs, self.nb_classes)`.
:rtype: `np.ndarray`
"""
# Apply defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Run prediction with batch processing
results = np.zeros((x_.shape[0], self.nb_classes), dtype=np.float32)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
for m in range(num_batch):
# Batch indexes
begin, end = m * batch_size, min((m + 1) * batch_size, x_.shape[0])
# Create feed_dict
fd = {self._input_ph: x_[begin:end]}
if self._learning is not None:
fd[self._learning] = False
# Run prediction
if logits:
results[begin:end] = self._sess.run(self._logits, feed_dict=fd)
else:
results[begin:end] = self._sess.run(self._probs, feed_dict=fd)
return results
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit(self, x, y, batch_size=128, nb_epochs=10):
"""
Fit the classifier on the training set `(x, y)`.
:param x: Training data.
:type x: `np.ndarray`
:param y: Labels, one-vs-rest encoding.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
# Check if train and output_ph available
if self._train is None or self._output_ph is None:
raise ValueError(
"Need the training objective and the output placeholder to train the model."
)
# Apply defences
x_ = self._apply_processing(x)
x_, y_ = self._apply_defences_fit(x_, y)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
ind = np.arange(len(x_))
# Start training
for _ in range(nb_epochs):
# Shuffle the examples
random.shuffle(ind)
# Train for one epoch
for m in range(num_batch):
i_batch = x_[ind[m * batch_size : (m + 1) * batch_size]]
o_batch = y_[ind[m * batch_size : (m + 1) * batch_size]]
# Create feed_dict
fd = {self._input_ph: i_batch, self._output_ph: o_batch}
fd.update(self._feed_dict)
# Run train step
self._sess.run(self._train, feed_dict=fd)
|
def fit(self, x, y, batch_size=128, nb_epochs=10):
"""
Fit the classifier on the training set `(x, y)`.
:param x: Training data.
:type x: `np.ndarray`
:param y: Labels, one-vs-rest encoding.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
# Check if train and output_ph available
if self._train is None or self._output_ph is None:
raise ValueError(
"Need the training objective and the output placeholder to train the model."
)
# Apply defences
x_ = self._apply_processing(x)
x_, y_ = self._apply_defences_fit(x_, y)
num_batch = int(np.ceil(len(x_) / float(batch_size)))
ind = np.arange(len(x_))
# Start training
for _ in range(nb_epochs):
# Shuffle the examples
random.shuffle(ind)
# Train for one epoch
for m in range(num_batch):
i_batch = x_[ind[m * batch_size : (m + 1) * batch_size]]
o_batch = y_[ind[m * batch_size : (m + 1) * batch_size]]
# Run train step
if self._learning is None:
self._sess.run(
self._train,
feed_dict={self._input_ph: i_batch, self._output_ph: o_batch},
)
else:
self._sess.run(
self._train,
feed_dict={
self._input_ph: i_batch,
self._output_ph: o_batch,
self._learning: True,
},
)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit_generator(self, generator, nb_epochs=20):
"""
Fit the classifier using the generator that yields batches as specified.
:param generator: Batch generator providing `(x, y)` for each epoch. If the generator can be used for native
training in TensorFlow, it will.
:type generator: `DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
from art.data_generators import TFDataGenerator
# Train directly in Tensorflow
if isinstance(generator, TFDataGenerator) and not (
hasattr(self, "label_smooth") or hasattr(self, "feature_squeeze")
):
for _ in range(nb_epochs):
for _ in range(int(generator.size / generator.batch_size)):
i_batch, o_batch = generator.get_batch()
# Create feed_dict
fd = {self._input_ph: i_batch, self._output_ph: o_batch}
fd.update(self._feed_dict)
# Run train step
self._sess.run(self._train, feed_dict=fd)
else:
super(TFClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
|
def fit_generator(self, generator, nb_epochs=20):
"""
Fit the classifier using the generator that yields batches as specified.
:param generator: Batch generator providing `(x, y)` for each epoch. If the generator can be used for native
training in TensorFlow, it will.
:type generator: `DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
# TODO Implement TF-specific version
super(TFClassifier, self).fit_generator(generator, nb_epochs=nb_epochs)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def class_gradient(self, x, label=None, logits=False):
"""
Compute per-class derivatives w.r.t. `x`.
:param x: Sample input with shape as expected by the model.
:type x: `np.ndarray`
:param label: Index of a specific per-class derivative. If an integer is provided, the gradient of that class
output is computed for all samples. If multiple values as provided, the first dimension should
match the batch size of `x`, and each value will be used as target for its corresponding sample in
`x`. If `None`, then gradients for all classes will be computed for each sample.
:type label: `int` or `list`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:return: Array of gradients of input features w.r.t. each class in the form
`(batch_size, nb_classes, input_shape)` when computing for all classes, otherwise shape becomes
`(batch_size, 1, input_shape)` when `label` parameter is specified.
:rtype: `np.ndarray`
"""
# Check value of label for computing gradients
if not (
label is None
or (isinstance(label, (int, np.integer)) and label in range(self.nb_classes))
or (
isinstance(label, np.ndarray)
and len(label.shape) == 1
and (label < self._nb_classes).all()
and label.shape[0] == x.shape[0]
)
):
raise ValueError("Label %s is out of range." % label)
self._init_class_grads(label=label, logits=logits)
x_ = self._apply_processing(x)
# Create feed_dict
fd = {self._input_ph: x_}
fd.update(self._feed_dict)
# Compute the gradient and return
if label is None:
# Compute the gradients w.r.t. all classes
if logits:
grads = self._sess.run(self._logit_class_grads, feed_dict=fd)
else:
grads = self._sess.run(self._class_grads, feed_dict=fd)
grads = np.swapaxes(np.array(grads), 0, 1)
grads = self._apply_processing_gradient(grads)
elif isinstance(label, (int, np.integer)):
# Compute the gradients only w.r.t. the provided label
if logits:
grads = self._sess.run(self._logit_class_grads[label], feed_dict=fd)
else:
grads = self._sess.run(self._class_grads[label], feed_dict=fd)
grads = grads[None, ...]
grads = np.swapaxes(np.array(grads), 0, 1)
grads = self._apply_processing_gradient(grads)
else:
# For each sample, compute the gradients w.r.t. the indicated target class (possibly distinct)
unique_label = list(np.unique(label))
if logits:
grads = self._sess.run(
[self._logit_class_grads[l] for l in unique_label], feed_dict=fd
)
else:
grads = self._sess.run(
[self._class_grads[l] for l in unique_label], feed_dict=fd
)
grads = np.swapaxes(np.array(grads), 0, 1)
lst = [unique_label.index(i) for i in label]
grads = np.expand_dims(grads[np.arange(len(grads)), lst], axis=1)
grads = self._apply_processing_gradient(grads)
return grads
|
def class_gradient(self, x, label=None, logits=False):
"""
Compute per-class derivatives w.r.t. `x`.
:param x: Sample input with shape as expected by the model.
:type x: `np.ndarray`
:param label: Index of a specific per-class derivative. If an integer is provided, the gradient of that class
output is computed for all samples. If multiple values as provided, the first dimension should
match the batch size of `x`, and each value will be used as target for its corresponding sample in
`x`. If `None`, then gradients for all classes will be computed for each sample.
:type label: `int` or `list`
:param logits: `True` if the prediction should be done at the logits layer.
:type logits: `bool`
:return: Array of gradients of input features w.r.t. each class in the form
`(batch_size, nb_classes, input_shape)` when computing for all classes, otherwise shape becomes
`(batch_size, 1, input_shape)` when `label` parameter is specified.
:rtype: `np.ndarray`
"""
# Check value of label for computing gradients
if not (
label is None
or (isinstance(label, (int, np.integer)) and label in range(self.nb_classes))
or (
isinstance(label, np.ndarray)
and len(label.shape) == 1
and (label < self._nb_classes).all()
and label.shape[0] == x.shape[0]
)
):
raise ValueError("Label %s is out of range." % label)
self._init_class_grads(label=label, logits=logits)
x_ = self._apply_processing(x)
# Compute the gradient and return
if label is None:
# Compute the gradients w.r.t. all classes
if logits:
grads = self._sess.run(
self._logit_class_grads, feed_dict={self._input_ph: x_}
)
else:
grads = self._sess.run(self._class_grads, feed_dict={self._input_ph: x_})
grads = np.swapaxes(np.array(grads), 0, 1)
grads = self._apply_processing_gradient(grads)
elif isinstance(label, (int, np.integer)):
# Compute the gradients only w.r.t. the provided label
if logits:
grads = self._sess.run(
self._logit_class_grads[label], feed_dict={self._input_ph: x_}
)
else:
grads = self._sess.run(
self._class_grads[label], feed_dict={self._input_ph: x_}
)
grads = grads[None, ...]
grads = np.swapaxes(np.array(grads), 0, 1)
grads = self._apply_processing_gradient(grads)
else:
# For each sample, compute the gradients w.r.t. the indicated target class (possibly distinct)
unique_label = list(np.unique(label))
if logits:
grads = self._sess.run(
[self._logit_class_grads[l] for l in unique_label],
feed_dict={self._input_ph: x_},
)
else:
grads = self._sess.run(
[self._class_grads[l] for l in unique_label],
feed_dict={self._input_ph: x_},
)
grads = np.swapaxes(np.array(grads), 0, 1)
lst = [unique_label.index(i) for i in label]
grads = np.expand_dims(grads[np.arange(len(grads)), lst], axis=1)
grads = self._apply_processing_gradient(grads)
return grads
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def loss_gradient(self, x, y):
"""
Compute the gradient of the loss function w.r.t. `x`.
:param x: Sample input with shape as expected by the model.
:type x: `np.ndarray`
:param y: Correct labels, one-vs-rest encoding.
:type y: `np.ndarray`
:return: Array of gradients of the same shape as `x`.
:rtype: `np.ndarray`
"""
x_ = self._apply_processing(x)
# Check if loss available
if (
not hasattr(self, "_loss_grads")
or self._loss_grads is None
or self._output_ph is None
):
raise ValueError(
"Need the loss function and the labels placeholder to compute the loss gradient."
)
# Create feed_dict
fd = {self._input_ph: x_, self._output_ph: y}
fd.update(self._feed_dict)
# Compute the gradient and return
grds = self._sess.run(self._loss_grads, feed_dict=fd)
grds = self._apply_processing_gradient(grds)
assert grds.shape == x_.shape
return grds
|
def loss_gradient(self, x, y):
"""
Compute the gradient of the loss function w.r.t. `x`.
:param x: Sample input with shape as expected by the model.
:type x: `np.ndarray`
:param y: Correct labels, one-vs-rest encoding.
:type y: `np.ndarray`
:return: Array of gradients of the same shape as `x`.
:rtype: `np.ndarray`
"""
x_ = self._apply_processing(x)
# Check if loss available
if (
not hasattr(self, "_loss_grads")
or self._loss_grads is None
or self._output_ph is None
):
raise ValueError(
"Need the loss function and the labels placeholder to compute the loss gradient."
)
# Compute the gradient and return
grds = self._sess.run(
self._loss_grads, feed_dict={self._input_ph: x_, self._output_ph: y}
)
grds = self._apply_processing_gradient(grds)
assert grds.shape == x_.shape
return grds
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def get_activations(self, x, layer):
"""
Return the output of the specified layer for input `x`. `layer` is specified by layer index (between 0 and
`nb_layers - 1`) or by name. The number of layers can be determined by counting the results returned by
calling `layer_names`.
:param x: Input for computing the activations.
:type x: `np.ndarray`
:param layer: Layer for computing the activations
:type layer: `int` or `str`
:return: The output of `layer`, where the first dimension is the batch size corresponding to `x`.
:rtype: `np.ndarray`
"""
import tensorflow as tf
# Get the computational graph
with self._sess.graph.as_default():
graph = tf.get_default_graph()
if isinstance(
layer, six.string_types
): # basestring for Python 2 (str, unicode) support
if layer not in self._layer_names:
raise ValueError("Layer name %s is not part of the graph." % layer)
layer_tensor = graph.get_tensor_by_name(layer)
elif isinstance(layer, (int, np.integer)):
layer_tensor = graph.get_tensor_by_name(self._layer_names[layer])
else:
raise TypeError("Layer must be of type `str` or `int`. Received '%s'", layer)
# Get activations
# Apply preprocessing and defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Create feed_dict
fd = {self._input_ph: x_}
fd.update(self._feed_dict)
# Run prediction
result = self._sess.run(layer_tensor, feed_dict=fd)
return result
|
def get_activations(self, x, layer):
"""
Return the output of the specified layer for input `x`. `layer` is specified by layer index (between 0 and
`nb_layers - 1`) or by name. The number of layers can be determined by counting the results returned by
calling `layer_names`.
:param x: Input for computing the activations.
:type x: `np.ndarray`
:param layer: Layer for computing the activations
:type layer: `int` or `str`
:return: The output of `layer`, where the first dimension is the batch size corresponding to `x`.
:rtype: `np.ndarray`
"""
import tensorflow as tf
# Get the computational graph
with self._sess.graph.as_default():
graph = tf.get_default_graph()
if isinstance(
layer, six.string_types
): # basestring for Python 2 (str, unicode) support
if layer not in self._layer_names:
raise ValueError("Layer name %s is not part of the graph." % layer)
layer_tensor = graph.get_tensor_by_name(layer)
elif isinstance(layer, (int, np.integer)):
layer_tensor = graph.get_tensor_by_name(self._layer_names[layer])
else:
raise TypeError("Layer must be of type `str` or `int`. Received '%s'", layer)
# Get activations
# Apply preprocessing and defences
x_ = self._apply_processing(x)
x_ = self._apply_defences_predict(x_)
# Create feed_dict
fd = {self._input_ph: x_}
if self._learning is not None:
fd[self._learning] = False
# Run prediction
result = self._sess.run(layer_tensor, feed_dict=fd)
return result
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(self, generator, size, batch_size):
"""
Create a Keras data generator wrapper instance.
:param generator: A generator as specified by Keras documentation. Its output must be a tuple of either
`(inputs, targets)` or `(inputs, targets, sample_weights)`. All arrays in this tuple must have
the same length. The generator is expected to loop over its data indefinitely.
:type generator: generator function or `keras.utils.Sequence` or `keras.preprocessing.image.ImageDataGenerator`
:param size: Total size of the dataset.
:type size: `int` or `None`
:param batch_size: Size of the minibatches.
:type batch_size: `int`
"""
super(KerasDataGenerator, self).__init__(size=size, batch_size=batch_size)
self.generator = generator
|
def __init__(self, generator, size, batch_size):
"""
Create a Keras data generator wrapper instance.
:param generator: A generator as specified by Keras documentation. Its output must be a tuple of either
`(inputs, targets)` or `(inputs, targets, sample_weights)`. All arrays in this tuple must have
the same length. The generator is expected to loop over its data indefinitely.
:type generator: generator function or `keras.utils.Sequence` or `keras.preprocessing.image.ImageDataGenerator`
:param size: Total size of the dataset.
:type size: `int` or `None`
:param batch_size: Size of the minibatches.
:type batch_size: `int`
"""
self.generator = generator
if size is not None and (type(size) is not int or size < 1):
raise ValueError(
"The total size of the dataset must be an integer greater than zero."
)
self.size = size
if type(batch_size) is not int or batch_size < 1:
raise ValueError("The batch size must be an integer greater than zero.")
self.batch_size = batch_size
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(self, data_loader, size, batch_size):
"""
Create a data generator wrapper on top of a PyTorch :class:`DataLoader`.
:param data_loader: A PyTorch data generator.
:type data_loader: `torch.utils.data.DataLoader`
:param size: Total size of the dataset.
:type size: int
:param batch_size: Size of the minibatches.
:type batch_size: int
"""
super(PyTorchDataGenerator, self).__init__(size=size, batch_size=batch_size)
from torch.utils.data import DataLoader
if not isinstance(data_loader, DataLoader):
raise TypeError(
"Expected instance of PyTorch `DataLoader, received %s instead.`"
% str(type(data_loader))
)
self.data_loader = data_loader
|
def __init__(self, data_loader, size, batch_size):
"""
Create a data generator wrapper on top of a PyTorch :class:`DataLoader`.
:param data_loader: A PyTorch data generator.
:type data_loader: `torch.utils.data.DataLoader`
:param size: Total size of the dataset.
:type size: int
:param batch_size: Size of the minibatches.
:type batch_size: int
"""
from torch.utils.data import DataLoader
if not isinstance(data_loader, DataLoader):
raise TypeError(
"Expected instance of PyTorch `DataLoader, received %s instead.`"
% str(type(data_loader))
)
self.data_loader = data_loader
if size is not None and (type(size) is not int or size < 1):
raise ValueError(
"The total size of the dataset must be an integer greater than zero."
)
self.size = size
if type(batch_size) is not int or batch_size < 1:
raise ValueError("The batch size must be an integer greater than zero.")
self.batch_size = batch_size
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(self, data_loader, size, batch_size):
"""
Create a data generator wrapper on top of an MXNet :class:`DataLoader`.
:param data_loader:
:type data_loader: `mxnet.gluon.data.DataLoader`
:param size: Total size of the dataset.
:type size: int
:param batch_size: Size of the minibatches.
:type batch_size: int
"""
super(MXDataGenerator, self).__init__(size=size, batch_size=batch_size)
from mxnet.gluon.data import DataLoader
if not isinstance(data_loader, DataLoader):
raise TypeError(
"Expected instance of Gluon `DataLoader, received %s instead.`"
% str(type(data_loader))
)
self.data_loader = data_loader
|
def __init__(self, data_loader, size, batch_size):
"""
Create a data generator wrapper on top of an MXNet :class:`DataLoader`.
:param data_loader:
:type data_loader: `mxnet.gluon.data.DataLoader`
:param size: Total size of the dataset.
:type size: int
:param batch_size: Size of the minibatches.
:type batch_size: int
"""
from mxnet.gluon.data import DataLoader
if not isinstance(data_loader, DataLoader):
raise TypeError(
"Expected instance of Gluon `DataLoader, received %s instead.`"
% str(type(data_loader))
)
self.data_loader = data_loader
if size is not None and (type(size) is not int or size < 1):
raise ValueError(
"The total size of the dataset must be an integer greater than zero."
)
self.size = size
if type(batch_size) is not int or batch_size < 1:
raise ValueError("The batch size must be an integer greater than zero.")
self.batch_size = batch_size
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(self, sess, iterator, iterator_type, iterator_arg, size, batch_size):
"""
Create a data generator wrapper for TensorFlow. Supported iterators: initializable, reinitializable, feedable.
:param sess: Tensorflow session.
:type sess: `tf.Session`
:param iterator: Data iterator from TensorFlow.
:type iterator: `tensorflow.python.data.ops.iterator_ops.Iterator`
:param iterator_type: Type of the iterator. Supported types: `initializable`, `reinitializable`, `feedable`.
:type iterator_type: `string`
:param iterator_arg: Argument to initialize the iterator. It is either a feed_dict used for the initializable
and feedable mode, or an init_op used for the reinitializable mode.
:type iterator_arg: `dict`, `tuple` or `tensorflow.python.framework.ops.Operation`
:param size: Total size of the dataset.
:type size: `int`
:param batch_size: Size of the minibatches.
:type batch_size: `int`
"""
import tensorflow as tf
super(TFDataGenerator, self).__init__(size=size, batch_size=batch_size)
self.sess = sess
self.iterator = iterator
self.iterator_type = iterator_type
self.iterator_arg = iterator_arg
if not isinstance(iterator, tf.data.Iterator):
raise ("Only support object tf.data.Iterator")
if iterator_type == "initializable":
if type(iterator_arg) != dict:
raise ("Need to pass a dictionary for iterator type %s" % iterator_type)
elif iterator_type == "reinitializable":
if not isinstance(iterator_arg, tf.Operation):
raise (
"Need to pass a tensorflow operation for iterator type %s"
% iterator_type
)
elif iterator_type == "feedable":
if type(iterator_arg) != tuple:
raise ("Need to pass a tuple for iterator type %s" % iterator_type)
else:
raise ("Iterator type %s not supported" % iterator_type)
|
def __init__(self):
pass
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def get_batch(self):
"""
Provide the next batch for training in the form of a tuple `(x, y)`. The generator should loop over the data
indefinitely.
:return: A tuple containing a batch of data `(x, y)`.
:rtype: `tuple`
:raises: `ValueError` if the iterator has reached the end.
"""
import tensorflow as tf
# Get next batch
next_batch = self.iterator.get_next()
# Process to get the batch
try:
if self.iterator_type in ("initializable", "reinitializable"):
return self.sess.run(next_batch)
else:
return self.sess.run(next_batch, feed_dict=self.iterator_arg[1])
except (tf.errors.FailedPreconditionError, tf.errors.OutOfRangeError):
if self.iterator_type == "initializable":
self.sess.run(self.iterator.initializer, feed_dict=self.iterator_arg)
return self.sess.run(next_batch)
elif self.iterator_type == "reinitializable":
self.sess.run(self.iterator_arg)
return self.sess.run(next_batch)
else:
self.sess.run(self.iterator_arg[0].initializer)
return self.sess.run(next_batch, feed_dict=self.iterator_arg[1])
|
def get_batch(self):
"""
Provide the next batch for training in the form of a tuple `(x, y)`. The generator should loop over the data
indefinitely.
:return: A tuple containing a batch of data `(x, y)`.
:rtype: `tuple`
"""
raise NotImplementedError
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit_generator(self, generator, nb_epochs=20):
"""
Train a model adversarially using a data generator.
See class documentation for more information on the exact procedure.
:param generator: Data generator.
:type generator: :class:`DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
logger.info("Performing adversarial training using %i attacks.", len(self.attacks))
size = generator.size
batch_size = generator.batch_size
nb_batches = int(np.ceil(size / batch_size))
ind = np.arange(generator.size)
attack_id = 0
# Precompute adversarial samples for transferred attacks
logged = False
self._precomputed_adv_samples = []
for attack in self.attacks:
if "targeted" in attack.attack_params:
if attack.targeted:
raise NotImplementedError(
"Adversarial training with targeted attacks is \
currently not implemented"
)
if attack.classifier != self.classifier:
if not logged:
logger.info("Precomputing transferred adversarial samples.")
logged = True
next_precomputed_adv_samples = None
for batch_id in range(nb_batches):
# Create batch data
x_batch, y_batch = generator.get_batch()
x_adv_batch = attack.generate(x_batch, y=y_batch)
if next_precomputed_adv_samples is None:
next_precomputed_adv_samples = x_adv_batch
else:
next_precomputed_adv_samples = np.append(
next_precomputed_adv_samples, x_adv_batch, axis=0
)
self._precomputed_adv_samples.append(next_precomputed_adv_samples)
else:
self._precomputed_adv_samples.append(None)
for e in range(nb_epochs):
logger.info("Adversarial training epoch %i/%i", e, nb_epochs)
# Shuffle the indices of precomputed examples
np.random.shuffle(ind)
for batch_id in range(nb_batches):
# Create batch data
x_batch, y_batch = generator.get_batch()
x_batch = x_batch.copy()
# Choose indices to replace with adversarial samples
nb_adv = int(np.ceil(self.ratio * x_batch.shape[0]))
attack = self.attacks[attack_id]
if self.ratio < 1:
adv_ids = np.random.choice(x_batch.shape[0], size=nb_adv, replace=False)
else:
adv_ids = list(range(x_batch.shape[0]))
np.random.shuffle(adv_ids)
# If source and target models are the same, craft fresh adversarial samples
if attack.classifier == self.classifier:
x_batch[adv_ids] = attack.generate(x_batch[adv_ids], y=y_batch[adv_ids])
# Otherwise, use precomputed adversarial samples
else:
x_adv = self._precomputed_adv_samples[attack_id]
x_adv = x_adv[
ind[batch_id * batch_size : min((batch_id + 1) * batch_size, size)]
][adv_ids]
x_batch[adv_ids] = x_adv
# Fit batch
self.classifier.fit(
x_batch, y_batch, nb_epochs=1, batch_size=x_batch.shape[0]
)
attack_id = (attack_id + 1) % len(self.attacks)
|
def fit_generator(self, generator, nb_epochs=20):
"""
Train a model adversarially using a data generator.
See class documentation for more information on the exact procedure.
:param generator: Data generator.
:type generator: :class:`DataGenerator`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
logger.info("Performing adversarial training using %i attacks.", len(self.attacks))
size = generator.size
batch_size = generator.batch_size
nb_batches = int(np.ceil(size / batch_size))
nb_adv = int(np.ceil(self.ratio * generator.batch_size))
ind = np.arange(generator.size)
attack_id = 0
# Precompute adversarial samples for transferred attacks
logged = False
self._precomputed_adv_samples = []
for attack in self.attacks:
if "targeted" in attack.attack_params:
if attack.targeted:
raise NotImplementedError(
"Adversarial training with targeted attacks is \
currently not implemented"
)
if attack.classifier != self.classifier:
if not logged:
logger.info("Precomputing transferred adversarial samples.")
logged = True
next_precomputed_adv_samples = None
for batch_id in range(nb_batches):
# Create batch data
x_batch, y_batch = generator.get_batch()
x_adv_batch = attack.generate(x_batch, y=y_batch)
if next_precomputed_adv_samples is None:
next_precomputed_adv_samples = x_adv_batch
else:
next_precomputed_adv_samples = np.append(
next_precomputed_adv_samples, x_adv_batch, axis=0
)
self._precomputed_adv_samples.append(next_precomputed_adv_samples)
else:
self._precomputed_adv_samples.append(None)
for e in range(nb_epochs):
logger.info("Adversarial training epoch %i/%i", e, nb_epochs)
# Shuffle the indices of precomputed examples
np.random.shuffle(ind)
for batch_id in range(nb_batches):
# Create batch data
x_batch, y_batch = generator.get_batch()
x_batch = x_batch.copy()
# Choose indices to replace with adversarial samples
attack = self.attacks[attack_id]
adv_ids = np.random.choice(x_batch.shape[0], size=nb_adv, replace=False)
# If source and target models are the same, craft fresh adversarial samples
if attack.classifier == self.classifier:
x_batch[adv_ids] = attack.generate(x_batch[adv_ids], y=y_batch[adv_ids])
# Otherwise, use precomputed adversarial samples
else:
x_adv = self._precomputed_adv_samples[attack_id]
x_adv = x_adv[
ind[batch_id * batch_size : min((batch_id + 1) * batch_size, size)]
][adv_ids]
x_batch[adv_ids] = x_adv
# Fit batch
self.classifier.fit(
x_batch, y_batch, nb_epochs=1, batch_size=x_batch.shape[0]
)
attack_id = (attack_id + 1) % len(self.attacks)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def fit(self, x, y, batch_size=128, nb_epochs=20):
"""
Train a model adversarially. See class documentation for more information on the exact procedure.
:param x: Training set.
:type x: `np.ndarray`
:param y: Labels for the training set.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
logger.info("Performing adversarial training using %i attacks.", len(self.attacks))
nb_batches = int(np.ceil(len(x) / batch_size))
ind = np.arange(len(x))
attack_id = 0
# Precompute adversarial samples for transferred attacks
logged = False
self._precomputed_adv_samples = []
for attack in self.attacks:
if "targeted" in attack.attack_params:
if attack.targeted:
raise NotImplementedError(
"Adversarial training with targeted attacks is \
currently not implemented"
)
if attack.classifier != self.classifier:
if not logged:
logger.info("Precomputing transferred adversarial samples.")
logged = True
self._precomputed_adv_samples.append(attack.generate(x, y=y))
else:
self._precomputed_adv_samples.append(None)
for e in range(nb_epochs):
logger.info("Adversarial training epoch %i/%i", e, nb_epochs)
# Shuffle the examples
np.random.shuffle(ind)
for batch_id in range(nb_batches):
# Create batch data
x_batch = x[
ind[
batch_id * batch_size : min((batch_id + 1) * batch_size, x.shape[0])
]
].copy()
y_batch = y[
ind[
batch_id * batch_size : min((batch_id + 1) * batch_size, x.shape[0])
]
]
nb_adv = int(np.ceil(self.ratio * x_batch.shape[0]))
# Choose indices to replace with adversarial samples
nb_adv = int(np.ceil(self.ratio * x_batch.shape[0]))
attack = self.attacks[attack_id]
if self.ratio < 1:
adv_ids = np.random.choice(x_batch.shape[0], size=nb_adv, replace=False)
else:
adv_ids = list(range(x_batch.shape[0]))
np.random.shuffle(adv_ids)
# If source and target models are the same, craft fresh adversarial samples
if attack.classifier == self.classifier:
x_batch[adv_ids] = attack.generate(x_batch[adv_ids], y=y_batch[adv_ids])
# Otherwise, use precomputed adversarial samples
else:
x_adv = self._precomputed_adv_samples[attack_id]
x_adv = x_adv[
ind[
batch_id * batch_size : min(
(batch_id + 1) * batch_size, x.shape[0]
)
]
][adv_ids]
x_batch[adv_ids] = x_adv
# Fit batch
self.classifier.fit(
x_batch, y_batch, nb_epochs=1, batch_size=x_batch.shape[0]
)
attack_id = (attack_id + 1) % len(self.attacks)
|
def fit(self, x, y, batch_size=128, nb_epochs=20):
"""
Train a model adversarially. See class documentation for more information on the exact procedure.
:param x: Training set.
:type x: `np.ndarray`
:param y: Labels for the training set.
:type y: `np.ndarray`
:param batch_size: Size of batches.
:type batch_size: `int`
:param nb_epochs: Number of epochs to use for trainings.
:type nb_epochs: `int`
:return: `None`
"""
logger.info("Performing adversarial training using %i attacks.", len(self.attacks))
nb_batches = int(np.ceil(len(x) / batch_size))
ind = np.arange(len(x))
attack_id = 0
# Precompute adversarial samples for transferred attacks
logged = False
self._precomputed_adv_samples = []
for attack in self.attacks:
if "targeted" in attack.attack_params:
if attack.targeted:
raise NotImplementedError(
"Adversarial training with targeted attacks is \
currently not implemented"
)
if attack.classifier != self.classifier:
if not logged:
logger.info("Precomputing transferred adversarial samples.")
logged = True
self._precomputed_adv_samples.append(attack.generate(x, y=y))
else:
self._precomputed_adv_samples.append(None)
for e in range(nb_epochs):
logger.info("Adversarial training epoch %i/%i", e, nb_epochs)
# Shuffle the examples
np.random.shuffle(ind)
for batch_id in range(nb_batches):
# Create batch data
x_batch = x[
ind[
batch_id * batch_size : min((batch_id + 1) * batch_size, x.shape[0])
]
].copy()
y_batch = y[
ind[
batch_id * batch_size : min((batch_id + 1) * batch_size, x.shape[0])
]
]
nb_adv = int(np.ceil(self.ratio * x_batch.shape[0]))
# Choose indices to replace with adversarial samples
attack = self.attacks[attack_id]
adv_ids = np.random.choice(x_batch.shape[0], size=nb_adv, replace=False)
# If source and target models are the same, craft fresh adversarial samples
if attack.classifier == self.classifier:
x_batch[adv_ids] = attack.generate(x_batch[adv_ids], y=y_batch[adv_ids])
# Otherwise, use precomputed adversarial samples
else:
x_adv = self._precomputed_adv_samples[attack_id]
x_adv = x_adv[
ind[
batch_id * batch_size : min(
(batch_id + 1) * batch_size, x.shape[0]
)
]
][adv_ids]
x_batch[adv_ids] = x_adv
# Fit batch
self.classifier.fit(
x_batch, y_batch, nb_epochs=1, batch_size=x_batch.shape[0]
)
attack_id = (attack_id + 1) % len(self.attacks)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __call__(self, x, y=None, quality=None, clip_values=(0, 1)):
"""
Apply JPEG compression to sample `x`.
:param x: Sample to compress with shape `(batch_size, width, height, depth)`.
:type x: `np.ndarray`
:param y: Labels of the sample `x`. This function does not affect them in any way.
:type y: `np.ndarray`
:param quality: The image quality, on a scale from 1 (worst) to 95 (best). Values above 95 should be avoided.
:type quality: `int`
:param clip_values: Tuple of the form `(min, max)` representing the minimum and maximum values allowed
for features.
:type clip_values: `tuple`
:return: compressed sample.
:rtype: `np.ndarray`
"""
if quality is not None:
self.set_params(quality=quality)
assert self.channel_index < len(x.shape)
# Swap channel index
if self.channel_index < 3:
x_ = np.swapaxes(x, self.channel_index, 3)
else:
x_ = x.copy()
# Convert into `uint8`
x_ = x_ * 255
x_ = x_.astype("uint8")
# Convert to 'L' mode
if x_.shape[-1] == 1:
x_ = np.reshape(x_, x_.shape[:-1])
# Compress one image per time
for i, xi in enumerate(x_):
if len(xi.shape) == 2:
xi = Image.fromarray(xi, mode="L")
elif xi.shape[-1] == 3:
xi = Image.fromarray(xi, mode="RGB")
else:
logger.log(level=40, msg="Currently only support `RGB` and `L` images.")
raise NotImplementedError("Currently only support `RGB` and `L` images.")
out = BytesIO()
xi.save(out, format="jpeg", quality=self.quality)
xi = Image.open(out)
xi = np.array(xi)
x_[i] = xi
del out
# Expand dim if black/white images
if len(x_.shape) < 4:
x_ = np.expand_dims(x_, 3)
# Convert to old dtype
x_ = x_ / 255.0
x_ = x_.astype(NUMPY_DTYPE)
# Swap channel index
if self.channel_index < 3:
x_ = np.swapaxes(x_, self.channel_index, 3)
x_ = np.clip(x_, clip_values[0], clip_values[1])
return x_
|
def __call__(self, x, y=None, quality=None, clip_values=(0, 1)):
"""
Apply jpeg compression to sample `x`.
:param x: Sample to compress with shape `(batch_size, width, height, depth)`.
:type x: `np.ndarray`
:param y: Labels of the sample `x`. This function does not affect them in any way.
:type y: `np.ndarray`
:param quality: The image quality, on a scale from 1 (worst) to 95 (best). Values above 95 should be avoided.
:type quality: `int`
:return: compressed sample
:rtype: `np.ndarray`
"""
if quality is not None:
self.set_params(quality=quality)
assert self.channel_index < len(x.shape)
# Swap channel index
if self.channel_index < 3:
x_ = np.swapaxes(x, self.channel_index, 3)
else:
x_ = x.copy()
# Convert into `uint8`
x_ = x_ * 255
x_ = x_.astype("uint8")
# Convert to 'L' mode
if x_.shape[-1] == 1:
x_ = np.reshape(x_, x_.shape[:-1])
# Compress one image per time
for i, xi in enumerate(x_):
if len(xi.shape) == 2:
xi = Image.fromarray(xi, mode="L")
elif xi.shape[-1] == 3:
xi = Image.fromarray(xi, mode="RGB")
else:
logger.log(level=40, msg="Currently only support `RGB` and `L` images.")
raise NotImplementedError("Currently only support `RGB` and `L` images.")
out = BytesIO()
xi.save(out, format="jpeg", quality=self.quality)
xi = Image.open(out)
xi = np.array(xi)
x_[i] = xi
del out
# Expand dim if black/white images
if len(x_.shape) < 4:
x_ = np.expand_dims(x_, 3)
# Convert to old dtype
x_ = x_ / 255.0
x_ = x_.astype(NUMPY_DTYPE)
# Swap channel index
if self.channel_index < 3:
x_ = np.swapaxes(x_, self.channel_index, 3)
x_ = np.clip(x_, clip_values[0], clip_values[1])
return x_
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies defence-specific checks before saving them as attributes.
:param quality: The image quality, on a scale from 1 (worst) to 95 (best). Values above 95 should be avoided.
:type quality: `int`
:param channel_index: Index of the axis in data containing the color channels or features.
:type channel_index: `int`
"""
# Save defense-specific parameters
super(JpegCompression, self).set_params(**kwargs)
if (
not isinstance(self.quality, (int, np.int))
or self.quality <= 0
or self.quality > 100
):
logger.error("Image quality must be a positive integer and smaller than 101.")
raise ValueError(
"Image quality must be a positive integer and smaller than 101."
)
if not isinstance(self.channel_index, (int, np.int)) or self.channel_index <= 0:
logger.error(
"Data channel must be a positive integer. The batch dimension is not a valid channel."
)
raise ValueError(
"Data channel must be a positive integer and smaller than 101."
)
return True
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies defence-specific checks before saving them as attributes.
:param quality: The image quality, on a scale from 1 (worst) to 95 (best). Values above 95 should be avoided.
:type quality: `int`
:param channel_index: Index of the axis in data containing the color channels or features.
:type channel_index: `int`
"""
# Save defense-specific parameters
super(JpegCompression, self).set_params(**kwargs)
if (
not isinstance(self.quality, (int, np.int))
or self.quality <= 0
or self.quality > 100
):
logger.error("Image quality must be a positive integer and smaller than 101.")
raise ValueError(
"Image quality must be a positive integer and smaller than 101."
)
if not isinstance(self.channel_index, (int, np.int)) or self.channel_index <= 0:
logger.error(
"Data channel must be a positive integer. The batch dimension is not a valid channel."
)
raise ValueError(
"Image quality must be a positive integer and smaller than 101."
)
return True
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __init__(self, prob=0.3, norm=2, lamb=0.5, solver="L-BFGS-B", max_iter=10):
"""
Create an instance of total variance minimization.
:param prob: Probability of the Bernoulli distribution.
:type prob: `float`
:param norm: The norm (positive integer).
:type norm: `int`
:param lamb: The lambda parameter in the objective function.
:type lamb: `float`
:param solver: Current support: L-BFGS-B, CG, Newton-CG
:type solver: `str`
:param max_iter: Maximum number of iterations in an optimization.
:type max_iter: `int`
"""
super(TotalVarMin, self).__init__()
self._is_fitted = True
self.set_params(prob=prob, norm=norm, lamb=lamb, solver=solver, max_iter=max_iter)
|
def __init__(self, prob=0.3, norm=2, lam=0.5, solver="L-BFGS-B", maxiter=10):
"""
Create an instance of total variance minimization.
:param prob: Probability of the Bernoulli distribution.
:type prob: `float`
:param norm: The norm (positive integer).
:type norm: `int`
:param lam: The lambda parameter in the objective function.
:type lam: `float`
:param solver: Current support: L-BFGS-B, CG, Newton-CG
:type solver: `string`
:param maxiter: Maximum number of iterations in an optimization.
:type maxiter: `int`
"""
super(TotalVarMin, self).__init__()
self._is_fitted = True
self.set_params(prob=prob, norm=norm, lam=lam, solver=solver, maxiter=maxiter)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def __call__(
self,
x,
y=None,
prob=None,
norm=None,
lamb=None,
solver=None,
max_iter=None,
clip_values=(0, 1),
):
"""
Apply total variance minimization to sample `x`.
:param x: Sample to compress with shape `(batch_size, width, height, depth)`.
:type x: `np.ndarray`
:param y: Labels of the sample `x`. This function does not affect them in any way.
:type y: `np.ndarray`
:param prob: Probability of the Bernoulli distribution.
:type prob: `float`
:param norm: The norm (positive integer).
:type norm: `int`
:param lamb: The lambda parameter in the objective function.
:type lamb: `float`
:param solver: Current support: L-BFGS-B, CG, Newton-CG
:type solver: `str`
:param max_iter: Maximum number of iterations in an optimization.
:type max_iter: `int`
:return: similar sample
:rtype: `np.ndarray`
"""
params = {}
if prob is not None:
params["prob"] = prob
if norm is not None:
params["norm"] = norm
if lamb is not None:
params["lamb"] = lamb
if solver is not None:
params["solver"] = solver
if max_iter is not None:
params["max_iter"] = max_iter
self.set_params(**params)
x_ = x.copy()
# Minimize one image at a time
for i, xi in enumerate(x_):
mask = (
np.random.rand(xi.shape[0], xi.shape[1], xi.shape[2]) < self.prob
).astype("int")
x_[i] = self._minimize(xi, mask)
x_ = np.clip(x_, clip_values[0], clip_values[1])
return x_.astype(NUMPY_DTYPE)
|
def __call__(
self,
x,
y=None,
prob=None,
norm=None,
lam=None,
solver=None,
maxiter=None,
clip_values=(0, 1),
):
"""
Apply total variance minimization to sample `x`.
:param x: Sample to compress with shape `(batch_size, width, height, depth)`.
:type x: `np.ndarray`
:param y: Labels of the sample `x`. This function does not affect them in any way.
:type y: `np.ndarray`
:param prob: Probability of the Bernoulli distribution.
:type prob: `float`
:param norm: The norm (positive integer).
:type norm: `int`
:param lam: The lambda parameter in the objective function.
:type lam: `float`
:param solver: Current support: L-BFGS-B, CG, Newton-CG
:type solver: `string`
:param maxiter: Maximum number of iterations in an optimization.
:type maxiter: `int`
:return: similar sample
:rtype: `np.ndarray`
"""
if prob is not None:
self.set_params(prob=prob)
if norm is not None:
self.set_params(norm=norm)
if lam is not None:
self.set_params(lam=lam)
if solver is not None:
self.set_params(solver=solver)
if maxiter is not None:
self.set_params(maxiter=maxiter)
x_ = x.copy()
# Minimize one image per time
for i, xi in enumerate(x_):
mask = (
np.random.rand(xi.shape[0], xi.shape[1], xi.shape[2]) < self.prob
).astype("int")
x_[i] = self._minimize(xi, mask)
x_ = np.clip(x_, clip_values[0], clip_values[1])
return x_.astype(NUMPY_DTYPE)
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _minimize(self, x, mask):
"""
Minimize the total variance objective function.
:param x: Original image.
:type x: `np.ndarray`
:param mask: A matrix that decides which points are kept.
:type mask: `np.ndarray`
:return: A new image.
:rtype: `np.ndarray`
"""
z = x.copy()
for i in range(x.shape[2]):
res = minimize(
self._loss_func,
z[:, :, i].flatten(),
(x[:, :, i], mask[:, :, i], self.norm, self.lamb),
method=self.solver,
jac=self._deri_loss_func,
options={"maxiter": self.max_iter},
)
z[:, :, i] = np.reshape(res.x, z[:, :, i].shape)
return z
|
def _minimize(self, x, mask):
"""
Minimize the total variance objective function.
:param x: Original image.
:type x: `np.ndarray`
:param mask: A matrix that decides which points are kept.
:type mask: `np.ndarray`
:return: A new image.
:rtype: `np.ndarray`
"""
z = x.copy()
for i in range(x.shape[2]):
res = minimize(
self._loss_func,
z[:, :, i].flatten(),
(x[:, :, i], mask[:, :, i], self.norm, self.lam),
method=self.solver,
jac=self._deri_loss_func,
options={"maxiter": self.maxiter},
)
z[:, :, i] = np.reshape(res.x, z[:, :, i].shape)
return z
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _loss_func(z, x, mask, norm, lamb):
"""
Loss function to be minimized.
:param z: Initial guess.
:type z: `np.ndarray`
:param x: Original image.
:type x: `np.ndarray`
:param mask: A matrix that decides which points are kept.
:type mask: `np.ndarray`
:param norm: The norm (positive integer).
:type norm: `int`
:param lamb: The lambda parameter in the objective function.
:type lamb: `float`
:return: Loss value.
:rtype: `float`
"""
res = np.sqrt(np.power(z - x.flatten(), 2).dot(mask.flatten()))
z = np.reshape(z, x.shape)
res += lamb * np.linalg.norm(z[1:, :] - z[:-1, :], norm, axis=1).sum()
res += lamb * np.linalg.norm(z[:, 1:] - z[:, :-1], norm, axis=0).sum()
return res
|
def _loss_func(self, z, x, mask, norm, lam):
"""
Loss function to be minimized.
:param z: Initial guess.
:type z: `np.ndarray`
:param x: Original image.
:type x: `np.ndarray`
:param mask: A matrix that decides which points are kept.
:type mask: `np.ndarray`
:param norm: The norm (positive integer).
:type norm: `int`
:param lam: The lambda parameter in the objective function.
:type lam: `float`
:return: Loss value.
:rtype: `float`
"""
res = np.sqrt(np.power(z - x.flatten(), 2).dot(mask.flatten()))
z = np.reshape(z, x.shape)
res += lam * np.linalg.norm(z[1:, :] - z[:-1, :], norm, axis=1).sum()
res += lam * np.linalg.norm(z[:, 1:] - z[:, :-1], norm, axis=0).sum()
return res
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _deri_loss_func(z, x, mask, norm, lamb):
"""
Derivative of loss function to be minimized.
:param z: Initial guess.
:type z: `np.ndarray`
:param x: Original image.
:type x: `np.ndarray`
:param mask: A matrix that decides which points are kept.
:type mask: `np.ndarray`
:param norm: The norm (positive integer).
:type norm: `int`
:param lamb: The lambda parameter in the objective function.
:type lamb: `float`
:return: Derivative value.
:rtype: `float`
"""
# First compute the derivative of the first component of the loss function
nor1 = np.sqrt(np.power(z - x.flatten(), 2).dot(mask.flatten()))
if nor1 < 1e-6:
nor1 = 1e-6
der1 = ((z - x.flatten()) * mask.flatten()) / (nor1 * 1.0)
# Then compute the derivative of the second component of the loss function
z = np.reshape(z, x.shape)
if norm == 1:
z_d1 = np.sign(z[1:, :] - z[:-1, :])
z_d2 = np.sign(z[:, 1:] - z[:, :-1])
else:
z_d1_norm = np.power(
np.linalg.norm(z[1:, :] - z[:-1, :], norm, axis=1), norm - 1
)
z_d2_norm = np.power(
np.linalg.norm(z[:, 1:] - z[:, :-1], norm, axis=0), norm - 1
)
z_d1_norm[z_d1_norm < 1e-6] = 1e-6
z_d2_norm[z_d2_norm < 1e-6] = 1e-6
z_d1_norm = np.repeat(z_d1_norm[:, np.newaxis], z.shape[1], axis=1)
z_d2_norm = np.repeat(z_d2_norm[np.newaxis, :], z.shape[0], axis=0)
z_d1 = norm * np.power(z[1:, :] - z[:-1, :], norm - 1) / z_d1_norm
z_d2 = norm * np.power(z[:, 1:] - z[:, :-1], norm - 1) / z_d2_norm
der2 = np.zeros(z.shape)
der2[:-1, :] -= z_d1
der2[1:, :] += z_d1
der2[:, :-1] -= z_d2
der2[:, 1:] += z_d2
der2 = lamb * der2.flatten()
# Total derivative
return der1 + der2
|
def _deri_loss_func(z, x, mask, norm, lam):
"""
Derivative of loss function to be minimized.
:param z: Initial guess.
:type z: `np.ndarray`
:param x: Original image.
:type x: `np.ndarray`
:param mask: A matrix that decides which points are kept.
:type mask: `np.ndarray`
:param norm: The norm (positive integer).
:type norm: `int`
:param lam: The lambda parameter in the objective function.
:type lam: `float`
:return: Derivative value.
:rtype: `float`
"""
# First compute the derivative of the first component of the loss function
nor1 = np.sqrt(np.power(z - x.flatten(), 2).dot(mask.flatten()))
if nor1 < 1e-6:
nor1 = 1e-6
der1 = ((z - x.flatten()) * mask.flatten()) / (nor1 * 1.0)
# Then compute the derivative of the second component of the loss function
z = np.reshape(z, x.shape)
if norm == 1:
z_d1 = np.sign(z[1:, :] - z[:-1, :])
z_d2 = np.sign(z[:, 1:] - z[:, :-1])
else:
z_d1_norm = np.power(
np.linalg.norm(z[1:, :] - z[:-1, :], norm, axis=1), norm - 1
)
z_d2_norm = np.power(
np.linalg.norm(z[:, 1:] - z[:, :-1], norm, axis=0), norm - 1
)
z_d1_norm[z_d1_norm < 1e-6] = 1e-6
z_d2_norm[z_d2_norm < 1e-6] = 1e-6
z_d1_norm = np.repeat(z_d1_norm[:, np.newaxis], z.shape[1], axis=1)
z_d2_norm = np.repeat(z_d2_norm[np.newaxis, :], z.shape[0], axis=0)
z_d1 = norm * np.power(z[1:, :] - z[:-1, :], norm - 1) / z_d1_norm
z_d2 = norm * np.power(z[:, 1:] - z[:, :-1], norm - 1) / z_d2_norm
der2 = np.zeros(z.shape)
der2[:-1, :] -= z_d1
der2[1:, :] += z_d1
der2[:, :-1] -= z_d2
der2[:, 1:] += z_d2
der2 = lam * der2.flatten()
# Total derivative
der = der1 + der2
return der
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies defence-specific checks before saving them as attributes.
:param prob: Probability of the Bernoulli distribution.
:type prob: `float`
:param norm: The norm (positive integer).
:type norm: `int`
:param lamb: The lambda parameter in the objective function.
:type lamb: `float`
:param solver: Current support: L-BFGS-B, CG, Newton-CG.
:type solver: `str`
:param max_iter: Maximum number of iterations in an optimization.
:type max_iter: `int`
"""
# Save defense-specific parameters
super(TotalVarMin, self).set_params(**kwargs)
if not isinstance(self.prob, (float, int)) or self.prob < 0.0 or self.prob > 1.0:
logger.error("Probability must be between 0 and 1.")
raise ValueError("Probability must be between 0 and 1.")
if not isinstance(self.norm, (int, np.int)) or self.norm <= 0:
logger.error("Norm must be a positive integer.")
raise ValueError("Norm must be a positive integer.")
if not (
self.solver == "L-BFGS-B" or self.solver == "CG" or self.solver == "Newton-CG"
):
logger.error("Current support only L-BFGS-B, CG, Newton-CG.")
raise ValueError("Current support only L-BFGS-B, CG, Newton-CG.")
if not isinstance(self.max_iter, (int, np.int)) or self.max_iter <= 0:
logger.error("Number of iterations must be a positive integer.")
raise ValueError("Number of iterations must be a positive integer.")
return True
|
def set_params(self, **kwargs):
"""
Take in a dictionary of parameters and applies defence-specific checks before saving them as attributes.
:param prob: Probability of the Bernoulli distribution.
:type prob: `float`
:param norm: The norm (positive integer).
:type norm: `int`
:param lam: The lambda parameter in the objective function.
:type lam: `float`
:param solver: Current support: L-BFGS-B, CG, Newton-CG
:type solver: `string`
:param maxiter: Maximum number of iterations in an optimization.
:type maxiter: `int`
"""
# Save defense-specific parameters
super(TotalVarMin, self).set_params(**kwargs)
if not isinstance(self.prob, (float, int)) or self.prob < 0.0 or self.prob > 1.0:
logger.error("Probability must be between 0 and 1.")
raise ValueError("Probability must be between 0 and 1.")
if not isinstance(self.norm, (int, np.int)) or self.norm <= 0:
logger.error("Norm must be a positive integer.")
raise ValueError("Norm must be a positive integer.")
if not (
self.solver == "L-BFGS-B" or self.solver == "CG" or self.solver == "Newton-CG"
):
logger.error("Current support only L-BFGS-B, CG, Newton-CG.")
raise ValueError("Current support only L-BFGS-B, CG, Newton-CG.")
if not isinstance(self.maxiter, (int, np.int)) or self.maxiter <= 0:
logger.error("Number of iterations must be a positive integer.")
raise ValueError("Number of iterations must be a positive integer.")
return True
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def evaluate_defence(self, is_clean, **kwargs):
"""
Returns confusion matrix.
:param is_clean: ground truth, where is_clean[i]=1 means that x_train[i] is clean and is_clean[i]=0 means
x_train[i] is poisonous
:type is_clean: :class `list`
:param kwargs: a dictionary of defence-specific parameters
:type kwargs: `dict`
:return: JSON object with confusion matrix
:rtype: `jsonObject`
"""
self.set_params(**kwargs)
if not self.activations_by_class:
activations = self._get_activations()
self.activations_by_class = self._segment_by_class(activations, self.y_train)
self.clusters_by_class, self.red_activations_by_class = self.cluster_activations()
report, self.assigned_clean_by_class = self.analyze_clusters()
# Now check ground truth:
self.is_clean_by_class = self._segment_by_class(is_clean, self.y_train)
self.errors_by_class, conf_matrix_json = self.evaluator.analyze_correctness(
self.assigned_clean_by_class, self.is_clean_by_class
)
return conf_matrix_json
|
def evaluate_defence(self, is_clean, **kwargs):
"""
Returns confusion matrix.
:param is_clean: ground truth, where is_clean[i]=1 means that x_train[i] is clean and is_clean[i]=0 means
x_train[i] is poisonous
:type is_clean: :class `list`
:param kwargs: a dictionary of defence-specific parameters
:type kwargs: `dict`
:return: JSON object with confusion matrix
:rtype: `jsonObject`
"""
self.set_params(**kwargs)
if not self.activations_by_class:
activations = self._get_activations()
self.activations_by_class = self._segment_by_class(activations, self.y_train)
self.clusters_by_class, self.red_activations_by_class = self.cluster_activations()
self.assigned_clean_by_class = self.analyze_clusters()
# Now check ground truth:
self.is_clean_by_class = self._segment_by_class(is_clean, self.y_train)
self.errors_by_class, conf_matrix_json = self.evaluator.analyze_correctness(
self.assigned_clean_by_class, self.is_clean_by_class
)
return conf_matrix_json
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def detect_poison(self, **kwargs):
"""
Returns poison detected and a report.
:param kwargs: a dictionary of detection-specific parameters
:type kwargs: `dict`
:return: (report, is_clean_lst):
where a report is a dictionary that contains information specified by the clustering analysis technique.
where is_clean is a list, where is_clean_lst[i]=1 means that x_train[i]
there is clean and is_clean_lst[i]=0, means that x_train[i] was classified as poison
:rtype: `tuple`
"""
self.set_params(**kwargs)
if not self.activations_by_class:
activations = self._get_activations()
self.activations_by_class = self._segment_by_class(activations, self.y_train)
self.clusters_by_class, self.red_activations_by_class = self.cluster_activations()
report, self.assigned_clean_by_class = self.analyze_clusters()
# Here, assigned_clean_by_class[i][j] is 1 if the jth datapoint in the ith class was
# determined to be clean by activation cluster
# Build an array that matches the original indexes of x_train
n_train = len(self.x_train)
indices_by_class = self._segment_by_class(np.arange(n_train), self.y_train)
self.is_clean_lst = [0] * n_train
for assigned_clean, dp in zip(self.assigned_clean_by_class, indices_by_class):
for assignment, index_dp in zip(assigned_clean, dp):
if assignment == 1:
self.is_clean_lst[index_dp] = 1
return report, self.is_clean_lst
|
def detect_poison(self, **kwargs):
"""
Returns poison detected.
:param kwargs: a dictionary of detection-specific parameters
:type kwargs: `dict`
:return: 1) confidence_level, 2) is_clean_lst : type List[int], where is_clean_lst[i]=1 means that x_train[i]
there is clean and is_clean_lst[i]=0, means that x_train[i] was classified as poison
:rtype: `tuple`
"""
self.set_params(**kwargs)
if not self.activations_by_class:
activations = self._get_activations()
self.activations_by_class = self._segment_by_class(activations, self.y_train)
self.clusters_by_class, self.red_activations_by_class = self.cluster_activations()
self.assigned_clean_by_class = self.analyze_clusters()
# Here, assigned_clean_by_class[i][j] is 1 if the jth datapoint in the ith class was
# determined to be clean by activation cluster
# Build an array that matches the original indexes of x_train
n_train = len(self.x_train)
indices_by_class = self._segment_by_class(np.arange(n_train), self.y_train)
self.is_clean_lst = [0] * n_train
self.confidence_level = [1] * n_train
for assigned_clean, dp in zip(self.assigned_clean_by_class, indices_by_class):
for assignment, index_dp in zip(assigned_clean, dp):
if assignment == 1:
self.is_clean_lst[index_dp] = 1
return self.confidence_level, self.is_clean_lst
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def analyze_clusters(self, **kwargs):
"""
This function analyzes the clusters according to the provided method
:param kwargs: a dictionary of cluster-analysis-specific parameters
:type kwargs: `dict`
:return: assigned_clean_by_class, an array of arrays that contains what data points where classified as clean.
:rtype: `np.ndarray`
"""
self.set_params(**kwargs)
if not self.clusters_by_class:
self.cluster_activations()
analyzer = ClusteringAnalyzer()
if self.cluster_analysis == "smaller":
self.assigned_clean_by_class, self.poisonous_clusters, report = (
analyzer.analyze_by_size(self.clusters_by_class)
)
elif self.cluster_analysis == "relative-size":
self.assigned_clean_by_class, self.poisonous_clusters, report = (
analyzer.analyze_by_relative_size(self.clusters_by_class)
)
elif self.cluster_analysis == "distance":
self.assigned_clean_by_class, self.poisonous_clusters, report = (
analyzer.analyze_by_distance(
self.clusters_by_class,
separated_activations=self.red_activations_by_class,
)
)
elif self.cluster_analysis == "silhouette-scores":
self.assigned_clean_by_class, self.poisonous_clusters, report = (
analyzer.analyze_by_silhouette_score(
self.clusters_by_class,
reduced_activations_by_class=self.red_activations_by_class,
)
)
else:
raise ValueError(
"Unsupported cluster analysis technique " + self.cluster_analysis
)
# Add to the report current parameters used to run the defence and the analysis summary
report = dict(list(report.items()) + list(self.get_params().items()))
return report, self.assigned_clean_by_class
|
def analyze_clusters(self, **kwargs):
"""
This function analyzes the clusters according to the provided method
:param kwargs: a dictionary of cluster-analysis-specific parameters
:type kwargs: `dict`
:return: assigned_clean_by_class, an array of arrays that contains what data points where classified as clean.
:rtype: `np.ndarray`
"""
self.set_params(**kwargs)
if not self.clusters_by_class:
self.cluster_activations()
analyzer = ClusteringAnalyzer()
if self.cluster_analysis == "smaller":
self.assigned_clean_by_class, self.poisonous_clusters = (
analyzer.analyze_by_size(self.clusters_by_class)
)
elif self.cluster_analysis == "relative-size":
self.assigned_clean_by_class, self.poisonous_clusters = (
analyzer.analyze_by_relative_size(self.clusters_by_class)
)
elif self.cluster_analysis == "distance":
self.assigned_clean_by_class, self.poisonous_clusters = (
analyzer.analyze_by_distance(
self.clusters_by_class,
separated_activations=self.red_activations_by_class,
)
)
elif self.cluster_analysis == "silhouette-scores":
self.assigned_clean_by_class, self.poisonous_clusters = (
analyzer.analyze_by_sihouette_score(
self.clusters_by_class,
reduced_activations_by_class=self.red_activations_by_class,
)
)
else:
raise ValueError(
"Unsupported cluster analysis technique " + self.cluster_analysis
)
return self.assigned_clean_by_class
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def analyze_by_size(self, separated_clusters):
"""
Designates as poisonous the cluster with less number of items on it.
:param separated_clusters: list where separated_clusters[i] is the cluster assignments for the ith class
:type separated_clusters: `list`
:return: all_assigned_clean, summary_poison_clusters, report:
where all_assigned_clean[i] is a 1D boolean array indicating whether
a given data point was determined to be clean (as opposed to poisonous) and
summary_poison_clusters: array, where summary_poison_clusters[i][j]=1 if cluster j of class i was classified as
poison, otherwise 0
report: Dictionary with summary of the analysis
:rtype: all_assigned_clean: `ndarray`, summary_poison_clusters: `list`, report" `dic`
"""
report = {"cluster_analysis": "smaller", "suspicious_clusters": 0}
all_assigned_clean = []
nb_classes = len(separated_clusters)
nb_clusters = len(np.unique(separated_clusters[0]))
summary_poison_clusters = [
[[] for x in range(nb_clusters)] for y in range(nb_classes)
]
for i, clusters in enumerate(separated_clusters):
# assume that smallest cluster is poisonous and all others are clean
sizes = np.bincount(clusters)
total_dp_in_class = np.sum(sizes)
poison_clusters = [np.argmin(sizes)]
clean_clusters = list(set(clusters) - set(poison_clusters))
for p_id in poison_clusters:
summary_poison_clusters[i][p_id] = 1
for c_id in clean_clusters:
summary_poison_clusters[i][c_id] = 0
assigned_clean = self.assign_class(clusters, clean_clusters, poison_clusters)
all_assigned_clean.append(assigned_clean)
# Generate report for this class:
report_class = dict()
for cluster_id in range(nb_clusters):
ptc = sizes[cluster_id] / total_dp_in_class
susp = cluster_id in poison_clusters
dict_i = dict(ptc_data_in_cluster=round(ptc, 2), suspicious_cluster=susp)
dict_cluster = {"cluster_" + str(cluster_id): dict_i}
report_class.update(dict_cluster)
report_class["nb_suspicious_clusters"] = len(poison_clusters)
report["Class_" + str(i)] = report_class
report["suspicious_clusters"] = report["suspicious_clusters"] + np.sum(
summary_poison_clusters
)
return np.asarray(all_assigned_clean), summary_poison_clusters, report
|
def analyze_by_size(self, separated_clusters):
"""
Designates as poisonous the cluster with less number of items on it.
:param separated_clusters: list where separated_clusters[i] is the cluster assignments for the ith class
:type separated_clusters: `list`
:return: all_assigned_clean, summary_poison_clusters:
where all_assigned_clean[i] is a 1D boolean array indicating whether
a given data point was determined to be clean (as opposed to poisonous) and
summary_poison_clusters: array, where summary_poison_clusters[i][j]=1 if cluster j of class i was classified as
poison, otherwise 0
:rtype: all_assigned_clean: `ndarray`, summary_poison_clusters: `list`
"""
all_assigned_clean = []
nb_classes = len(separated_clusters)
nb_clusters = len(np.unique(separated_clusters[0]))
summary_poison_clusters = [
[[] for x in range(nb_clusters)] for y in range(nb_classes)
]
for i, clusters in enumerate(separated_clusters):
# assume that smallest cluster is poisonous and all others are clean
poison_clusters = [np.argmin(np.bincount(clusters))]
clean_clusters = list(set(clusters) - set(poison_clusters))
for p_id in poison_clusters:
summary_poison_clusters[i][p_id] = 1
for c_id in clean_clusters:
summary_poison_clusters[i][c_id] = 0
assigned_clean = self.assign_class(clusters, clean_clusters, poison_clusters)
all_assigned_clean.append(assigned_clean)
return np.asarray(all_assigned_clean), summary_poison_clusters
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def analyze_by_distance(self, separated_clusters, separated_activations):
"""
Assigns a cluster as poisonous if its median activation is closer to the median activation for another class
than it is to the median activation of its own class. Currently, this function assumes there are only
two clusters per class.
:param separated_clusters: list where separated_clusters[i] is the cluster assignments for the ith class
:type separated_clusters: `list`
:param separated_activations: list where separated_activations[i] is a 1D array of [0,1] for [poison,clean]
:type separated_clusters: `list`
:return: all_assigned_clean, summary_poison_clusters, report:
where all_assigned_clean[i] is a 1D boolean array indicating whether
a given data point was determined to be clean (as opposed to poisonous) and
summary_poison_clusters: array, where summary_poison_clusters[i][j]=1 if cluster j of class i was classified as
poison, otherwise 0
report: Dictionary with summary of the analysis
:rtype: all_assigned_clean: `ndarray`, summary_poison_clusters: `list`, report" `dic`
"""
report = {"cluster_analysis": "distance"}
all_assigned_clean = []
cluster_centers = []
nb_classes = len(separated_clusters)
nb_clusters = len(np.unique(separated_clusters[0]))
summary_poison_clusters = [
[[] for x in range(nb_clusters)] for y in range(nb_classes)
]
# assign centers
for t, activations in enumerate(separated_activations):
cluster_centers.append(np.median(activations, axis=0))
for i, (clusters, ac) in enumerate(zip(separated_clusters, separated_activations)):
clusters = np.array(clusters)
cluster0_center = np.median(ac[np.where(clusters == 0)], axis=0)
cluster1_center = np.median(ac[np.where(clusters == 1)], axis=0)
cluster0_distance = np.linalg.norm(cluster0_center - cluster_centers[i])
cluster1_distance = np.linalg.norm(cluster1_center - cluster_centers[i])
cluster0_is_poison = False
cluster1_is_poison = False
dict_k = dict()
dict_cluster_0 = dict(cluster0_distance_to_its_class=cluster0_distance)
dict_cluster_1 = dict(cluster1_distance_to_its_class=cluster1_distance)
for k, center in enumerate(cluster_centers):
if k == i:
pass
else:
cluster0_distance_to_k = np.linalg.norm(cluster0_center - center)
cluster1_distance_to_k = np.linalg.norm(cluster1_center - center)
if (
cluster0_distance_to_k < cluster0_distance
and cluster1_distance_to_k > cluster1_distance
):
cluster0_is_poison = True
if (
cluster1_distance_to_k < cluster1_distance
and cluster0_distance_to_k > cluster0_distance
):
cluster1_is_poison = True
dict_cluster_0["distance_to_class_" + str(k)] = cluster0_distance_to_k
dict_cluster_0["suspicious"] = cluster0_is_poison
dict_cluster_1["distance_to_class_" + str(k)] = cluster1_distance_to_k
dict_cluster_1["suspicious"] = cluster1_is_poison
dict_k.update(dict_cluster_0)
dict_k.update(dict_cluster_1)
report_class = dict(cluster_0=dict_cluster_0, cluster_1=dict_cluster_1)
report["Class_" + str(i)] = report_class
poison_clusters = []
if cluster0_is_poison:
poison_clusters.append(0)
summary_poison_clusters[i][0] = 1
else:
summary_poison_clusters[i][0] = 0
if cluster1_is_poison:
poison_clusters.append(1)
summary_poison_clusters[i][1] = 1
else:
summary_poison_clusters[i][1] = 0
clean_clusters = list(set(clusters) - set(poison_clusters))
assigned_clean = self.assign_class(clusters, clean_clusters, poison_clusters)
all_assigned_clean.append(assigned_clean)
all_assigned_clean = np.asarray(all_assigned_clean)
return all_assigned_clean, summary_poison_clusters, report
|
def analyze_by_distance(self, separated_clusters, separated_activations):
"""
Assigns a cluster as poisonous if its median activation is closer to the median activation for another class
than it is to the median activation of its own class. Currently, this function assumed there are only
two clusters per class.
:param separated_clusters: list where separated_clusters[i] is the cluster assignments for the ith class
:type separated_clusters: `list`
:param separated_activations: list where separated_activations[i] is a 1D array of [0,1] for [poison,clean]
:type separated_clusters: `list`
:return: all_assigned_clean, summary_poison_clusters:
where all_assigned_clean[i] is a 1D boolean array indicating whether
a given data point was determined to be clean (as opposed to poisonous) and
summary_poison_clusters: array, where summary_poison_clusters[i][j]=1 if cluster j of class i was classified as
poison, otherwise 0
:rtype: all_assigned_clean: `ndarray`, summary_poison_clusters: `list`
"""
all_assigned_clean = []
cluster_centers = []
nb_classes = len(separated_clusters)
nb_clusters = len(np.unique(separated_clusters[0]))
summary_poison_clusters = [
[[] for x in range(nb_clusters)] for y in range(nb_classes)
]
# assign centers
for t, activations in enumerate(separated_activations):
cluster_centers.append(np.median(activations, axis=0))
for i, (clusters, ac) in enumerate(zip(separated_clusters, separated_activations)):
clusters = np.array(clusters)
cluster0_center = np.median(ac[np.where(clusters == 0)], axis=0)
cluster1_center = np.median(ac[np.where(clusters == 1)], axis=0)
cluster0_distance = np.linalg.norm(cluster0_center - cluster_centers[i])
cluster1_distance = np.linalg.norm(cluster1_center - cluster_centers[i])
cluster0_is_poison = False
cluster1_is_poison = False
for k, center in enumerate(cluster_centers):
if k == i:
pass
else:
cluster0_distance_to_k = np.linalg.norm(cluster0_center - center)
cluster1_distance_to_k = np.linalg.norm(cluster1_center - center)
if (
cluster0_distance_to_k < cluster0_distance
and cluster1_distance_to_k > cluster1_distance
):
cluster0_is_poison = True
if (
cluster1_distance_to_k < cluster1_distance
and cluster0_distance_to_k > cluster0_distance
):
cluster1_is_poison = True
poison_clusters = []
if cluster0_is_poison:
poison_clusters.append(0)
summary_poison_clusters[i][0] = 1
else:
summary_poison_clusters[i][0] = 0
if cluster1_is_poison:
poison_clusters.append(1)
summary_poison_clusters[i][1] = 1
else:
summary_poison_clusters[i][1] = 0
clean_clusters = list(set(clusters) - set(poison_clusters))
assigned_clean = self.assign_class(clusters, clean_clusters, poison_clusters)
all_assigned_clean.append(assigned_clean)
all_assigned_clean = np.asarray(all_assigned_clean)
return all_assigned_clean, summary_poison_clusters
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def analyze_by_relative_size(self, separated_clusters, size_threshold=0.35, r_size=2):
"""
Assigns a cluster as poisonous if the smaller one contains less than threshold of the data.
This method assumes only 2 clusters
:param separated_clusters: list where separated_clusters[i] is the cluster assignments for the ith class
:type separated_clusters: `list`
:param size_threshold: (optional) threshold used to define when a cluster is substantially smaller. A default
value is used if the parameter is not provided.
:type size_threshold: `float`
:param r_size: Round number used for size rate comparisons.
:type r_size `int`
:return: all_assigned_clean, summary_poison_clusters, report:
where all_assigned_clean[i] is a 1D boolean array indicating whether
a given data point was determined to be clean (as opposed to poisonous) and
summary_poison_clusters: array, where summary_poison_clusters[i][j]=1 if cluster j of class i was classified as
poison, otherwise 0
report: Dictionary with summary of the analysis
:rtype: all_assigned_clean: `ndarray`, summary_poison_clusters: `list`, report" `dic`
"""
size_threshold = round(size_threshold, r_size)
report = {
"cluster_analysis": "relative_size",
"suspicious_clusters": 0,
"size_threshold": size_threshold,
}
all_assigned_clean = []
nb_classes = len(separated_clusters)
nb_clusters = len(np.unique(separated_clusters[0]))
summary_poison_clusters = [
[[] for x in range(nb_clusters)] for y in range(nb_classes)
]
for i, clusters in enumerate(separated_clusters):
sizes = np.bincount(clusters)
total_dp_in_class = np.sum(sizes)
if np.size(sizes) > 2:
raise ValueError(
" RelativeSizeAnalyzer does not support more than two clusters."
)
percentages = np.round(sizes / float(np.sum(sizes)), r_size)
poison_clusters = np.where(percentages < size_threshold)
clean_clusters = np.where(percentages >= size_threshold)
for p_id in poison_clusters[0]:
summary_poison_clusters[i][p_id] = 1
for c_id in clean_clusters[0]:
summary_poison_clusters[i][c_id] = 0
assigned_clean = self.assign_class(clusters, clean_clusters, poison_clusters)
all_assigned_clean.append(assigned_clean)
# Generate report for this class:
report_class = dict()
for cluster_id in range(nb_clusters):
ptc = sizes[cluster_id] / total_dp_in_class
susp = cluster_id in poison_clusters
dict_i = dict(ptc_data_in_cluster=round(ptc, 2), suspicious_cluster=susp)
dict_cluster = {"cluster_" + str(cluster_id): dict_i}
report_class.update(dict_cluster)
report_class["nb_suspicious_clusters"] = len(poison_clusters)
report["Class_" + str(i)] = report_class
report["suspicious_clusters"] = report["suspicious_clusters"] + np.sum(
summary_poison_clusters
)
return np.asarray(all_assigned_clean), summary_poison_clusters, report
|
def analyze_by_relative_size(self, separated_clusters, size_threshold=0.35):
"""
Assigns a cluster as poisonous if the smaller one contains less than threshold of the data.
This method assumes only 2 clusters
:param separated_clusters: list where separated_clusters[i] is the cluster assignments for the ith class
:type separated_clusters: `list`
:param size_threshold: (optional) threshold used to define when a cluster is substantially smaller. A default
value is used if the parameter is not provided.
:type size_threshold: `float`
:return: all_assigned_clean, summary_poison_clusters:
where all_assigned_clean[i] is a 1D boolean array indicating whether
a given data point was determined to be clean (as opposed to poisonous) and
summary_poison_clusters: array, where summary_poison_clusters[i][j]=1 if cluster j of class i was classified as
poison, otherwise 0
:rtype: all_assigned_clean: `ndarray`, summary_poison_clusters: `list`
"""
all_assigned_clean = []
nb_classes = len(separated_clusters)
nb_clusters = len(np.unique(separated_clusters[0]))
summary_poison_clusters = [
[[] for x in range(nb_clusters)] for y in range(nb_classes)
]
for i, clusters in enumerate(separated_clusters):
bins = np.bincount(clusters)
if np.size(bins) > 2:
raise ValueError(
" RelativeSizeAnalyzer does not support more than two clusters."
)
percentages = bins / float(np.sum(bins))
poison_clusters = np.where(percentages < size_threshold)
clean_clusters = np.where(percentages >= size_threshold)
for p_id in poison_clusters[0]:
summary_poison_clusters[i][p_id] = 1
for c_id in clean_clusters[0]:
summary_poison_clusters[i][c_id] = 0
assigned_clean = self.assign_class(clusters, clean_clusters, poison_clusters)
all_assigned_clean.append(assigned_clean)
return np.asarray(all_assigned_clean), summary_poison_clusters
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def detect_poison(self, **kwargs):
"""
Detect poison.
:param kwargs: Defence-specific parameters used by child classes.
:type kwargs: `dict`
:return: `(dict, list)` dictionary with report and list with items identified as poison
"""
raise NotImplementedError
|
def detect_poison(self, **kwargs):
"""
Detect poison.
:param kwargs: Defence-specific parameters used by child classes.
:type kwargs: `dict`
:return: `list` with items identified as poison
"""
raise NotImplementedError
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def random_sphere(nb_points, nb_dims, radius, norm):
"""
Generate randomly `m x n`-dimension points with radius `radius` and centered around 0.
:param nb_points: Number of random data points
:type nb_points: `int`
:param nb_dims: Dimensionality
:type nb_dims: `int`
:param radius: Radius
:type radius: `float`
:param norm: Current support: 1, 2, np.inf
:type norm: `int`
:return: The generated random sphere
:rtype: `np.ndarray`
"""
if norm == 1:
a = np.zeros(shape=(nb_points, nb_dims + 1))
a[:, -1] = np.sqrt(np.random.uniform(0, radius**2, nb_points))
for i in range(nb_points):
a[i, 1:-1] = np.sort(np.random.uniform(0, a[i, -1], nb_dims - 1))
res = (a[:, 1:] - a[:, :-1]) * np.random.choice([-1, 1], (nb_points, nb_dims))
elif norm == 2:
from scipy.special import gammainc
a = np.random.randn(nb_points, nb_dims)
s2 = np.sum(a**2, axis=1)
base = gammainc(nb_dims / 2.0, s2 / 2.0) ** (1 / nb_dims) * radius / np.sqrt(s2)
res = a * (np.tile(base, (nb_dims, 1))).T
elif norm == np.inf:
res = np.random.uniform(float(-radius), float(radius), (nb_points, nb_dims))
else:
raise NotImplementedError("Norm {} not supported".format(norm))
return res
|
def random_sphere(nb_points, nb_dims, radius, norm):
"""
Generate randomly `m x n`-dimension points with radius `r` and centered around 0.
:param nb_points: Number of random data points
:type nb_points: `int`
:param nb_dims: Dimensionality
:type nb_dims: `int`
:param radius: Radius
:type radius: `float`
:param norm: Current support: 1, 2, np.inf
:type norm: `int`
:return: The generated random sphere
:rtype: `np.ndarray`
"""
if norm == 1:
a = np.zeros(shape=(nb_points, nb_dims + 1))
a[:, -1] = np.sqrt(np.random.uniform(0, radius**2, nb_points))
for i in range(nb_points):
a[i, 1:-1] = np.sort(np.random.uniform(0, a[i, -1], nb_dims - 1))
res = (a[:, 1:] - a[:, :-1]) * np.random.choice([-1, 1], (nb_points, nb_dims))
elif norm == 2:
from scipy.special import gammainc
a = np.random.randn(nb_points, nb_dims)
s2 = np.sum(a**2, axis=1)
base = gammainc(nb_dims / 2.0, s2 / 2.0) ** (1 / nb_dims) * radius / np.sqrt(s2)
res = a * (np.tile(base, (nb_dims, 1))).T
elif norm == np.inf:
res = np.random.uniform(float(-radius), float(radius), (nb_points, nb_dims))
else:
raise NotImplementedError("Norm {} not supported".format(norm))
return res
|
https://github.com/Trusted-AI/adversarial-robustness-toolbox/issues/29
|
Traceback (most recent call last):
File "cw_pytorch.py", line 172, in <module>
x_test_adv = cl2m.generate(inputs, **params)
File "/home/weitian/anaconda3/envs/xnor/lib/python3.6/site-packages/art/attacks/carlini.py", line 380, in generate
x_adv_batch_tanh[active_and_update_adv] = x_adv_batch_tanh[update_adv] + \
IndexError: boolean index did not match indexed array along dimension 0; dimension is 18 but corresponding boolean dimension is 17
|
IndexError
|
def _expand_non_flag(
self, at: int, ini_dir: Path, line: str, result: List[str]
) -> None: # noqa
try:
at = line.index(" --hash")
requirement, hash_part = line[:at], re.sub(r"\s+", " ", line[at + 1 :])
except ValueError:
requirement, hash_part = line, ""
try:
req = Requirement(requirement)
except InvalidRequirement as exc:
if is_url(line) or any(
line.startswith(f"{v}+") and is_url(line[len(v) + 1 :]) for v in VCS
):
result.append(line)
else:
path = ini_dir / line
try:
is_valid_file = path.exists() and (path.is_file() or path.is_dir())
except OSError: # https://bugs.python.org/issue42855 # pragma: no cover
is_valid_file = False # pragma: no cover
if not is_valid_file:
raise ValueError(f"{at}: {line}") from exc
result.append(str(path))
else:
entry = str(req)
if hash_part:
entry = f"{entry} {hash_part}"
result.append(entry)
|
def _expand_non_flag(
self, at: int, ini_dir: Path, line: str, result: List[str]
) -> None: # noqa
try:
req = Requirement(line)
except InvalidRequirement as exc:
if is_url(line) or any(
line.startswith(f"{v}+") and is_url(line[len(v) + 1 :]) for v in VCS
):
result.append(line)
else:
path = ini_dir / line
try:
is_valid_file = path.exists() and (path.is_file() or path.is_dir())
except OSError: # https://bugs.python.org/issue42855 # pragma: no cover
is_valid_file = False # pragma: no cover
if not is_valid_file:
raise ValueError(f"{at}: {line}") from exc
result.append(str(path))
else:
result.append(str(req))
|
https://github.com/tox-dev/tox/issues/1903
|
$ python -m tox -rvv -e py39
ROOT: 255 D setup logging to DEBUG on pid 45306 [tox/report.py:211]
ROOT: 261 W remove tox env folder /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39 [tox/tox_env/api.py:190]
ROOT: 334 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=9) [virtualenv/discovery/builtin.py:62]
ROOT: 334 I proposed PythonInfo(spec=CPython3.9.1.final.0-64, exe=/Users/chainz/.pyenv/versions/3.9.1/bin/python, platform=darwin, version='3.9.1 (default, Jan 21 2021, 09:04:53) \n[Clang 12.0.0 (clang-1200.0.32.28)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:69]
ROOT: 334 D accepted PythonInfo(spec=CPython3.9.1.final.0-64, exe=/Users/chainz/.pyenv/versions/3.9.1/bin/python, platform=darwin, version='3.9.1 (default, Jan 21 2021, 09:04:53) \n[Clang 12.0.0 (clang-1200.0.32.28)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:71]
ROOT: 336 D filesystem is not case-sensitive [virtualenv/info.py:28]
ROOT: 388 I create virtual environment via CPython3Posix(dest=/Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 388 D delete /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39 [virtualenv/create/creator.py:169]
ROOT: 388 D create folder /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin [virtualenv/util/path/_sync.py:25]
ROOT: 389 D create folder /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 389 D write /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 389 D home = /Users/chainz/.pyenv/versions/3.9.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 389 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 389 D version_info = 3.9.1.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 389 D virtualenv = 20.4.2 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 389 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 389 D base-prefix = /Users/chainz/.pyenv/versions/3.9.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 389 D base-exec-prefix = /Users/chainz/.pyenv/versions/3.9.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 389 D base-executable = /Users/chainz/.pyenv/versions/3.9.1/bin/python [virtualenv/create/pyenv_cfg.py:38]
ROOT: 390 D symlink /Users/chainz/.pyenv/versions/3.9.1/bin/python to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 390 D create virtualenv import hook file /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 391 D create /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 391 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 392 D debug via /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/python /Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:224]
ROOT: 392 D {
"sys": {
"executable": "/Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/python",
"_base_executable": "/Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/python",
"prefix": "/Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39",
"base_prefix": "/Users/chainz/.pyenv/versions/3.9.1",
"real_prefix": null,
"exec_prefix": "/Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39",
"base_exec_prefix": "/Users/chainz/.pyenv/versions/3.9.1",
"path": [
"/Users/chainz/.pyenv/versions/3.9.1/lib/python39.zip",
"/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9",
"/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/lib-dynload",
"/Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.9.1 (default, Jan 21 2021, 09:04:53) \n[Clang 12.0.0 (clang-1200.0.32.28)]",
"makefile_filename": "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/config-3.9-darwin/Makefile",
"os": "<module 'os' from '/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/os.py'>",
"site": "<module 'site' from '/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site.py'>",
"datetime": "<module 'datetime' from '/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/datetime.py'>",
"math": "<module 'math' from '/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/lib-dynload/math.cpython-39-darwin.so'>",
"json": "<module 'json' from '/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 463 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/chainz/Library/Application Support/virtualenv) [virtualenv/run/session.py:59]
py39: 468 D got embed update of distribution pip from /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py39: 468 D got embed update of distribution setuptools from /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py39: 471 D got embed update of distribution wheel from /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py39: 471 D using periodically updated wheel /Users/chainz/Library/Application Support/virtualenv/wheel/house/pip-20.3.3-py2.py3-none-any.whl [virtualenv/seed/wheels/periodic_update.py:53]
py39: 472 D using periodically updated wheel /Users/chainz/Library/Application Support/virtualenv/wheel/house/setuptools-51.1.2-py3-none-any.whl [virtualenv/seed/wheels/periodic_update.py:53]
py39: 472 D install wheel from wheel /Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py39: 473 D install pip from wheel /Users/chainz/Library/Application Support/virtualenv/wheel/house/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py39: 473 D install setuptools from wheel /Users/chainz/Library/Application Support/virtualenv/wheel/house/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py39: 474 D Attempting to acquire lock 4495476432 on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py39: 474 D Attempting to acquire lock 4495476336 on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py39: 474 D Lock 4495476432 acquired on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py39: 474 D Lock 4495476336 acquired on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py39: 474 D Attempting to acquire lock 4495476480 on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py39: 475 D Attempting to release lock 4495476432 on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py39: 475 D Attempting to release lock 4495476336 on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py39: 475 D Lock 4495476480 acquired on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py39: 475 D Lock 4495476432 released on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py39: 475 D Lock 4495476336 released on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py39: 475 D Attempting to release lock 4495476480 on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py39: 476 D Lock 4495476480 released on /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py39: 476 D copy /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py39: 476 D copy directory /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py39: 476 D copy /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py39: 477 D copy directory /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/pip [virtualenv/util/path/_sync.py:52]
py39: 477 D copy /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py39: 479 D copy directory /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py39: 484 D copy directory /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py39: 488 D copy /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py39: 489 D copy directory /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py39: 503 D copy /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py39: 508 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/wheel3.9 to 755 [distlib/util.py:566]
py39: 509 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/wheel-3.9 to 755 [distlib/util.py:566]
py39: 511 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/wheel to 755 [distlib/util.py:566]
py39: 512 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/wheel3 to 755 [distlib/util.py:566]
py39: 512 D generated console scripts wheel3.9 wheel-3.9 wheel wheel3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py39: 615 D copy directory /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py39: 626 D copy directory /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py39: 628 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/easy_install-3.9 to 755 [distlib/util.py:566]
py39: 629 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/easy_install to 755 [distlib/util.py:566]
py39: 629 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/easy_install3.9 to 755 [distlib/util.py:566]
py39: 629 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/easy_install3 to 755 [distlib/util.py:566]
py39: 629 D generated console scripts easy_install easy_install-3.9 easy_install3 easy_install3.9 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py39: 767 D copy directory /Users/chainz/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/lib/python3.9/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py39: 771 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/pip3 to 755 [distlib/util.py:566]
py39: 771 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/pip to 755 [distlib/util.py:566]
py39: 772 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/pip3.9 to 755 [distlib/util.py:566]
py39: 772 D changing mode of /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/bin/pip-3.9 to 755 [distlib/util.py:566]
py39: 772 D generated console scripts pip3.9 pip3 pip-3.9 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 772 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 775 D write /Users/chainz/Documents/Projects/apig-wsgi/.tox/4/py39/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 775 D home = /Users/chainz/.pyenv/versions/3.9.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 775 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 775 D version_info = 3.9.1.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 775 D virtualenv = 20.4.2 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 775 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 775 D base-prefix = /Users/chainz/.pyenv/versions/3.9.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 775 D base-exec-prefix = /Users/chainz/.pyenv/versions/3.9.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 809 D base-executable = /Users/chainz/.pyenv/versions/3.9.1/bin/python [virtualenv/create/pyenv_cfg.py:38]
ROOT: 813 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/packaging/requirements.py", line 104, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/pyparsing.py", line 1955, in parseString
raise exc
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/pyparsing.py", line 3814, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected stringEnd, found '-' (at char 18), (line:1, col:19)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 120, in _expand_non_flag
req = Requirement(line)
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/packaging/requirements.py", line 106, in __init__
raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "'--hash=s'": Expected stringEnd
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/python/virtual_env/api.py", line 67, in setup
super().setup()
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 48, in setup
self.install_deps()
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 72, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 113, in validate_and_expand
self._expand_flag(ini_dir, line, result)
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 157, in _expand_flag
result.extend(req_file.validate_and_expand())
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 115, in validate_and_expand
self._expand_non_flag(at, ini_dir, line, result)
File "/Users/chainz/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 131, in _expand_non_flag
raise ValueError(f"{at}: {line}") from exc
ValueError: 7: attrs==20.3.0 --hash=sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6 --hash=sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700
py39: FAIL ✖ in 0.58 seconds
py39: FAIL code 2 (0.58 seconds)
evaluation failed :( (0.64 seconds)
|
ValueError
|
def get_env_var(key: str, of_type: Type[Any]) -> Optional[Tuple[Any, str]]:
"""Get the environment variable option.
:param key: the config key requested
:param of_type: the type we would like to convert it to
:return:
"""
key_upper = key.upper()
for fmt in ("TOX_{}", "TOX{}"):
environ_key = fmt.format(key_upper)
if environ_key in os.environ:
value = os.environ[environ_key]
try:
source = f"env var {environ_key}"
result = CONVERT.to(raw=value, of_type=of_type, kwargs={})
return result, source
except Exception as exception: # noqa
logging.warning(
"env var %s=%r cannot be transformed to %r because %r",
environ_key,
value,
of_type,
exception,
)
return None
|
def get_env_var(key: str, of_type: Type[Any]) -> Optional[Tuple[Any, str]]:
"""Get the environment variable option.
:param key: the config key requested
:param of_type: the type we would like to convert it to
:return:
"""
key_upper = key.upper()
for fmt in ("TOX_{}", "TOX{}"):
environ_key = fmt.format(key_upper)
if environ_key in os.environ:
value = os.environ[environ_key]
try:
source = f"env var {environ_key}"
result = CONVERT.to(raw=value, of_type=of_type)
return result, source
except Exception as exception: # noqa
logging.warning(
"env var %s=%r cannot be transformed to %r because %r",
environ_key,
value,
of_type,
exception,
)
return None
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def get(self, key: str, of_type: Type[Any]) -> Any:
cache_key = key, of_type
if cache_key in self._cache:
result = self._cache[cache_key]
else:
try:
if (
self.ini is None
): # pragma: no cover # this can only happen if we don't call __bool__ firsts
result = None
else:
source = "file"
value = self.ini.load(
key,
of_type=of_type,
conf=None,
env_name="tox",
chain=[key],
kwargs={},
)
result = value, source
except KeyError: # just not found
result = None
except Exception as exception: # noqa
logging.warning(
"%s key %s as type %r failed with %r",
self.config_file,
key,
of_type,
exception,
)
result = None
self._cache[cache_key] = result
return result
|
def get(self, key: str, of_type: Type[Any]) -> Any:
cache_key = key, of_type
if cache_key in self._cache:
result = self._cache[cache_key]
else:
try:
if (
self.ini is None
): # pragma: no cover # this can only happen if we don't call __bool__ firsts
result = None
else:
source = "file"
value = self.ini.load(
key, of_type=of_type, conf=None, env_name="tox", chain=[key]
)
result = value, source
except KeyError: # just not found
result = None
except Exception as exception: # noqa
logging.warning(
"%s key %s as type %r failed with %r",
self.config_file,
key,
of_type,
exception,
)
result = None
self._cache[cache_key] = result
return result
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def load(
self,
key: str,
of_type: Type[V],
kwargs: Mapping[str, Any],
conf: Optional["Config"],
env_name: Optional[str],
chain: List[str],
) -> V:
"""
Load a value.
:param key: the key under it lives
:param of_type: the type to convert to
:param conf: the configuration object of this tox session (needed to manifest the value)
:param env_name: env name
:return: the converted type
"""
if key in self.overrides:
return _STR_CONVERT.to(self.overrides[key].value, of_type, kwargs)
raw = self.load_raw(key, conf, env_name)
future: "Future[V]" = Future()
with self.build(future, key, of_type, conf, env_name, raw, chain) as prepared:
converted = self.to(prepared, of_type, kwargs)
future.set_result(converted)
return converted
|
def load(
self,
key: str,
of_type: Type[V],
conf: Optional["Config"],
env_name: Optional[str],
chain: List[str],
) -> V:
"""
Load a value.
:param key: the key under it lives
:param of_type: the type to convert to
:param conf: the configuration object of this tox session (needed to manifest the value)
:param env_name: env name
:return: the converted type
"""
if key in self.overrides:
return _STR_CONVERT.to(self.overrides[key].value, of_type)
raw = self.load_raw(key, conf, env_name)
future: "Future[V]" = Future()
with self.build(future, key, of_type, conf, env_name, raw, chain) as prepared:
converted = self.to(prepared, of_type)
future.set_result(converted)
return converted
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def to(self, raw: T, of_type: Type[V], kwargs: Mapping[str, Any]) -> V:
from_module = getattr(of_type, "__module__", None)
if from_module in ("typing", "typing_extensions"):
return self._to_typing(raw, of_type, kwargs) # type: ignore[return-value]
elif issubclass(of_type, Path):
return self.to_path(raw) # type: ignore[return-value]
elif issubclass(of_type, bool):
return self.to_bool(raw) # type: ignore[return-value]
elif issubclass(of_type, Command):
return self.to_command(raw) # type: ignore[return-value]
elif issubclass(of_type, EnvList):
return self.to_env_list(raw) # type: ignore[return-value]
elif issubclass(of_type, str):
return self.to_str(raw) # type: ignore[return-value]
elif isinstance(raw, of_type):
return raw
elif issubclass(of_type, Enum):
return cast(V, getattr(of_type, str(raw)))
return of_type(raw, **kwargs) # type: ignore[call-arg]
|
def to(self, raw: T, of_type: Type[V]) -> V:
from_module = getattr(of_type, "__module__", None)
if from_module in ("typing", "typing_extensions"):
return self._to_typing(raw, of_type) # type: ignore[return-value]
elif issubclass(of_type, Path):
return self.to_path(raw) # type: ignore[return-value]
elif issubclass(of_type, bool):
return self.to_bool(raw) # type: ignore[return-value]
elif issubclass(of_type, Command):
return self.to_command(raw) # type: ignore[return-value]
elif issubclass(of_type, EnvList):
return self.to_env_list(raw) # type: ignore[return-value]
elif issubclass(of_type, str):
return self.to_str(raw) # type: ignore[return-value]
elif isinstance(raw, of_type):
return raw
elif issubclass(of_type, Enum):
return cast(V, getattr(of_type, str(raw)))
return of_type(raw) # type: ignore[call-arg]
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def _to_typing(self, raw: T, of_type: Type[V], kwargs: Mapping[str, Any]) -> V:
origin = getattr(of_type, "__origin__", of_type.__class__)
result: Any = _NO_MAPPING
if origin in (list, List):
entry_type = of_type.__args__[0] # type: ignore[attr-defined]
result = [self.to(i, entry_type, kwargs) for i in self.to_list(raw, entry_type)]
elif origin in (set, Set):
entry_type = of_type.__args__[0] # type: ignore[attr-defined]
result = {self.to(i, entry_type, kwargs) for i in self.to_set(raw, entry_type)}
elif origin in (dict, Dict):
key_type, value_type = of_type.__args__[0], of_type.__args__[1] # type: ignore[attr-defined]
result = OrderedDict(
(self.to(k, key_type, {}), self.to(v, value_type, {}))
for k, v in self.to_dict(raw, (key_type, value_type))
)
elif origin == Union: # handle Optional values
args: List[Type[Any]] = of_type.__args__ # type: ignore[attr-defined]
none = type(None)
if len(args) == 2 and none in args:
if isinstance(raw, str):
raw = raw.strip() # type: ignore[assignment]
if not raw:
result = None
else:
new_type = next(
i for i in args if i != none
) # pragma: no cover # this will always find a element
result = self.to(raw, new_type, kwargs)
elif origin == Literal or origin == type(Literal):
if sys.version_info >= (3, 7): # pragma: no cover (py37+)
choice = of_type.__args__
else: # pragma: no cover (py38+)
choice = of_type.__values__ # type: ignore[attr-defined]
if raw not in choice:
raise ValueError(f"{raw} must be one of {choice}")
result = raw
if result is not _NO_MAPPING:
return cast(V, result)
raise TypeError(f"{raw} cannot cast to {of_type!r}")
|
def _to_typing(self, raw: T, of_type: Type[V]) -> V:
origin = getattr(of_type, "__origin__", of_type.__class__)
result: Any = _NO_MAPPING
if origin in (list, List):
entry_type = of_type.__args__[0] # type: ignore[attr-defined]
result = [self.to(i, entry_type) for i in self.to_list(raw, entry_type)]
elif origin in (set, Set):
entry_type = of_type.__args__[0] # type: ignore[attr-defined]
result = {self.to(i, entry_type) for i in self.to_set(raw, entry_type)}
elif origin in (dict, Dict):
key_type, value_type = of_type.__args__[0], of_type.__args__[1] # type: ignore[attr-defined]
result = OrderedDict(
(self.to(k, key_type), self.to(v, value_type))
for k, v in self.to_dict(raw, (key_type, value_type))
)
elif origin == Union: # handle Optional values
args: List[Type[Any]] = of_type.__args__ # type: ignore[attr-defined]
none = type(None)
if len(args) == 2 and none in args:
if isinstance(raw, str):
raw = raw.strip() # type: ignore[assignment]
if not raw:
result = None
else:
new_type = next(
i for i in args if i != none
) # pragma: no cover # this will always find a element
result = self.to(raw, new_type)
elif origin == Literal or origin == type(Literal):
if sys.version_info >= (3, 7): # pragma: no cover (py37+)
choice = of_type.__args__
else: # pragma: no cover (py38+)
choice = of_type.__values__ # type: ignore[attr-defined]
if raw not in choice:
raise ValueError(f"{raw} must be one of {choice}")
result = raw
if result is not _NO_MAPPING:
return cast(V, result)
raise TypeError(f"{raw} cannot cast to {of_type!r}")
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def __init__(
self,
keys: Iterable[str],
desc: str,
env_name: Optional[str],
of_type: Type[T],
default: Union[Callable[["Config", Optional[str]], T], T],
post_process: Optional[Callable[[T, "Config"], T]] = None,
kwargs: Optional[Mapping[str, Any]] = None,
) -> None:
super().__init__(keys, desc, env_name)
self.of_type = of_type
self.default = default
self.post_process = post_process
self.kwargs: Mapping[str, Any] = {} if kwargs is None else kwargs
self._cache: Union[object, T] = _PLACE_HOLDER
|
def __init__(
self,
keys: Iterable[str],
desc: str,
env_name: Optional[str],
of_type: Type[T],
default: Union[Callable[["Config", Optional[str]], T], T],
post_process: Optional[Callable[[T, "Config"], T]] = None,
) -> None:
super().__init__(keys, desc, env_name)
self.of_type = of_type
self.default = default
self.post_process = post_process
self._cache: Union[object, T] = _PLACE_HOLDER
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def __call__(
self,
conf: "Config",
name: Optional[str],
loaders: List[Loader[T]],
chain: List[str],
) -> T:
if self._cache is _PLACE_HOLDER:
found = False
for key in self.keys:
for loader in loaders:
try:
value = loader.load(
key, self.of_type, self.kwargs, conf, self.env_name, chain
)
found = True
except KeyError:
continue
break
if found:
break
else:
value = (
self.default(conf, self.env_name)
if callable(self.default)
else self.default
)
if self.post_process is not None:
value = self.post_process(value, conf) # noqa
self._cache = value
return cast(T, self._cache)
|
def __call__(
self,
conf: "Config",
name: Optional[str],
loaders: List[Loader[T]],
chain: List[str],
) -> T:
if self._cache is _PLACE_HOLDER:
found = False
for key in self.keys:
for loader in loaders:
try:
value = loader.load(key, self.of_type, conf, self.env_name, chain)
found = True
except KeyError:
continue
break
if found:
break
else:
value = (
self.default(conf, self.env_name)
if callable(self.default)
else self.default
)
if self.post_process is not None:
value = self.post_process(value, conf) # noqa
self._cache = value
return cast(T, self._cache)
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def add_config(
self,
keys: Union[str, Sequence[str]],
of_type: Type[V],
default: Union[Callable[["Config", Optional[str]], V], V],
desc: str,
post_process: Optional[Callable[[V, "Config"], V]] = None,
kwargs: Optional[Mapping[str, Any]] = None,
) -> ConfigDynamicDefinition[V]:
"""
Add configuration value.
"""
keys_ = self._make_keys(keys)
definition = ConfigDynamicDefinition(
keys_, desc, self._name, of_type, default, post_process, kwargs
)
result = self._add_conf(keys_, definition)
return cast(ConfigDynamicDefinition[V], result)
|
def add_config(
self,
keys: Union[str, Sequence[str]],
of_type: Type[V],
default: Union[Callable[["Config", Optional[str]], V], V],
desc: str,
post_process: Optional[Callable[[V, "Config"], V]] = None,
overwrite: bool = False,
) -> ConfigDynamicDefinition[V]:
"""
Add configuration value.
"""
keys_ = self._make_keys(keys)
definition = ConfigDynamicDefinition(
keys_, desc, self._name, of_type, default, post_process
)
result = self._add_conf(keys_, definition)
return cast(ConfigDynamicDefinition[V], result)
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def __init__(self, value: Union[None, List[str], str] = None):
if isinstance(value, str):
value = StrConvert().to(value, of_type=List[str], kwargs={})
self.all: bool = value is None or "ALL" in value
self._names = value
|
def __init__(self, value: Union[None, List[str], str] = None):
if isinstance(value, str):
value = StrConvert().to(value, of_type=List[str])
self.all: bool = value is None or "ALL" in value
self._names = value
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def __init__(
self, raw: str, within_tox_ini: bool = True, root: Optional[Path] = None
) -> None:
self._root = Path().cwd() if root is None else root.resolve()
if within_tox_ini: # patch the content coming from tox.ini
lines: List[str] = []
for line in raw.splitlines():
# for tox<4 supporting requirement/constraint files via -rreq.txt/-creq.txt
arg_match = next(
(
arg
for arg in ONE_ARG
if line.startswith(arg)
and len(line) > len(arg)
and not (line[len(arg)].isspace() or line[len(arg)] == "=")
),
None,
)
if arg_match is not None:
line = f"{arg_match} {line[len(arg_match) :]}"
# escape spaces
escape_match = next(
(
e
for e in ONE_ARG_ESCAPE
if line.startswith(e) and line[len(e)].isspace()
),
None,
)
if escape_match is not None:
# escape not already escaped spaces
escaped = re.sub(r"(?<!\\)(\s)", r"\\\1", line[len(escape_match) + 1 :])
line = f"{line[: len(escape_match)]} {escaped}"
lines.append(line)
adjusted = "\n".join(lines)
raw = (
f"{adjusted}\n" if raw.endswith("\\\n") else adjusted
) # preserve trailing newline if input has it
self._raw = raw
|
def __init__(
self, raw: str, within_tox_ini: bool = True, root: Optional[Path] = None
) -> None:
self._root = Path().cwd() if root is None else root
if within_tox_ini: # patch the content coming from tox.ini
lines: List[str] = []
for line in raw.splitlines():
# for tox<4 supporting requirement/constraint files via -rreq.txt/-creq.txt
arg_match = next(
(
o
for o in ONE_ARG
if line.startswith(o) and not line[len(o)].isspace()
),
None,
)
if arg_match is not None:
line = f"{arg_match} {line[len(arg_match) :]}"
# escape spaces
escape_match = next(
(
e
for e in ONE_ARG_ESCAPE
if line.startswith(e) and line[len(e)].isspace()
),
None,
)
if escape_match is not None:
# escape not already escaped spaces
escaped = re.sub(r"(?<!\\)(\s)", r"\\\1", line[len(escape_match) + 1 :])
line = f"{line[: len(escape_match)]} {escaped}"
lines.append(line)
adjusted = "\n".join(lines)
raw = (
f"{adjusted}\n" if raw.endswith("\\\n") else adjusted
) # preserve trailing newline if input has it
self._raw = raw
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def validate_and_expand(self) -> List[str]:
raw = self._normalize_raw()
result: List[str] = []
ini_dir = self.root
for at, line in enumerate(raw.splitlines(), start=1):
line = re.sub(r"(?<!\\)\s#.*", "", line).strip()
if not line or line.startswith("#"):
continue
if line.startswith("-"):
self._expand_flag(ini_dir, line, result)
else:
self._expand_non_flag(at, ini_dir, line, result)
return result
|
def validate_and_expand(self) -> List[str]:
raw = self._normalize_raw()
result: List[str] = []
ini_dir = self.root
for at, line in enumerate(raw.splitlines(), start=1):
if line.startswith("#"):
continue
line = re.sub(r"\s#.*", "", line).strip()
if not line:
continue
if line.startswith("-"): # handle flags
words = [i for i in re.split(r"(?<!\\)\s", line) if i]
first = words[0]
if first in NO_ARG:
if len(words) != 1:
raise ValueError(line)
else:
result.append(" ".join(words))
elif first in ONE_ARG:
if len(words) != 2:
raise ValueError(line)
else:
if first in ("-r", "--requirement", "-c", "--constraint"):
raw_path = line[len(first) + 1 :].strip()
unescaped_path = re.sub(r"\\(\s)", r"\1", raw_path)
path = Path(unescaped_path)
if not path.is_absolute():
path = ini_dir / path
if not path.exists():
raise ValueError(
f"requirement file path {str(path)!r} does not exist"
)
req_file = RequirementsFile(
path.read_text(), within_tox_ini=False, root=self.root
)
result.extend(req_file.validate_and_expand())
else:
result.append(" ".join(words))
else:
raise ValueError(line)
else:
try:
req = Requirement(line)
result.append(str(req))
except InvalidRequirement as exc:
if is_url(line) or any(
line.startswith(f"{v}+") and is_url(line[len(v) + 1 :]) for v in VCS
):
result.append(line)
else:
path = ini_dir / line
try:
is_valid_file = path.exists() and path.is_file()
except (
OSError
): # https://bugs.python.org/issue42855 # pragma: no cover
is_valid_file = False # pragma: no cover
if not is_valid_file:
raise ValueError(f"{at}: {line}") from exc
result.append(str(path))
return result
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def register_config(self) -> None:
super().register_config()
deps_kwargs = {"root": self.core["toxinidir"]}
self.conf.add_config(
keys="deps",
of_type=RequirementsFile,
kwargs=deps_kwargs,
default=RequirementsFile("", **deps_kwargs),
desc="Name of the python dependencies as specified by PEP-440",
)
self.core.add_config(
keys=["skip_missing_interpreters"],
default=True,
of_type=bool,
desc="skip running missing interpreters",
)
|
def register_config(self) -> None:
super().register_config()
self.conf.add_config(
keys="deps",
of_type=RequirementsFile,
default=RequirementsFile(""),
desc="Name of the python dependencies as specified by PEP-440",
)
self.core.add_config(
keys=["skip_missing_interpreters"],
default=True,
of_type=bool,
desc="skip running missing interpreters",
)
|
https://github.com/tox-dev/tox/issues/1853
|
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2
|
ValueError
|
def __init__(
self, raw: str, within_tox_ini: bool = True, root: Optional[Path] = None
) -> None:
self._root = Path().cwd() if root is None else root
if within_tox_ini: # patch the content coming from tox.ini
lines: List[str] = []
for line in raw.splitlines():
# for tox<4 supporting requirement/constraint files via -rreq.txt/-creq.txt
if (
len(line) >= 3
and (line.startswith("-r") or line.startswith("-c"))
and not line[2].isspace()
):
line = f"{line[:2]} {line[2:]}"
# escape spaces
escape_for = (
"-c",
"--constraint",
"-r",
"--requirement",
"-f",
"--find-links-e",
"--editable",
)
escape_match = next(
(
e
for e in escape_for
if line.startswith(e) and line[len(e)].isspace()
),
None,
)
if escape_match is not None:
# escape not already escaped spaces
escaped = re.sub(r"(?<!\\)(\s)", r"\\\1", line[len(escape_match) + 1 :])
line = f"{line[: len(escape_match)]} {escaped}"
lines.append(line)
adjusted = "\n".join(lines)
raw = (
f"{adjusted}\n" if raw.endswith("\\\n") else adjusted
) # preserve trailing newline if input has it
self._raw = raw
|
def __init__(
self, raw: str, allow_short_req_file: bool = True, root: Optional[Path] = None
) -> None:
self._root = Path().cwd() if root is None else root
if allow_short_req_file: # patch for tox<4 supporting requirement/constraint files via -rreq.txt/-creq.txt
lines: List[str] = []
for line in raw.splitlines():
if (
len(line) >= 3
and (line.startswith("-r") or line.startswith("-c"))
and not line[2].isspace()
):
line = f"{line[:2]} {line[2:]}"
lines.append(line)
adjusted = "\n".join(lines)
raw = (
f"{adjusted}\n" if raw.endswith("\\\n") else adjusted
) # preserve trailing newline if input has it
self._raw = raw
|
https://github.com/tox-dev/tox/issues/1792
|
Traceback (most recent call last):
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/tox_env/api.py", line 169, in ensure_setup
self.setup()
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/tox_env/python/runner.py", line 44, in setup
self.install_deps()
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/tox_env/python/runner.py", line 68, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/tox_env/python/req_file.py", line 94, in validate_and_expand
raise ValueError(line)
ValueError: -r /home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/tests/requirements.txt
py36: FAIL ✖ in 0.42 seconds
py36: FAIL code 2 (0.42 seconds)
evaluation failed :( (0.49 seconds)
|
ValueError
|
def validate_and_expand(self) -> List[str]:
raw = self._normalize_raw()
result: List[str] = []
ini_dir = self.root
for at, line in enumerate(raw.splitlines(), start=1):
if line.startswith("#"):
continue
line = re.sub(r"\s#.*", "", line).strip()
if not line:
continue
if line.startswith("-"): # handle flags
words = [i for i in re.split(r"(?<!\\)\s", line) if i]
first = words[0]
if first in self.VALID_OPTIONS["no_arg"]:
if len(words) != 1:
raise ValueError(line)
else:
result.append(" ".join(words))
elif first in self.VALID_OPTIONS["one_arg"]:
if len(words) != 2:
raise ValueError(line)
else:
if first in ("-r", "--requirement", "-c", "--constraint"):
raw_path = line[len(first) + 1 :].strip()
unescaped_path = re.sub(r"\\(\s)", r"\1", raw_path)
path = Path(unescaped_path)
if not path.is_absolute():
path = ini_dir / path
if not path.exists():
raise ValueError(
f"requirement file path {str(path)!r} does not exist"
)
req_file = RequirementsFile(
path.read_text(), within_tox_ini=False, root=self.root
)
result.extend(req_file.validate_and_expand())
else:
result.append(" ".join(words))
else:
raise ValueError(line)
else:
try:
req = Requirement(line)
result.append(str(req))
except InvalidRequirement as exc:
if is_url(line) or any(
line.startswith(f"{v}+") and is_url(line[len(v) + 1 :]) for v in VCS
):
result.append(line)
else:
path = ini_dir / line
try:
is_valid_file = path.exists() and path.is_file()
except (
OSError
): # https://bugs.python.org/issue42855 # pragma: no cover
is_valid_file = False # pragma: no cover
if not is_valid_file:
raise ValueError(f"{at}: {line}") from exc
result.append(str(path))
return result
|
def validate_and_expand(self) -> List[str]:
raw = self._normalize_raw()
result: List[str] = []
ini_dir = self.root
for at, line in enumerate(raw.splitlines(), start=1):
if line.startswith("#"):
continue
line = re.sub(r"\s#.*", "", line).strip()
if not line:
continue
if line.startswith("-"): # handle flags
words = re.findall(r"\S+", line)
first = words[0]
if first in self.VALID_OPTIONS["no_arg"]:
if len(words) != 1:
raise ValueError(line)
else:
result.append(" ".join(words))
elif first in self.VALID_OPTIONS["one_arg"]:
if len(words) != 2:
raise ValueError(line)
else:
if first in ("-r", "--requirement", "-c", "--constraint"):
path = Path(line[len(first) + 1 :].strip())
if not path.is_absolute():
path = ini_dir / path
req_file = RequirementsFile(
path.read_text(), allow_short_req_file=False, root=self.root
)
result.extend(req_file.validate_and_expand())
else:
result.append(" ".join(words))
else:
raise ValueError(line)
else:
try:
req = Requirement(line)
result.append(str(req))
except InvalidRequirement as exc:
if is_url(line) or any(
line.startswith(f"{v}+") and is_url(line[len(v) + 1 :]) for v in VCS
):
result.append(line)
else:
path = ini_dir / line
try:
is_valid_file = path.exists() and path.is_file()
except (
OSError
): # https://bugs.python.org/issue42855 # pragma: no cover
is_valid_file = False # pragma: no cover
if not is_valid_file:
raise ValueError(f"{at}: {line}") from exc
result.append(str(path))
return result
|
https://github.com/tox-dev/tox/issues/1792
|
Traceback (most recent call last):
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/tox_env/api.py", line 169, in ensure_setup
self.setup()
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/tox_env/python/runner.py", line 44, in setup
self.install_deps()
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/tox_env/python/runner.py", line 68, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/venv/lib/python3.8/site-packages/tox/tox_env/python/req_file.py", line 94, in validate_and_expand
raise ValueError(line)
ValueError: -r /home/domdf/Python/01 GitHub Repos/03 Libraries/wordle/tests/requirements.txt
py36: FAIL ✖ in 0.42 seconds
py36: FAIL code 2 (0.42 seconds)
evaluation failed :( (0.49 seconds)
|
ValueError
|
def tox_add_option(parser: ArgumentParser) -> None:
parser.add_argument(
"--no-recreate-provision",
dest="no_recreate_provision",
help="if recreate is set do not recreate provision tox environment",
action="store_true",
)
parser.add_argument(
"-r",
"--recreate",
dest="recreate",
help="recreate the tox environments",
action="store_true",
)
|
def tox_add_option(parser: ArgumentParser) -> None:
parser.add_argument(
"--no-recreate-provision",
dest="recreate",
help="if recreate is set do not recreate provision tox environment",
action="store_true",
)
|
https://github.com/tox-dev/tox/issues/1793
|
ROOT: 111 D setup logging to DEBUG on pid 483153 [tox/report.py:211]
ROOT: 143 W will run in automatically provisioned tox, host /home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3 is missing [requires (has)]: pip>=20.3.3 (20.3.1) [tox/provision.py:85]
ROOT: 156 I find interpreter for spec PythonSpec(path=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3) [virtualenv/discovery/builtin.py:62]
ROOT: 156 D discover exe for PythonInfo(spec=CPython3.7.9.final.0-64, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) in /usr [virtualenv/discovery/py_info.py:371]
ROOT: 156 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 157 D Attempting to acquire lock 139798871184528 on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:270]
ROOT: 157 D Lock 139798871184528 acquired on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:274]
ROOT: 157 D got python info of /usr/bin/python3.7 from /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 157 D Attempting to release lock 139798871184528 on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:315]
ROOT: 157 D Lock 139798871184528 released on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:318]
ROOT: 158 I proposed PythonInfo(spec=CPython3.7.9.final.0-64, system=/usr/bin/python3.7, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) [virtualenv/discovery/builtin.py:68]
ROOT: 158 D accepted PythonInfo(spec=CPython3.7.9.final.0-64, system=/usr/bin/python3.7, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) [virtualenv/discovery/builtin.py:70]
ROOT: 177 I will run in a automatically provisioned python environment under /home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/.tox4/.tox/bin/python [tox/provision.py:103]
Traceback (most recent call last):
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/tox4", line 10, in <module>
sys.exit(run())
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/run.py", line 21, in run
result = main(sys.argv[1:] if args is None else args)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/run.py", line 35, in main
result = provision(state)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/provision.py", line 87, in provision
return run_provision(requires, state)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/provision.py", line 105, in run_provision
recreate = state.options.no_recreate_provision is False if state.options.recreate else False
AttributeError: 'Parsed' object has no attribute 'no_recreate_provision'
|
AttributeError
|
def env_run_create_flags(parser: ArgumentParser) -> None:
parser.add_argument(
"--result-json",
dest="result_json",
metavar="path",
of_type=Path,
default=None,
help="write a json file with detailed information about all commands and results involved",
)
parser.add_argument(
"-s",
"--skip-missing-interpreters",
default="config",
metavar="v",
nargs="?",
action=SkipMissingInterpreterAction,
help="don't fail tests for missing interpreters: {config,true,false} choice",
)
parser.add_argument(
"-n",
"--notest",
dest="no_test",
help="do not run the test commands",
action="store_true",
)
parser.add_argument(
"-b",
"--pkg-only",
"--sdistonly",
action="store_true",
help="only perform the packaging activity",
dest="package_only",
)
parser.add_argument(
"--installpkg",
help="use specified package for installation into venv, instead of creating an sdist.",
default=None,
of_type=Path,
)
parser.add_argument(
"--develop",
action="store_true",
help="install package in develop mode",
dest="develop",
)
parser.add_argument(
"--hashseed",
metavar="SEED",
help="set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range "
"[1, 4294967295] ([1, 1024] on Windows). Passing 'noset' suppresses this behavior.",
type=str,
default="noset",
)
parser.add_argument(
"--discover",
dest="discover",
nargs="+",
metavar="path",
help="for python discovery first try the python executables under these paths",
default=[],
)
parser.add_argument(
"--no-recreate-pkg",
dest="no_recreate_pkg",
help="if recreate is set do not recreate packaging tox environment(s)",
action="store_true",
)
parser.add_argument(
"--skip-pkg-install",
dest="skip_pkg_install",
help="skip package installation for this run",
action="store_true",
)
|
def env_run_create_flags(parser: ArgumentParser) -> None:
parser.add_argument(
"--result-json",
dest="result_json",
metavar="path",
of_type=Path,
default=None,
help="write a json file with detailed information about all commands and results involved",
)
parser.add_argument(
"-s",
"--skip-missing-interpreters",
default="config",
metavar="v",
nargs="?",
action=SkipMissingInterpreterAction,
help="don't fail tests for missing interpreters: {config,true,false} choice",
)
parser.add_argument(
"-r",
"--recreate",
dest="recreate",
help="recreate the tox environments",
action="store_true",
)
parser.add_argument(
"-n",
"--notest",
dest="no_test",
help="do not run the test commands",
action="store_true",
)
parser.add_argument(
"-b",
"--pkg-only",
"--sdistonly",
action="store_true",
help="only perform the packaging activity",
dest="package_only",
)
parser.add_argument(
"--installpkg",
help="use specified package for installation into venv, instead of creating an sdist.",
default=None,
of_type=Path,
)
parser.add_argument(
"--develop",
action="store_true",
help="install package in develop mode",
dest="develop",
)
parser.add_argument(
"--hashseed",
metavar="SEED",
help="set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range "
"[1, 4294967295] ([1, 1024] on Windows). Passing 'noset' suppresses this behavior.",
type=str,
default="noset",
)
parser.add_argument(
"--discover",
dest="discover",
nargs="+",
metavar="path",
help="for python discovery first try the python executables under these paths",
default=[],
)
parser.add_argument(
"--no-recreate-pkg",
dest="no_recreate_pkg",
help="if recreate is set do not recreate packaging tox environment(s)",
action="store_true",
)
parser.add_argument(
"--skip-pkg-install",
dest="skip_pkg_install",
help="skip package installation for this run",
action="store_true",
)
|
https://github.com/tox-dev/tox/issues/1793
|
ROOT: 111 D setup logging to DEBUG on pid 483153 [tox/report.py:211]
ROOT: 143 W will run in automatically provisioned tox, host /home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3 is missing [requires (has)]: pip>=20.3.3 (20.3.1) [tox/provision.py:85]
ROOT: 156 I find interpreter for spec PythonSpec(path=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3) [virtualenv/discovery/builtin.py:62]
ROOT: 156 D discover exe for PythonInfo(spec=CPython3.7.9.final.0-64, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) in /usr [virtualenv/discovery/py_info.py:371]
ROOT: 156 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 157 D Attempting to acquire lock 139798871184528 on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:270]
ROOT: 157 D Lock 139798871184528 acquired on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:274]
ROOT: 157 D got python info of /usr/bin/python3.7 from /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 157 D Attempting to release lock 139798871184528 on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:315]
ROOT: 157 D Lock 139798871184528 released on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:318]
ROOT: 158 I proposed PythonInfo(spec=CPython3.7.9.final.0-64, system=/usr/bin/python3.7, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) [virtualenv/discovery/builtin.py:68]
ROOT: 158 D accepted PythonInfo(spec=CPython3.7.9.final.0-64, system=/usr/bin/python3.7, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) [virtualenv/discovery/builtin.py:70]
ROOT: 177 I will run in a automatically provisioned python environment under /home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/.tox4/.tox/bin/python [tox/provision.py:103]
Traceback (most recent call last):
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/tox4", line 10, in <module>
sys.exit(run())
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/run.py", line 21, in run
result = main(sys.argv[1:] if args is None else args)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/run.py", line 35, in main
result = provision(state)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/provision.py", line 87, in provision
return run_provision(requires, state)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/provision.py", line 105, in run_provision
recreate = state.options.no_recreate_provision is False if state.options.recreate else False
AttributeError: 'Parsed' object has no attribute 'no_recreate_provision'
|
AttributeError
|
def __init__(
self, raw: str, allow_short_req_file: bool = True, root: Optional[Path] = None
) -> None:
self._root = Path().cwd() if root is None else root
if allow_short_req_file: # patch for tox<4 supporting requirement/constraint files via -rreq.txt/-creq.txt
lines: List[str] = []
for line in raw.splitlines():
if (
len(line) >= 3
and (line.startswith("-r") or line.startswith("-c"))
and not line[2].isspace()
):
line = f"{line[:2]} {line[2:]}"
lines.append(line)
adjusted = "\n".join(lines)
raw = (
f"{adjusted}\n" if raw.endswith("\\\n") else adjusted
) # preserve trailing newline if input has it
self._raw = raw
|
def __init__(
self, raw: str, allow_short_req_file: bool = True, root: Optional[Path] = None
) -> None:
self._root = Path().cwd() if root is None else root
if (
allow_short_req_file
): # patch tox supporting requirements files via -rrequirements.txt
r = (
(f"-r {i[2:]}" if len(i) >= 3 and i.startswith("-r") and i[2] != " " else i)
for i in raw.splitlines()
)
adjusted = "\n".join(r)
raw = f"{adjusted}\n" if raw.endswith("\\\n") else adjusted
self._raw = raw
|
https://github.com/tox-dev/tox/issues/1788
|
$ tox4 -e docs [10:45:55]
docs: internal error
Traceback (most recent call last):
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/tox_env/api.py", line 169, in ensure_setup
self.setup()
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 44, in setup
self.install_deps()
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 68, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 105, in validate_and_expand
raise ValueError(line)
ValueError: -c/Users/ssbarnea/c/a/ansible-lint/docs/requirements.txt
docs: FAIL ✖ in 0.13 seconds
docs: FAIL code 2 (0.13 seconds)
evaluation failed :( (0.20 seconds)
FAIL: 2
|
ValueError
|
def validate_and_expand(self) -> List[str]:
raw = self._normalize_raw()
result: List[str] = []
ini_dir = self.root
for at, line in enumerate(raw.splitlines(), start=1):
if line.startswith("#"):
continue
line = re.sub(r"\s#.*", "", line).strip()
if not line:
continue
if line.startswith("-"): # handle flags
words = re.findall(r"\S+", line)
first = words[0]
if first in self.VALID_OPTIONS["no_arg"]:
if len(words) != 1:
raise ValueError(line)
else:
result.append(" ".join(words))
elif first in self.VALID_OPTIONS["one_arg"]:
if len(words) != 2:
raise ValueError(line)
else:
if first in ("-r", "--requirement", "-c", "--constraint"):
path = Path(line[len(first) + 1 :].strip())
if not path.is_absolute():
path = ini_dir / path
req_file = RequirementsFile(
path.read_text(), allow_short_req_file=False, root=self.root
)
result.extend(req_file.validate_and_expand())
else:
result.append(" ".join(words))
else:
raise ValueError(line)
else:
try:
req = Requirement(line)
result.append(str(req))
except InvalidRequirement as exc:
if is_url(line) or any(
line.startswith(f"{v}+") and is_url(line[len(v) + 1 :]) for v in VCS
):
result.append(line)
else:
path = ini_dir / line
try:
is_valid_file = path.exists() and path.is_file()
except (
OSError
): # https://bugs.python.org/issue42855 # pragma: no cover
is_valid_file = False # pragma: no cover
if not is_valid_file:
raise ValueError(f"{at}: {line}") from exc
result.append(str(path))
return result
|
def validate_and_expand(self) -> List[str]:
raw = self._normalize_raw()
result: List[str] = []
ini_dir = self.root
for at, line in enumerate(raw.splitlines(), start=1):
if line.startswith("#"):
continue
line = re.sub(r"\s#.*", "", line).strip()
if not line:
continue
if line.startswith("-"): # handle flags
words = re.findall(r"\S+", line)
first = words[0]
if first in self.VALID_OPTIONS["no_arg"]:
if len(words) != 1:
raise ValueError(line)
else:
result.append(" ".join(words))
elif first in self.VALID_OPTIONS["one_arg"]:
if len(words) != 2:
raise ValueError(line)
else:
if first == "-r":
path = Path(line[3:].strip())
if not path.is_absolute():
path = ini_dir / path
req_file = RequirementsFile(
path.read_text(), allow_short_req_file=False, root=self.root
)
result.extend(req_file.validate_and_expand())
else:
result.append(" ".join(words))
else:
raise ValueError(line)
else:
try:
req = Requirement(line)
result.append(str(req))
except InvalidRequirement as exc:
if is_url(line) or any(
line.startswith(f"{v}+") and is_url(line[len(v) + 1 :]) for v in VCS
):
result.append(line)
else:
path = ini_dir / line
try:
is_valid_file = path.exists() and path.is_file()
except (
OSError
): # https://bugs.python.org/issue42855 # pragma: no cover
is_valid_file = False # pragma: no cover
if not is_valid_file:
raise ValueError(f"{at}: {line}") from exc
result.append(str(path))
return result
|
https://github.com/tox-dev/tox/issues/1788
|
$ tox4 -e docs [10:45:55]
docs: internal error
Traceback (most recent call last):
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/tox_env/api.py", line 169, in ensure_setup
self.setup()
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 44, in setup
self.install_deps()
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 68, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "/Users/ssbarnea/.local/pipx/venvs/tox/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 105, in validate_and_expand
raise ValueError(line)
ValueError: -c/Users/ssbarnea/c/a/ansible-lint/docs/requirements.txt
docs: FAIL ✖ in 0.13 seconds
docs: FAIL code 2 (0.13 seconds)
evaluation failed :( (0.20 seconds)
FAIL: 2
|
ValueError
|
def _replace_match(self, match):
g = match.groupdict()
sub_value = g["substitution_value"]
if self.crossonly:
if sub_value.startswith("["):
return self._substitute_from_other_section(sub_value)
# in crossonly we return all other hits verbatim
start, end = match.span()
return match.string[start:end]
full_match = match.group(0)
# ":" is swallowed by the regex, so the raw matched string is checked
if full_match.startswith("{:"):
if full_match != "{:}":
raise tox.exception.ConfigError(
"Malformed substitution with prefix ':': {}".format(full_match),
)
return os.pathsep
default_value = g["default_value"]
# special case: opts and packages. Leave {opts} and
# {packages} intact, they are replaced manually in
# _venv.VirtualEnv.run_install_command.
if sub_value in ("opts", "packages"):
return "{{{}}}".format(sub_value)
if sub_value == "posargs":
return self.reader.getposargs(default_value)
sub_type = g["sub_type"]
if sub_type == "posargs":
if default_value:
value = "{}:{}".format(sub_value, default_value)
else:
value = sub_value
return self.reader.getposargs(value)
if not sub_type and not sub_value:
raise tox.exception.ConfigError(
"Malformed substitution; no substitution type provided. "
"If you were using `{}` for `os.pathsep`, please use `{:}`.",
)
if not sub_type and not default_value and sub_value == "/":
return os.sep
if sub_type == "env":
return self._replace_env(sub_value, default_value)
if sub_type == "tty":
if is_interactive():
return match.group("substitution_value")
return match.group("default_value")
if sub_type == "posargs":
return self.reader.getposargs(sub_value)
if sub_type is not None:
raise tox.exception.ConfigError(
"No support for the {} substitution type".format(sub_type),
)
return self._replace_substitution(sub_value)
|
def _replace_match(self, match):
g = match.groupdict()
sub_value = g["substitution_value"]
if self.crossonly:
if sub_value.startswith("["):
return self._substitute_from_other_section(sub_value)
# in crossonly we return all other hits verbatim
start, end = match.span()
return match.string[start:end]
full_match = match.group(0)
# ":" is swallowed by the regex, so the raw matched string is checked
if full_match.startswith("{:"):
if full_match != "{:}":
raise tox.exception.ConfigError(
"Malformed substitution with prefix ':': {}".format(full_match),
)
return os.pathsep
default_value = g["default_value"]
if sub_value == "posargs":
return self.reader.getposargs(default_value)
sub_type = g["sub_type"]
if sub_type == "posargs":
if default_value:
value = "{}:{}".format(sub_value, default_value)
else:
value = sub_value
return self.reader.getposargs(value)
if not sub_type and not sub_value:
raise tox.exception.ConfigError(
"Malformed substitution; no substitution type provided. "
"If you were using `{}` for `os.pathsep`, please use `{:}`.",
)
if not sub_type and not default_value and sub_value == "/":
return os.sep
if sub_type == "env":
return self._replace_env(sub_value, default_value)
if sub_type == "tty":
if is_interactive():
return match.group("substitution_value")
return match.group("default_value")
if sub_type == "posargs":
return self.reader.getposargs(sub_value)
if sub_type is not None:
raise tox.exception.ConfigError(
"No support for the {} substitution type".format(sub_type),
)
return self._replace_substitution(sub_value)
|
https://github.com/tox-dev/tox/issues/1777
|
$ tox -rvv
using tox.ini: /tmp/test/tox.ini (pid 8575)
removing /tmp/test/.tox/log
Traceback (most recent call last):
File "/tmp/venv/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/tmp/venv/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/tmp/venv/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/tmp/venv/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 280, in parseconfig
ParseIni(config, config_file, content)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1276, in __init__
raise tox.exception.ConfigError(
tox.exception.ConfigError: ConfigError: py38 failed with ConfigError: substitution key 'opts' not found at Traceback (most recent call last):
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1252, in run
results[name] = cur_self.make_envconfig(name, section, subs, config)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1407, in make_envconfig
res = meth(env_attr.name, env_attr.default, replace=replace)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1716, in getargv_install_command
return _ArgvlistReader.getargvlist(self, s, replace=replace, name=name)[0]
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1946, in getargvlist
commands.extend(cls.getargvlist(reader, replaced, name=name))
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1948, in getargvlist
commands.append(cls.processcommand(reader, current_command, replace, name=name))
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1974, in processcommand
new_word = reader._replace(word, name=name)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1782, in _replace
replaced = Replacer(self, crossonly=crossonly).do_replace(value)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1818, in do_replace
expanded = substitute_once(value)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1816, in substitute_once
return self.RE_ITEM_REF.sub(self._replace_match, x)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1876, in _replace_match
return self._replace_substitution(sub_value)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1911, in _replace_substitution
val = self._substitute_from_other_section(sub_key)
File "/tmp/venv/lib/python3.8/site-packages/tox/config/__init__.py", line 1906, in _substitute_from_other_section
raise tox.exception.ConfigError("substitution key {!r} not found".format(key))
tox.exception.ConfigError: ConfigError: substitution key 'opts' not found
|
tox.exception.ConfigError
|
def __init__(self, envname, config, factors, reader):
#: test environment name
self.envname = envname
#: global tox config object
self.config = config
#: set of factors
self.factors = factors
self._reader = reader
self._missing_subs = {}
"""Holds substitutions that could not be resolved.
Pre 2.8.1 missing substitutions crashed with a ConfigError although this would not be a
problem if the env is not part of the current testrun. So we need to remember this and
check later when the testenv is actually run and crash only then.
"""
|
def __init__(self, envname, config, factors, reader):
#: test environment name
self.envname = envname
#: global tox config object
self.config = config
#: set of factors
self.factors = factors
self._reader = reader
self._missing_subs = []
"""Holds substitutions that could not be resolved.
Pre 2.8.1 missing substitutions crashed with a ConfigError although this would not be a
problem if the env is not part of the current testrun. So we need to remember this and
check later when the testenv is actually run and crash only then.
"""
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def make_envconfig(self, name, section, subs, config, replace=True):
factors = set(name.split("-"))
reader = SectionReader(
section, self._cfg, fallbacksections=["testenv"], factors=factors
)
tc = TestenvConfig(name, config, factors, reader)
reader.addsubstitutions(
envname=name,
envbindir=tc.get_envbindir,
envsitepackagesdir=tc.get_envsitepackagesdir,
envpython=tc.get_envpython,
**subs,
)
for env_attr in config._testenv_attr:
atype = env_attr.type
try:
if atype in (
"bool",
"float",
"path",
"string",
"dict",
"dict_setenv",
"argv",
"argvlist",
"argv_install_command",
):
meth = getattr(reader, "get{}".format(atype))
res = meth(env_attr.name, env_attr.default, replace=replace)
elif atype == "basepython":
no_fallback = name in (config.provision_tox_env,)
res = reader.getstring(
env_attr.name,
env_attr.default,
replace=replace,
no_fallback=no_fallback,
)
elif atype == "space-separated-list":
res = reader.getlist(env_attr.name, sep=" ")
elif atype == "line-list":
res = reader.getlist(env_attr.name, sep="\n")
elif atype == "env-list":
res = reader.getstring(env_attr.name, replace=False)
res = tuple(_split_env(res))
else:
raise ValueError("unknown type {!r}".format(atype))
if env_attr.postprocess:
res = env_attr.postprocess(testenv_config=tc, value=res)
except tox.exception.MissingSubstitution as e:
tc._missing_subs[env_attr.name] = res = e
# On Python 2, exceptions are handled in __getattr__
if not six.PY2 or not isinstance(res, Exception):
setattr(tc, env_attr.name, res)
if atype in ("path", "string", "basepython"):
reader.addsubstitutions(**{env_attr.name: res})
return tc
|
def make_envconfig(self, name, section, subs, config, replace=True):
factors = set(name.split("-"))
reader = SectionReader(
section, self._cfg, fallbacksections=["testenv"], factors=factors
)
tc = TestenvConfig(name, config, factors, reader)
reader.addsubstitutions(
envname=name,
envbindir=tc.get_envbindir,
envsitepackagesdir=tc.get_envsitepackagesdir,
envpython=tc.get_envpython,
**subs,
)
for env_attr in config._testenv_attr:
atype = env_attr.type
try:
if atype in (
"bool",
"float",
"path",
"string",
"dict",
"dict_setenv",
"argv",
"argvlist",
"argv_install_command",
):
meth = getattr(reader, "get{}".format(atype))
res = meth(env_attr.name, env_attr.default, replace=replace)
elif atype == "basepython":
no_fallback = name in (config.provision_tox_env,)
res = reader.getstring(
env_attr.name,
env_attr.default,
replace=replace,
no_fallback=no_fallback,
)
elif atype == "space-separated-list":
res = reader.getlist(env_attr.name, sep=" ")
elif atype == "line-list":
res = reader.getlist(env_attr.name, sep="\n")
elif atype == "env-list":
res = reader.getstring(env_attr.name, replace=False)
res = tuple(_split_env(res))
else:
raise ValueError("unknown type {!r}".format(atype))
if env_attr.postprocess:
res = env_attr.postprocess(testenv_config=tc, value=res)
except tox.exception.MissingSubstitution as e:
tc._missing_subs.append(e.name)
res = e.FLAG
setattr(tc, env_attr.name, res)
if atype in ("path", "string", "basepython"):
reader.addsubstitutions(**{env_attr.name: res})
return tc
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def __init__(self, name):
self.name = name
super(Error, self).__init__(name)
|
def __init__(self, name):
self.name = name
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def setupenv(self):
if self.envconfig._missing_subs:
self.status = (
"unresolvable substitution(s):\n {}\n"
"Environment variables are missing or defined recursively.".format(
"\n ".join(
[
"{}: '{}'".format(section_key, exc.name)
for section_key, exc in sorted(
self.envconfig._missing_subs.items()
)
],
),
)
)
return
if not self.matching_platform():
self.status = "platform mismatch"
return # we simply omit non-matching platforms
with self.new_action("getenv", self.envconfig.envdir) as action:
self.status = 0
default_ret_code = 1
envlog = self.env_log
try:
status = self.update(action=action)
except IOError as e:
if e.args[0] != 2:
raise
status = (
"Error creating virtualenv. Note that spaces in paths are "
"not supported by virtualenv. Error details: {!r}".format(e)
)
except tox.exception.InvocationError as e:
status = e
except tox.exception.InterpreterNotFound as e:
status = e
if self.envconfig.config.option.skip_missing_interpreters == "true":
default_ret_code = 0
if status:
str_status = str(status)
command_log = envlog.get_commandlog("setup")
command_log.add_command(["setup virtualenv"], str_status, default_ret_code)
self.status = status
if default_ret_code == 0:
reporter.skip(str_status)
else:
reporter.error(str_status)
return False
command_path = self.getcommandpath("python")
envlog.set_python_info(command_path)
return True
|
def setupenv(self):
if self.envconfig._missing_subs:
self.status = (
"unresolvable substitution(s): {}. "
"Environment variables are missing or defined recursively.".format(
",".join(["'{}'".format(m) for m in self.envconfig._missing_subs]),
)
)
return
if not self.matching_platform():
self.status = "platform mismatch"
return # we simply omit non-matching platforms
with self.new_action("getenv", self.envconfig.envdir) as action:
self.status = 0
default_ret_code = 1
envlog = self.env_log
try:
status = self.update(action=action)
except IOError as e:
if e.args[0] != 2:
raise
status = (
"Error creating virtualenv. Note that spaces in paths are "
"not supported by virtualenv. Error details: {!r}".format(e)
)
except tox.exception.InvocationError as e:
status = e
except tox.exception.InterpreterNotFound as e:
status = e
if self.envconfig.config.option.skip_missing_interpreters == "true":
default_ret_code = 0
if status:
str_status = str(status)
command_log = envlog.get_commandlog("setup")
command_log.add_command(["setup virtualenv"], str_status, default_ret_code)
self.status = status
if default_ret_code == 0:
reporter.skip(str_status)
else:
reporter.error(str_status)
return False
command_path = self.getcommandpath("python")
envlog.set_python_info(command_path)
return True
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def get(self, name, default=None):
try:
return self.resolved[name]
except KeyError:
try:
if name in self._lookupstack:
raise KeyError(name)
val = self.definitions[name]
except KeyError:
return os.environ.get(name, default)
self._lookupstack.append(name)
try:
self.resolved[name] = res = self.reader._replace(val, name="setenv")
finally:
self._lookupstack.pop()
return res
|
def get(self, name, default=None):
try:
return self.resolved[name]
except KeyError:
try:
if name in self._lookupstack:
raise KeyError(name)
val = self.definitions[name]
except KeyError:
return os.environ.get(name, default)
self._lookupstack.append(name)
try:
self.resolved[name] = res = self.reader._replace(val)
finally:
self._lookupstack.pop()
return res
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def getargvlist(self, name, default="", replace=True):
s = self.getstring(name, default, replace=False)
return _ArgvlistReader.getargvlist(self, s, replace=replace, name=name)
|
def getargvlist(self, name, default="", replace=True):
s = self.getstring(name, default, replace=False)
return _ArgvlistReader.getargvlist(self, s, replace=replace)
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def getargv_install_command(self, name, default="", replace=True):
s = self.getstring(name, default, replace=False)
if not s:
# This occurs when factors are used, and a testenv doesnt have
# a factorised value for install_command, most commonly occurring
# if setting platform is also used.
# An empty value causes error install_command must contain '{packages}'.
s = default
if "{packages}" in s:
s = s.replace("{packages}", r"\{packages\}")
if "{opts}" in s:
s = s.replace("{opts}", r"\{opts\}")
return _ArgvlistReader.getargvlist(self, s, replace=replace, name=name)[0]
|
def getargv_install_command(self, name, default="", replace=True):
s = self.getstring(name, default, replace=False)
if not s:
# This occurs when factors are used, and a testenv doesnt have
# a factorised value for install_command, most commonly occurring
# if setting platform is also used.
# An empty value causes error install_command must contain '{packages}'.
s = default
if "{packages}" in s:
s = s.replace("{packages}", r"\{packages\}")
if "{opts}" in s:
s = s.replace("{opts}", r"\{opts\}")
return _ArgvlistReader.getargvlist(self, s, replace=replace)[0]
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def _replace(self, value, name=None, section_name=None, crossonly=False):
if "{" not in value:
return value
section_name = section_name if section_name else self.section_name
assert name
self._subststack.append((section_name, name))
try:
replaced = Replacer(self, crossonly=crossonly).do_replace(value)
assert self._subststack.pop() == (section_name, name)
except tox.exception.MissingSubstitution:
if not section_name.startswith(testenvprefix):
raise tox.exception.ConfigError(
"substitution env:{!r}: unknown or recursive definition in"
" section {!r}.".format(value, section_name),
)
raise
return replaced
|
def _replace(self, value, name=None, section_name=None, crossonly=False):
if "{" not in value:
return value
section_name = section_name if section_name else self.section_name
self._subststack.append((section_name, name))
try:
replaced = Replacer(self, crossonly=crossonly).do_replace(value)
assert self._subststack.pop() == (section_name, name)
except tox.exception.MissingSubstitution:
if not section_name.startswith(testenvprefix):
raise tox.exception.ConfigError(
"substitution env:{!r}: unknown or recursive definition in"
" section {!r}.".format(value, section_name),
)
raise
return replaced
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def _substitute_from_other_section(self, key):
if key.startswith("[") and "]" in key:
i = key.find("]")
section, item = key[1:i], key[i + 1 :]
cfg = self.reader._cfg
if section in cfg and item in cfg[section]:
if (section, item) in self.reader._subststack:
raise tox.exception.SubstitutionStackError(
"{} already in {}".format((section, item), self.reader._subststack),
)
x = str(cfg[section][item])
return self.reader._replace(
x,
name=item,
section_name=section,
crossonly=self.crossonly,
)
raise tox.exception.ConfigError("substitution key {!r} not found".format(key))
|
def _substitute_from_other_section(self, key):
if key.startswith("[") and "]" in key:
i = key.find("]")
section, item = key[1:i], key[i + 1 :]
cfg = self.reader._cfg
if section in cfg and item in cfg[section]:
if (section, item) in self.reader._subststack:
raise ValueError(
"{} already in {}".format((section, item), self.reader._subststack),
)
x = str(cfg[section][item])
return self.reader._replace(
x,
name=item,
section_name=section,
crossonly=self.crossonly,
)
raise tox.exception.ConfigError("substitution key {!r} not found".format(key))
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def getargvlist(cls, reader, value, replace=True, name=None):
"""Parse ``commands`` argvlist multiline string.
:param SectionReader reader: reader to be used.
:param str value: Content stored by key.
:rtype: list[list[str]]
:raise :class:`tox.exception.ConfigError`:
line-continuation ends nowhere while resolving for specified section
"""
commands = []
current_command = ""
for line in value.splitlines():
line = line.rstrip()
if not line:
continue
if line.endswith("\\"):
current_command += " {}".format(line[:-1])
continue
current_command += line
if is_section_substitution(current_command):
replaced = reader._replace(current_command, crossonly=True, name=name)
commands.extend(cls.getargvlist(reader, replaced, name=name))
else:
commands.append(
cls.processcommand(reader, current_command, replace, name=name)
)
current_command = ""
else:
if current_command:
raise tox.exception.ConfigError(
"line-continuation ends nowhere while resolving for [{}] {}".format(
reader.section_name,
"commands",
),
)
return commands
|
def getargvlist(cls, reader, value, replace=True):
"""Parse ``commands`` argvlist multiline string.
:param SectionReader reader: reader to be used.
:param str value: Content stored by key.
:rtype: list[list[str]]
:raise :class:`tox.exception.ConfigError`:
line-continuation ends nowhere while resolving for specified section
"""
commands = []
current_command = ""
for line in value.splitlines():
line = line.rstrip()
if not line:
continue
if line.endswith("\\"):
current_command += " {}".format(line[:-1])
continue
current_command += line
if is_section_substitution(current_command):
replaced = reader._replace(current_command, crossonly=True)
commands.extend(cls.getargvlist(reader, replaced))
else:
commands.append(cls.processcommand(reader, current_command, replace))
current_command = ""
else:
if current_command:
raise tox.exception.ConfigError(
"line-continuation ends nowhere while resolving for [{}] {}".format(
reader.section_name,
"commands",
),
)
return commands
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def processcommand(cls, reader, command, replace=True, name=None):
# Iterate through each word of the command substituting as
# appropriate to construct the new command string. This
# string is then broken up into exec argv components using
# shlex.
if replace:
newcommand = ""
for word in CommandParser(command).words():
if word == "[]":
newcommand += reader.getposargs()
continue
new_arg = ""
new_word = reader._replace(word, name=name)
new_word = reader._replace(new_word, name=name)
new_word = Replacer._unescape(new_word)
new_arg += new_word
newcommand += new_arg
else:
newcommand = command
# Construct shlex object that will not escape any values,
# use all values as is in argv.
shlexer = shlex.shlex(newcommand, posix=True)
shlexer.whitespace_split = True
shlexer.escape = ""
return list(shlexer)
|
def processcommand(cls, reader, command, replace=True):
# Iterate through each word of the command substituting as
# appropriate to construct the new command string. This
# string is then broken up into exec argv components using
# shlex.
if replace:
newcommand = ""
for word in CommandParser(command).words():
if word == "[]":
newcommand += reader.getposargs()
continue
new_arg = ""
new_word = reader._replace(word)
new_word = reader._replace(new_word)
new_word = Replacer._unescape(new_word)
new_arg += new_word
newcommand += new_arg
else:
newcommand = command
# Construct shlex object that will not escape any values,
# use all values as is in argv.
shlexer = shlex.shlex(newcommand, posix=True)
shlexer.whitespace_split = True
shlexer.escape = ""
return list(shlexer)
|
https://github.com/tox-dev/tox/issues/1716
|
tox -vv
using tox.ini: /home/jayvdb/projects/tox/my-tox-tests/tests/tox.ini (pid 23538)
removing /home/jayvdb/projects/tox/my-tox-tests/tests/.tox/log
[wikimedia] tox-wikimedia is enabled
Traceback (most recent call last):
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 65, in main
config = load_config(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/session/__init__.py", line 81, in load_config
config = parseconfig(args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox/config/__init__.py", line 281, in parseconfig
pm.hook.tox_configure(config=config) # post process config object
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/jayvdb/.cache/tox/my-tox-tests/py38-tox3_20-other/lib/python3.8/site-packages/tox_wikimedia/__init__.py", line 93, in tox_configure
if dep in cdep.name:
AttributeError: 'str' object has no attribute 'name'
|
AttributeError
|
def getargv_install_command(self, name, default="", replace=True):
s = self.getstring(name, default, replace=False)
if not s:
# This occurs when factors are used, and a testenv doesnt have
# a factorised value for install_command, most commonly occurring
# if setting platform is also used.
# An empty value causes error install_command must contain '{packages}'.
s = default
if "{packages}" in s:
s = s.replace("{packages}", r"\{packages\}")
if "{opts}" in s:
s = s.replace("{opts}", r"\{opts\}")
return _ArgvlistReader.getargvlist(self, s, replace=replace)[0]
|
def getargv_install_command(self, name, default="", replace=True):
s = self.getstring(name, default, replace=False)
if "{packages}" in s:
s = s.replace("{packages}", r"\{packages\}")
if "{opts}" in s:
s = s.replace("{opts}", r"\{opts\}")
return _ArgvlistReader.getargvlist(self, s, replace=replace)[0]
|
https://github.com/tox-dev/tox/issues/1464
|
when use `win: ` in `install_command` tox raise `IndexError`
full trackback:
`Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2019.2.4\helpers\pycharm\_jb_tox_runner.py", line 103, in <module>
config = tox_config.parseconfig(args=sys.argv[1:])
File "D:\Projects\python\cheetagp\biziou-backend\env\lib\site-packages\tox\config\__init__.py", line 273, in parseconfig
ParseIni(config, config_file, content)
File "D:\Projects\python\cheetagp\biziou-backend\env\lib\site-packages\tox\config\__init__.py", line 1178, in __init__
for key, (exc, trace) in failures.items()
tox.exception.ConfigError: ConfigError: test failed with list index out of range at Traceback (most recent call last):
File "D:\Projects\python\cheetagp\biziou-backend\env\lib\site-packages\tox\config\__init__.py", line 1150, in run
results[name] = cur_self.make_envconfig(name, section, subs, config)
File "D:\Projects\python\cheetagp\biziou-backend\env\lib\site-packages\tox\config\__init__.py", line 1302, in make_envconfig
res = meth(env_attr.name, env_attr.default, replace=replace)
File "D:\Projects\python\cheetagp\biziou-backend\env\lib\site-packages\tox\config\__init__.py", line 1559, in getargv
return self.getargvlist(name, default, replace=replace)[0]
IndexError: list index out of range`
|
tox.exception.ConfigError
|
def get_build_info(folder):
toml_file = folder.join("pyproject.toml")
# as per https://www.python.org/dev/peps/pep-0517/
def abort(message):
reporter.error("{} inside {}".format(message, toml_file))
raise SystemExit(1)
if not toml_file.exists():
reporter.error("missing {}".format(toml_file))
raise SystemExit(1)
config_data = get_py_project_toml(toml_file)
if "build-system" not in config_data:
abort("build-system section missing")
build_system = config_data["build-system"]
if "requires" not in build_system:
abort("missing requires key at build-system section")
if "build-backend" not in build_system:
abort("missing build-backend key at build-system section")
requires = build_system["requires"]
if not isinstance(requires, list) or not all(
isinstance(i, six.text_type) for i in requires
):
abort("requires key at build-system section must be a list of string")
backend = build_system["build-backend"]
if not isinstance(backend, six.text_type):
abort("build-backend key at build-system section must be a string")
args = backend.split(":")
module = args[0]
obj = args[1] if len(args) > 1 else ""
backend_paths = build_system.get("backend-path", [])
if not isinstance(backend_paths, list):
abort("backend-path key at build-system section must be a list, if specified")
backend_paths = [folder.join(p) for p in backend_paths]
normalized_folder = os.path.normcase(str(folder.realpath()))
normalized_paths = (
os.path.normcase(str(path.realpath())) for path in backend_paths
)
if not all(
os.path.commonprefix((normalized_folder, path)) == normalized_folder
for path in normalized_paths
):
abort("backend-path must exist in the project root")
return BuildInfo(requires, module, obj, backend_paths)
|
def get_build_info(folder):
toml_file = folder.join("pyproject.toml")
# as per https://www.python.org/dev/peps/pep-0517/
def abort(message):
reporter.error("{} inside {}".format(message, toml_file))
raise SystemExit(1)
if not toml_file.exists():
reporter.error("missing {}".format(toml_file))
raise SystemExit(1)
config_data = get_py_project_toml(toml_file)
if "build-system" not in config_data:
abort("build-system section missing")
build_system = config_data["build-system"]
if "requires" not in build_system:
abort("missing requires key at build-system section")
if "build-backend" not in build_system:
abort("missing build-backend key at build-system section")
requires = build_system["requires"]
if not isinstance(requires, list) or not all(
isinstance(i, six.text_type) for i in requires
):
abort("requires key at build-system section must be a list of string")
backend = build_system["build-backend"]
if not isinstance(backend, six.text_type):
abort("build-backend key at build-system section must be a string")
args = backend.split(":")
module = args[0]
obj = args[1] if len(args) > 1 else ""
backend_paths = build_system.get("backend-path", [])
if not isinstance(backend_paths, list):
abort("backend-path key at build-system section must be a list, if specified")
backend_paths = [folder.join(p) for p in backend_paths]
return BuildInfo(requires, module, obj, backend_paths)
|
https://github.com/tox-dev/tox/issues/1654
|
.package start: get-build-requires /Users/nicolas/Workspaces/proj/.tox/.package
setting PATH=/Users/nicolas/Workspaces/proj/.tox/.package/bin:/Users/nicolas/.virtualenvs/proj-python3.8/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
[15159] /Users/nicolas/Workspaces/proj$ /Users/nicolas/Workspaces/proj/.tox/.package/bin/python /Users/nicolas/.virtualenvs/proj-python3.8/lib/python3.8/site-packages/tox/helper/build_requires.py build_package '' >.tox/.package/log/.package-0.log
ERROR: invocation failed (exit code 1), logfile: /Users/nicolas/Workspaces/proj/.tox/.package/log/.package-0.log
=================================================================================== log start ====================================================================================
Traceback (most recent call last):
File "/Users/nicolas/.virtualenvs/proj-python3.8/lib/python3.8/site-packages/tox/helper/build_requires.py", line 7, in <module>
backend = __import__(backend_spec, fromlist=["_trash"])
ModuleNotFoundError: No module named 'build_package'
|
ModuleNotFoundError
|
def get_build_requires(build_info, package_venv, setup_dir):
with package_venv.new_action(
"get-build-requires", package_venv.envconfig.envdir
) as action:
result = package_venv._pcall(
[
package_venv.envconfig.envpython,
BUILD_REQUIRE_SCRIPT,
build_info.backend_module,
build_info.backend_object,
os.path.pathsep.join(str(p) for p in build_info.backend_paths),
],
returnout=True,
action=action,
cwd=setup_dir,
)
return json.loads(result.split("\n")[-2])
|
def get_build_requires(build_info, package_venv, setup_dir):
with package_venv.new_action(
"get-build-requires", package_venv.envconfig.envdir
) as action:
result = package_venv._pcall(
[
package_venv.envconfig.envpython,
BUILD_REQUIRE_SCRIPT,
build_info.backend_module,
build_info.backend_object,
],
returnout=True,
action=action,
cwd=setup_dir,
)
return json.loads(result.split("\n")[-2])
|
https://github.com/tox-dev/tox/issues/1654
|
.package start: get-build-requires /Users/nicolas/Workspaces/proj/.tox/.package
setting PATH=/Users/nicolas/Workspaces/proj/.tox/.package/bin:/Users/nicolas/.virtualenvs/proj-python3.8/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
[15159] /Users/nicolas/Workspaces/proj$ /Users/nicolas/Workspaces/proj/.tox/.package/bin/python /Users/nicolas/.virtualenvs/proj-python3.8/lib/python3.8/site-packages/tox/helper/build_requires.py build_package '' >.tox/.package/log/.package-0.log
ERROR: invocation failed (exit code 1), logfile: /Users/nicolas/Workspaces/proj/.tox/.package/log/.package-0.log
=================================================================================== log start ====================================================================================
Traceback (most recent call last):
File "/Users/nicolas/.virtualenvs/proj-python3.8/lib/python3.8/site-packages/tox/helper/build_requires.py", line 7, in <module>
backend = __import__(backend_spec, fromlist=["_trash"])
ModuleNotFoundError: No module named 'build_package'
|
ModuleNotFoundError
|
def __init__(self, config, ini_path, ini_data): # noqa
config.toxinipath = ini_path
using("tox.ini: {} (pid {})".format(config.toxinipath, os.getpid()))
config.toxinidir = config.toxinipath.dirpath()
self._cfg = py.iniconfig.IniConfig(config.toxinipath, ini_data)
previous_line_of = self._cfg.lineof
self.expand_section_names(self._cfg)
def line_of_default_to_zero(section, name=None):
at = previous_line_of(section, name=name)
if at is None:
at = 0
return at
self._cfg.lineof = line_of_default_to_zero
config._cfg = self._cfg
self.config = config
prefix = "tox" if ini_path.basename == "setup.cfg" else None
fallbacksection = "tox:tox" if ini_path.basename == "setup.cfg" else "tox"
context_name = getcontextname()
if context_name == "jenkins":
reader = SectionReader(
"tox:jenkins",
self._cfg,
prefix=prefix,
fallbacksections=[fallbacksection],
)
dist_share_default = "{toxworkdir}/distshare"
elif not context_name:
reader = SectionReader("tox", self._cfg, prefix=prefix)
dist_share_default = "{homedir}/.tox/distshare"
else:
raise ValueError("invalid context")
if config.option.hashseed is None:
hash_seed = make_hashseed()
elif config.option.hashseed == "noset":
hash_seed = None
else:
hash_seed = config.option.hashseed
config.hashseed = hash_seed
reader.addsubstitutions(toxinidir=config.toxinidir, homedir=config.homedir)
if config.option.workdir is None:
config.toxworkdir = reader.getpath("toxworkdir", "{toxinidir}/.tox")
else:
config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True)
if os.path.exists(str(config.toxworkdir)):
config.toxworkdir = config.toxworkdir.realpath()
reader.addsubstitutions(toxworkdir=config.toxworkdir)
config.ignore_basepython_conflict = reader.getbool(
"ignore_basepython_conflict", False
)
config.distdir = reader.getpath("distdir", "{toxworkdir}/dist")
reader.addsubstitutions(distdir=config.distdir)
config.distshare = reader.getpath("distshare", dist_share_default)
reader.addsubstitutions(distshare=config.distshare)
config.temp_dir = reader.getpath("temp_dir", "{toxworkdir}/.tmp")
reader.addsubstitutions(temp_dir=config.temp_dir)
config.sdistsrc = reader.getpath("sdistsrc", None)
config.setupdir = reader.getpath("setupdir", "{toxinidir}")
config.logdir = config.toxworkdir.join("log")
within_parallel = PARALLEL_ENV_VAR_KEY_PRIVATE in os.environ
if not within_parallel and not WITHIN_PROVISION:
ensure_empty_dir(config.logdir)
# determine indexserver dictionary
config.indexserver = {"default": IndexServerConfig("default")}
prefix = "indexserver"
for line in reader.getlist(prefix):
name, url = map(lambda x: x.strip(), line.split("=", 1))
config.indexserver[name] = IndexServerConfig(name, url)
if config.option.skip_missing_interpreters == "config":
val = reader.getbool("skip_missing_interpreters", False)
config.option.skip_missing_interpreters = "true" if val else "false"
override = False
if config.option.indexurl:
for url_def in config.option.indexurl:
m = re.match(r"\W*(\w+)=(\S+)", url_def)
if m is None:
url = url_def
name = "default"
else:
name, url = m.groups()
if not url:
url = None
if name != "ALL":
config.indexserver[name].url = url
else:
override = url
# let ALL override all existing entries
if override:
for name in config.indexserver:
config.indexserver[name] = IndexServerConfig(name, override)
self.handle_provision(config, reader)
self.parse_build_isolation(config, reader)
res = self._getenvdata(reader, config)
config.envlist, all_envs, config.envlist_default, config.envlist_explicit = res
# factors used in config or predefined
known_factors = self._list_section_factors("testenv")
known_factors.update({"py", "python"})
# factors stated in config envlist
stated_envlist = reader.getstring("envlist", replace=False)
if stated_envlist:
for env in _split_env(stated_envlist):
known_factors.update(env.split("-"))
# configure testenvs
to_do = []
failures = OrderedDict()
results = {}
cur_self = self
def run(name, section, subs, config):
try:
results[name] = cur_self.make_envconfig(name, section, subs, config)
except Exception as exception:
failures[name] = (exception, traceback.format_exc())
order = []
for name in all_envs:
section = "{}{}".format(testenvprefix, name)
factors = set(name.split("-"))
if (
section in self._cfg
or factors <= known_factors
or all(
tox.PYTHON.PY_FACTORS_RE.match(factor)
for factor in factors - known_factors
)
):
order.append(name)
thread = Thread(target=run, args=(name, section, reader._subs, config))
thread.daemon = True
thread.start()
to_do.append(thread)
for thread in to_do:
while thread.is_alive():
thread.join(timeout=20)
if failures:
raise tox.exception.ConfigError(
"\n".join(
"{} failed with {} at {}".format(key, exc, trace)
for key, (exc, trace) in failures.items()
),
)
for name in order:
config.envconfigs[name] = results[name]
all_develop = all(
name in config.envconfigs and config.envconfigs[name].usedevelop
for name in config.envlist
)
config.skipsdist = reader.getbool("skipsdist", all_develop)
if config.option.devenv is not None:
config.option.notest = True
if config.option.devenv is not None and len(config.envlist) != 1:
feedback("--devenv requires only a single -e", sysexit=True)
|
def __init__(self, config, ini_path, ini_data): # noqa
config.toxinipath = ini_path
using("tox.ini: {} (pid {})".format(config.toxinipath, os.getpid()))
config.toxinidir = config.toxinipath.dirpath()
self._cfg = py.iniconfig.IniConfig(config.toxinipath, ini_data)
previous_line_of = self._cfg.lineof
self.expand_section_names(self._cfg)
def line_of_default_to_zero(section, name=None):
at = previous_line_of(section, name=name)
if at is None:
at = 0
return at
self._cfg.lineof = line_of_default_to_zero
config._cfg = self._cfg
self.config = config
prefix = "tox" if ini_path.basename == "setup.cfg" else None
fallbacksection = "tox:tox" if ini_path.basename == "setup.cfg" else "tox"
context_name = getcontextname()
if context_name == "jenkins":
reader = SectionReader(
"tox:jenkins",
self._cfg,
prefix=prefix,
fallbacksections=[fallbacksection],
)
dist_share_default = "{toxworkdir}/distshare"
elif not context_name:
reader = SectionReader("tox", self._cfg, prefix=prefix)
dist_share_default = "{homedir}/.tox/distshare"
else:
raise ValueError("invalid context")
if config.option.hashseed is None:
hash_seed = make_hashseed()
elif config.option.hashseed == "noset":
hash_seed = None
else:
hash_seed = config.option.hashseed
config.hashseed = hash_seed
reader.addsubstitutions(toxinidir=config.toxinidir, homedir=config.homedir)
if config.option.workdir is None:
config.toxworkdir = reader.getpath("toxworkdir", "{toxinidir}/.tox")
else:
config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True)
if os.path.exists(str(config.toxworkdir)):
config.toxworkdir = config.toxworkdir.realpath()
reader.addsubstitutions(toxworkdir=config.toxworkdir)
config.ignore_basepython_conflict = reader.getbool(
"ignore_basepython_conflict", False
)
config.distdir = reader.getpath("distdir", "{toxworkdir}/dist")
reader.addsubstitutions(distdir=config.distdir)
config.distshare = reader.getpath("distshare", dist_share_default)
config.temp_dir = reader.getpath("temp_dir", "{toxworkdir}/.tmp")
reader.addsubstitutions(distshare=config.distshare)
config.sdistsrc = reader.getpath("sdistsrc", None)
config.setupdir = reader.getpath("setupdir", "{toxinidir}")
config.logdir = config.toxworkdir.join("log")
within_parallel = PARALLEL_ENV_VAR_KEY_PRIVATE in os.environ
if not within_parallel and not WITHIN_PROVISION:
ensure_empty_dir(config.logdir)
# determine indexserver dictionary
config.indexserver = {"default": IndexServerConfig("default")}
prefix = "indexserver"
for line in reader.getlist(prefix):
name, url = map(lambda x: x.strip(), line.split("=", 1))
config.indexserver[name] = IndexServerConfig(name, url)
if config.option.skip_missing_interpreters == "config":
val = reader.getbool("skip_missing_interpreters", False)
config.option.skip_missing_interpreters = "true" if val else "false"
override = False
if config.option.indexurl:
for url_def in config.option.indexurl:
m = re.match(r"\W*(\w+)=(\S+)", url_def)
if m is None:
url = url_def
name = "default"
else:
name, url = m.groups()
if not url:
url = None
if name != "ALL":
config.indexserver[name].url = url
else:
override = url
# let ALL override all existing entries
if override:
for name in config.indexserver:
config.indexserver[name] = IndexServerConfig(name, override)
self.handle_provision(config, reader)
self.parse_build_isolation(config, reader)
res = self._getenvdata(reader, config)
config.envlist, all_envs, config.envlist_default, config.envlist_explicit = res
# factors used in config or predefined
known_factors = self._list_section_factors("testenv")
known_factors.update({"py", "python"})
# factors stated in config envlist
stated_envlist = reader.getstring("envlist", replace=False)
if stated_envlist:
for env in _split_env(stated_envlist):
known_factors.update(env.split("-"))
# configure testenvs
to_do = []
failures = OrderedDict()
results = {}
cur_self = self
def run(name, section, subs, config):
try:
results[name] = cur_self.make_envconfig(name, section, subs, config)
except Exception as exception:
failures[name] = (exception, traceback.format_exc())
order = []
for name in all_envs:
section = "{}{}".format(testenvprefix, name)
factors = set(name.split("-"))
if (
section in self._cfg
or factors <= known_factors
or all(
tox.PYTHON.PY_FACTORS_RE.match(factor)
for factor in factors - known_factors
)
):
order.append(name)
thread = Thread(target=run, args=(name, section, reader._subs, config))
thread.daemon = True
thread.start()
to_do.append(thread)
for thread in to_do:
while thread.is_alive():
thread.join(timeout=20)
if failures:
raise tox.exception.ConfigError(
"\n".join(
"{} failed with {} at {}".format(key, exc, trace)
for key, (exc, trace) in failures.items()
),
)
for name in order:
config.envconfigs[name] = results[name]
all_develop = all(
name in config.envconfigs and config.envconfigs[name].usedevelop
for name in config.envlist
)
config.skipsdist = reader.getbool("skipsdist", all_develop)
if config.option.devenv is not None:
config.option.notest = True
if config.option.devenv is not None and len(config.envlist) != 1:
feedback("--devenv requires only a single -e", sysexit=True)
|
https://github.com/tox-dev/tox/issues/1608
|
Traceback (most recent call last):
File "~/.pyenv/versions/3.8.0/lib/python3.8/runpy.py", line 192, in _
run_module_as_main
return _run_code(code, main_globals, None,
File "~/.pyenv/versions/3.8.0/lib/python3.8/runpy.py", line 85, in _run_code
exec(code, run_globals)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/__main__.py", line 4, in <module>
tox.cmdline()
File ".../.tox/.tox/lib/python3.8/site-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/session/__init__.py", line 64, in main
config = load_config(args)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/session/__init__.py", line 80, in load_config
config = parseconfig(args)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 274, in parseconfig
ParseIni(config, config_file, content)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1193, in __init__
raise tox.exception.ConfigError(
tox.exception.ConfigError: ConfigError: docs failed with ConfigError: substitution key 'temp_dir' not found at Traceback (most recent call last):
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1169, in run
results[name] = cur_self.make_envconfig(name, section, subs, config)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1317, in make_envconfig
res = meth(env_attr.name, env_attr.default, replace=replace)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1586, in getargvlist
return _ArgvlistReader.getargvlist(self, s, replace=replace)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1796, in getargvlist
commands.append(cls.processcommand(reader, current_command, replace))
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1832, in processcommand
new_word = reader._replace(word)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1643, in _replace
replaced = Replacer(self, crossonly=crossonly).do_replace(value)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1679, in do_replace
expanded = substitute_once(value)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1677, in substitute_once
return self.RE_ITEM_REF.sub(self._replace_match, x)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1724, in _replace_match
return self._replace_substitution(match)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1759, in _replace_substitution
val = self._substitute_from_other_section(sub_key)
File ".../.tox/.tox/lib/python3.8/site-packages/tox/config/__init__.py", line 1753, in _substitute_from_other_section
raise tox.exception.ConfigError("substitution key {!r} not found".format(key))
tox.exception.ConfigError: ConfigError: substitution key 'temp_dir' not found
|
tox.exception.ConfigError
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.