Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't create conda environment from environment.yml

Tags:

python

I'm trying to install an environment.yml file and I keep getting an error every time.

It seems that I need execute this from my cmd: conda env create -f environment.yml

Which I do but end up with this error:

What do I need to do to make this work? Is it because of the wrong path? Haven't managed to install the environment, unless I just manually create the env. Unclear on the steps, new to python.

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

    Traceback (most recent call last):
      File "C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\lib\site-packages\conda\exceptions.py", line 1003, in __call__
        return func(*args, **kwargs)
      File "C:\Users\sricg\Documents\UPenn\MUSA-620\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\sricg\Documents\UPenn\MUSA-620\Anaconda3\lib\site-packages\conda_env\cli\main_create.py", line 77, in execute
        directory=os.getcwd())
      File "C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\lib\site-packages\conda_env\specs\__init__.py", line 40, in detect
        if spec.can_handle():
      File "C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\lib\site-packages\conda_env\specs\yaml_file.py", line 18, in can_handle
        self._environment = env.from_file(self.filename)
      File "C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\lib\site-packages\conda_env\env.py", line 142, in from_file
        yamlstr = fp.read()
      File "C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 37055: character maps to <undefined>

`$ C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\Scripts\conda-env-script.py create -f environment.yml`

  environment variables:
                 CIO_TEST=<not set>
  CONDA_AUTO_UPDATE_CONDA=false
                CONDA_EXE=C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\condabin\..\Scripts\
                          conda.exe
               CONDA_EXES="C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\condabin\..\Scripts
                          \conda.exe"
               CONDA_ROOT=C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3
                 HOMEPATH=\Users\sricg
      MIC_LD_LIBRARY_PATH=C:\Program Files (x86)\Common Files\Intel\Shared
                          Libraries\compiler\lib\mic
                     PATH=C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3;C:\Users\sricg\Docum
                          ents\UPenn\MUSA-620\Anaconda3\Library\mingw-w64\bin;C:\Users\sricg\Doc
                          uments\UPenn\MUSA-620\Anaconda3\Library\usr\bin;C:\Users\sricg\Documen
                          ts\UPenn\MUSA-620\Anaconda3\Library\bin;C:\Users\sricg\Documents\UPenn
                          \MUSA-620\Anaconda3\Scripts;C:\Users\sricg\Documents\UPenn\MUSA-620\An
                          aconda3\bin;C:\Program Files (x86)\NVIDIA
                          Corporation\PhysX\Common;C:\Program Files (x86)\Common
                          Files\Oracle\Java\javapath;C:\Program Files (x86)\Common
                          Files\Intel\Shared Libraries\redist\intel64\compiler;C:\WINDOWS\system
                          32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowe
                          rShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Common
                          Files\Autodesk Shared\;C:\Program Files\NVIDIA Corporation\NVIDIA
                          NvDLISR;C:\Program Files\Microsoft SQL Server\Client
                          SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL
                          Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL
                          Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL
                          Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows
                          Performance Toolkit\;C:\Users\sricg\Documents\Upenn\MUSA-620\Anaconda3
                          ;C:\Users\sricg\Documents\Upenn\MUSA-620\Anaconda3\Library\mingw-w64\b
                          in;C:\Users\sricg\Documents\Upenn\MUSA-620\Anaconda3\Library\usr\bin;C
                          :\Users\sricg\Documents\Upenn\MUSA-620\Anaconda3\Library\bin;C:\Users\
                          sricg\Documents\Upenn\MUSA-620\Anaconda3\Scripts;C:\Users\sricg\AppDat
                          a\Local\Microsoft\WindowsApps;C:\Users\sricg\AppData\Roaming\Dashlane\
                          5.3.2.14186\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9
                          f}\components;C:\Users\sricg\AppData\Roaming\Dashlane\5.3.2.14186\ucrt
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\Windows
                          PowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQL
                          Server\120\Tools\PowerShell\Modules\
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : C:\Users\sricg\.condarc
 populated config files :
          conda version : 4.6.14
    conda-build version : 3.17.8
         python version : 3.7.3.final.0
       base environment : C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\pkgs
                          C:\Users\sricg\.conda\pkgs
                          C:\Users\sricg\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\sricg\Documents\UPenn\MUSA-620\Anaconda3\envs
                          C:\Users\sricg\.conda\envs
                          C:\Users\sricg\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.6.14 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.17763
          administrator : False
             netrc file : None
           offline mode : False

like image 835
Srikanth Gowda Avatar asked Dec 11 '22 03:12

Srikanth Gowda


1 Answers

I had same problem when I tried to import env from Windows to my Mac. I was able to solve the problem via converting environment.yml to UTF-8. It was VSCode in Windows that save it as UTF-16LE.

I could convert the encoding in VSCode by clicking the encoding label in the bottom bar and select "Save with Encoding".

Or you can also convert the encoding to UTF-8 with NotePad in Windows by selecting "UTF-8" from the drop-down box when you "Save As" the file.

like image 197
Ingtellect Avatar answered Jan 06 '23 02:01

Ingtellect