Reputation: 1025
I recently switched mac computers. My old computer had conda and all the relevant libraries and environments installed. I transferred all the files from the old computer to my new one. However, my new computer has a different username (home directory name) than the old one, so whenever I run conda commands, I get errors like the following:
__conda_exe:2: no such file or directory: /Users/[old_username]/anaconda/bin/conda
I can circumvent this initial error by manually setting $PATH each time, but then I still get errors like this:
__add_sys_prefix_to_path:6: command not found: dirname
__add_sys_prefix_to_path:7: command not found: dirname
__conda_exe:2: no such file or directory: /Users/[old_username]/anaconda/bin/conda
Is there a way to change this so the commands point to my new home directory?
Upvotes: 2
Views: 1985
Reputation: 76750
I believe you need to use CPR
(conda-prefix-replacement) for this.
However, I'd instead recommend not manually transferring the files, since this usually fails to retain hardlinks. Instead, dump each of your environments to YAML
conda env export -n envname > env.yaml
and recreate them on the new system (after a minimal base install, like Miniconda)
conda env create -n envname -f env.yaml
I would not recommend transferring the old base, but if you must, put it in a new location:
# old system
conda env export -n base > old_base.yaml
# new system
conda env create -n old_base -f old_base.yaml
Upvotes: 1