Yasi
Yasi

Reputation: 35

Error report on creating environment from a yml file

I am trying to create a conda environment from a yml file with which I was able to create the environment and use it as my interpreter in the past. (OS: Windows 64 - Python through Anaconda - IDE: VS Code)

I had to delete this environment several times and created it again because of new dependencies added to this environment (conda env update --prefix ./env --file environment.yml --prune did not work). I had to also delete some dll files manually from the environment.

So far environment creation worked. After a while, I created the environment again and got the error UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service However, mkl-service was included in the yml file.

I removed the environment and deleted the whole folder manually from C:\Users\Anaconda3\envs. Now, when I try to create environment in VS code terminal, I get the Error report:

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

    Traceback (most recent call last):
      File "C:\Users\Anaconda3\lib\site-packages\conda\exceptions.py", line 10
        return func(*args, **kwargs)
      File "C:\Users\Anaconda3\lib\site-packages\conda_env\cli\main.py", line 
        exit_code = getattr(module, func_name)(args, parser)
      File "C:\Users\Anaconda3\lib\site-packages\conda_env\cli\main_update.py"
        spec = install_specs.detect(name=name, filename=get_filename(args.file),
      File "C:\Users\Anaconda3\lib\site-packages\conda_env\specs\__init__.py",
        if spec.can_handle():
      File "C:\Users\Anaconda3\lib\site-packages\conda_env\specs\yaml_file.py"
        self._environment = env.from_file(self.filename)
      File "C:\Users\Anaconda3\lib\site-packages\conda_env\env.py", line 166, 
        return from_yaml(yamlstr, filename=filename)
      File "C:\Users\Anaconda3\lib\site-packages\conda_env\env.py", line 143, 
        data = yaml_safe_load(yamlstr)
      File "C:\Users\Anaconda3\lib\site-packages\conda\common\serialize.py", l
        return yaml.safe_load(string, version="1.2")
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 98
        return load(stream, SafeLoader, version)
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\main.py", line 93
        return loader._constructor.get_single_data()
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\constructor.py", 
        node = self.composer.get_single_node()
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        document = self.compose_document()
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        node = self.compose_node(None, None)
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        node = self.compose_mapping_node(anchor)
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        item_value = self.compose_node(node, item_key)
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        node = self.compose_sequence_node(anchor)
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        node.value.append(self.compose_node(node, index))
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        node = self.compose_mapping_node(anchor)
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        item_value = self.compose_node(node, item_key)
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        node = self.compose_sequence_node(anchor)
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\composer.py", lin
        while not self.parser.check_event(SequenceEndEvent):
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\parser.py", line 
        self.current_event = self.state()
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\parser.py", line 
        if self.scanner.check_token(BlockEntryToken):
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\scanner.py", line
        while self.need_more_tokens():
      File "C:\Users\Anaconda3\lib\site-packages\ruamel_yaml\scanner.py", line
        self.stale_possible_simple_keys()

    could not find expected ':'
      in "<unicode string>", line 40, column 1:
        prefix: C:\Users\.conda\ ...
        ^ (line: 40)

`$ C:\Users\Anaconda3\Scripts\conda-env-script.py update --prefix ./env --file

  environment variables:
                 CIO_TEST=<not set>
  CONDA_AUTO_UPDATE_CONDA=false
        CONDA_DEFAULT_ENV=environment
                CONDA_EXE=C:\Users\Anaconda3\condabin\..\Scripts\conda.exe
               CONDA_EXES="C:\Users\Anaconda3\condabin\..\Scripts\conda.exe"
             CONDA_PREFIX=C:\Users\Anaconda3\envs\environment
           CONDA_PREFIX_1=C:\Users\Anaconda3
    CONDA_PROMPT_MODIFIER=(environment)
         CONDA_PYTHON_EXE=C:\Users\Anaconda3\python.exe
               CONDA_ROOT=C:\Users\Anaconda3
              CONDA_SHLVL=2
           CURL_CA_BUNDLE=<not set>
                 HOMEPATH=\Users
                     PATH=C:\Users\Anaconda3;C:\Users\Anaconda3\Librar
                          4\bin;C:\Users\Anaconda3\Library\usr\bin;C:\Users\ab
                          onda3\Library\bin;C:\Users\Anaconda3\Scripts;C:\User
                          Anaconda3\bin;C:\Users\Anaconda3\envs\environment;C:
                          pbzz\Anaconda3\envs\environment\Library\mingw-w64\bin;C:\Use
                          \Anaconda3\envs\environment\Library\usr\bin;C:\Users
                          \envs\environment\Library\bin;C:\Users\Anaconda3\env
                          ent\Scripts;C:\Users\Anaconda3\envs\environment\bin;
                          bjpbzz\Anaconda3\condabin;C:\Program Files (x86)\VMware\VMwa
                          Workstation\bin;C:\Program Files\Microsoft MPI\Bin;C:\WINDOW
                          ;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\Win
                          hell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program
                          Files\1E\Client\Extensibility\NomadBranch;C:\Program Files\M
                          SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files
                          (x86)\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\M
                          SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL
                          Server\150\DTS\Binn;C:\Program Files (x86)\Microsoft SQL
                          Server\150\DTS\Binn;C:\Program Files\Azure Data Studio\bin;C
                          jpbzz\Anaconda3;C:\Users\Anaconda3\Library\mingw-w64
                          ers\Anaconda3\Library\usr\bin;C:\Users\Anaco
                          ry\bin;C:\Users\Anaconda3\Scripts;C:\Users\A
                          al\Microsoft\WindowsApps;C:\Users\AppData\Local\Prog
                          md;C:\Users\AppData\Local\Programs\Microsoft VS
                          Code\bin;C:\Program Files\Azure Data
                          Studio\bin;C:\Users\AppData\Local\GitHubDesktop\bin;
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system
                          PowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft Azu
                          Information Protection\Powershell;C:\Program Files (x86)\Mic
                          Server\150\Tools\PowerShell\Modules\
       REQUESTS_CA_BUNDLE=<not set>
         SSF_LIBRARY_PATH=C:\Program Files (x86)\SAP\FrontEnd\SecureLogin\lib\sapcrypt
            SSL_CERT_FILE=<not set>
         STTASKFOLDERPATH=Ivanti\PatchSDK\Deployments

     active environment : environment
    active env location : C:\Users\Anaconda3\envs\environment
            shell level : 2
       user config file : C:\Users\.condarc
 populated config files : C:\Users\.condarc
          conda version : 4.10.3
    conda-build version : 3.21.4
         python version : 3.8.8.final.0
       virtual packages : __cuda=11.0=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\Anaconda3  (writable)
      conda av data dir : C:\Users\Anaconda3\etc\conda
  conda av metadata url : None
ta\Local\conda\conda\pkgs
       envs directories : C:\Users\Anaconda3\envs
                          C:\Users\.conda\envs
                          C:\Users\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.10.3 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?

I guess somewhere I made a fatal mistake, but don't know where. Any idea or solution will be appreciated.

update1:

.yml file:

name: environment
channels:
  - defaults
dependencies:
  - blas=1.0
  - ca-certificates=2021.5.25
  - certifi=2021.5.30
  - icc_rt=2019.0.0
  - intel-openmp=2021.2.0
  - joblib=0.17.0
  - mkl=2020.2
  - mkl-service=2.3.0
  - mkl_fft=1.3.0
  - mkl_random=1.1.1
  - numpy=1.19.2
  - numpy-base=1.19.2
  - openssl=1.1.1k
  - pandas=1.2.4
  - patsy=0.5.1
  - pickleshare=0.7.5
  - pip=21.1.1
  - pyodbc=4.0.30
  - python=3.7.4
  - python-dateutil
  - pytz=2021.1
  - scipy=1.6.2
  - setuptools=52.0.0
  - six=1.15.0
  - sqlite=3.35.4
  - statsmodels=0.12.0
  - threadpoolctl=2.1.0
  - vc=14.2
  - vs2015_runtime=14.27.29016
  - wheel=0.36.2
  - wincertstore=0.2
  - pip:
    - imblearn==0.0
    - scikit-learn==0.23.2
prefix: C:\Users\.conda\envs\environment

Update2: I changed the project repo and was able to create the environment. But don't know, why this is happening. If I find a reasonable solution, I'll share with you.

Upvotes: 1

Views: 2858

Answers (1)

normanius
normanius

Reputation: 9762

It looks like there's a formatting problem in your YAML file. Use single quotes when writing paths containing colons : and backslashes \. In particular, fix the prefix setting as follows:

prefix: 'C:\Users\.conda\envs\environment'

See also this related helpful post about when and how to use quotes in a YAML file.

Upvotes: 1

Related Questions