1
$\begingroup$

I got a very strange error when run conda env create -f environment.yml. Due to proprietary information, I cannot share the content of environemnt.yml, except that it contains a pip section

  - pip
  - pip:
      - sqlalchemy
      - pyyaml

It seems to run OK up to the creation of the requirements.txt file, and then throw the following error

Collecting package metadata: done
Solving environment: done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "C:\Users\***\AppData\Local\Continuum\anaconda3\lib\site-packages\conda_env\installers\pip.py", line 42, in _pip_install_via_requirements
        requirements.write('\n'.join(specs))
    TypeError: sequence item 11: expected str instance, list found

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\***\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1003, in __call__
        return func(*args, **kwargs)
      File "C:\Users\***\AppData\Local\Continuum\anaconda3\lib\site-packages\conda_env\cli\main.py", line 73, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "C:\Users\***\AppData\Local\Continuum\anaconda3\lib\site-packages\conda_env\cli\main_create.py", line 101, in execute
        installer.install(prefix, pkg_specs, args, env)
      File "C:\Users\***\AppData\Local\Continuum\anaconda3\lib\site-packages\conda_env\installers\pip.py", line 52, in _pip_install_via_requirements
        os.remove(requirements.name)
    PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\**current\\work\\dir**\\condaenv.7syuvz37.requirements.txt'

At the end, it asks me to send the report to (conda) core maintainer. Before answering it, I checked the requirements.txt file, it was generated (0 bytes, not read only, owned by me) by this process (based on creation time). I cannot delete it before answering the y/N question. Then I typed N to deny sending the report. Afterwards, I can delete the file. (This seems to suggest that it is NOT locked by others).

I also killed all Python processes using Windows task manager, and rebooted Windows, and ran this command as the first thing (in Anaconda Prompt), with no luck.

Thanks for any suggestions or insights.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.