Permission error on conda environment temp file when running in Windows OS
hengkuanwee opened this issue · comments
I am receiving the following error (in .tox/python/log/python-0.log) when running tox.
# Error snippet
File "C:\Users\xxx\Anaconda3\lib\site-packages\conda_env\env.py", line 163, in from_file
with open(filename, 'rb') as fp:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\yyy\\tox_conda_tmp13zv20n4.yaml'
`$ C:\Users\xxx\Anaconda3\Scripts\conda-env-script.py create -p python --file C:\Users\yyy\tox_conda_tmp13zv20n4.yaml`
Steps to reproduce the error on Window OS (Windows 10).
tox.ini
[tox]
envlist = py310
skipsdist = True
[testenv]
conda_env =
environment.yaml
environment.yaml
name: tox_environment
dependencies:
- python=3.10
- pytest=7.1.2
- tox=3.27.1
- tox-conda=0.10.1
run the following commands on Windows OS
# create conda env
conda env create -f environment.yaml
conda activate tox_environment
# run tox
tox
Suspected cause of error
I suspect that the error might be due to the use of tempfile.NamedTemporaryFile in plugins.py. As per docs:
That name can be retrieved from the name attribute of the returned file-like object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows)
Any help is appreciated, thanks!
@hengkuanwee Could you provide a reproducer?
will do, let me update the comment above, so it's easier to reference. To clarify, reproducer means all details to reproduce the error?
Hi @AntoineD, I have
- tested and updated the reproducer
- also fixed the PR on the failed testings
Do let me know if there's anything else I can improve on 😄
@hengkuanwee Where is the reproducer?
Hi @AntoineD I assumed reproducer was the steps required to reproduce the error (which I updated in the original comment). Can I check what do you mean by reproducer?
I haven't seen you've updated the original comment, thank you!
Version 0.10.2 contains your fix, thank you!
Hi @AntoineD, thank you and much appreciated 😄