Search code examples
validationterminalpytorchanaconda

libxml2_activate.sh:export:12: not valid in this context: XML_CATALOG_FILES+ after Pytorch installation attempt on MacOS via Anaconda


I had initially ran the following command on my MacOS in an attempt to install Pytorch,

conda install pytorch torchvision -c pytorch

The installation appeared to complete successfully, but at the end this appeared

/opt/homebrew/Caskroom/miniforge/base/etc/conda/activate.d/libxml2_activate.sh:export:12: not valid in this context: XML_CATALOG_FILES+ This also appears at the start of any terminal window i open

And I'm not exactly sure what this means. I've tried to verify if Pytorch would work but each time I run the test command featured at the official website, it never recognises the input. I've also tried running the installation command again, it mentions that all requested packages already installed. Any help would be greatly appreciated, thank you for reading.


Solution

  • I had the exact same issue after running conda update --all. I believe I solved it going to my libxml2_activate.sh file and replacing line 12 (the last one):

    export XML_CATALOG_FILES+="${conda_catalog_files}"
    

    with

    XML_CATALOG_FILES+="${conda_catalog_files}"
    export XML_CATALOG_FILES
    

    I am by no means an expert in bash files, but based on this gnu docs, I believe what I did is valid. Second opinions are appreciated.