0

I have Anaconda 1.9.7 installed on Mac 10.14.16. I encountered a strange behaviour when a new env is installed. which python show the correct python path, but the site-packages are linked to another environment, so when I use pip install it tries to put the package into another environment's site-package.

I have no idea why this happens. Not sure if I accidentally changed the bash_profile.

This code looks ok:

# added by Anaconda3 2019.07 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

Any idea how I can fix this issue?

ChrisM
  • 505
  • 6
  • 18
J_yang
  • 2,672
  • 8
  • 32
  • 61
  • Have you got a PYTHON_PATH environment variable being set somewhere? That can cause issues. Just try `echo $PYTHON_PATH` before activating a conda environment to check. – Matt Pitkin Oct 01 '19 at 09:46
  • Hi, I tried echo $PYTHON_PATH but nothing is printed. and which python pointed to //anaconda3/bin/python – J_yang Oct 01 '19 at 09:54
  • Hmm, looks like `PYTHON_PATH` is not the culprit then. Have a look at what pip is being used with `which pip`. – Matt Pitkin Oct 01 '19 at 10:28
  • which pip showed: //anaconda3/bin/pip. Then this is what is shown on a new env called test_pyaudio, when I pip install PyAudio. It tells me I already has PyAudio at another env called pya: (test_pyaudio) ~ $ which pip //anaconda3/envs/test_pyaudio/bin/pip (test_pyaudio) ~ $ pip install pyaudio Requirement already satisfied: pyaudio in /anaconda3/envs/pya/lib/python3.7/site-packages (0.2.11) – J_yang Oct 01 '19 at 10:37
  • 1
    I've realised my comment above should have been `echo $PYTHONPATH` without the underscore. Try that and see it you see anything, which seems to have been the issue in this question https://stackoverflow.com/questions/41060382/using-pip-to-install-packages-to-anaconda-environment. – Matt Pitkin Oct 01 '19 at 10:45
  • Possible duplicate of [Using Pip to install packages to Anaconda Environment](https://stackoverflow.com/questions/41060382/using-pip-to-install-packages-to-anaconda-environment) – Matt Pitkin Oct 02 '19 at 09:57

0 Answers0