Conda & Dealing with Conflicting Python(s) in your system

Bernardo on November 09, 2017

(Disclaimer: talking about a unix (me on linux) system here) The problem I took up a course on robotics using Robot Operating System (R... [Read Full]
markdown guide
 

I use conda for data science work; right now I have a simple bash function to start it up.

gogoconda ()
{
    export PATH="/Users/alysivji/anaconda/bin:$PATH"
    echo "Conda is activated"
}

Then $ gogoconda as required.

This seems a lot cleaner. Thanks!

 

@Aly Sivji, that is interesting. What script would contain your bash gogoconda function? Would you not get the same result by creating a 'gogoconda' shell script such as:

gogoconda.sh

#!/bin/bash

export PATH="/Users/alysivji/anaconda/bin:$PATH"
echo "Conda is activated"
 

I have that function in my ~/.bash_profile. And yes, you can also have a separate script. Might be easier to collect all your scripts into a central location.

 

For some reason, I am unable to use the activate, conda, or deactivate functions. It says no such file or directory. Do you know why this could be?

 

It sounds like conda is not properly installed. If it is, then the conda environment is not in $PATH. In linux, add the line export PATH="/home/your-username/miniconda3/bin:PATH" to your ~/.bashrc. Then retry.

 

I am using miniconda, so I am unsure if the commands are different. I am able to add that line, and then use commands like conda activate, etc. but I would like to jump back in forth between versions without having to change my bashrc everytime. I wanted to use this symlink method to fix that, but it doesn't allow me to use symlinks. Do I have to make them executable or change some internal setting?

sorry my bad!

  • Miniconda is just a smaller version of Conda including just the bare minimum, such as the conda command

From what I can understand from what you said, I think you may have forgotten to add the symlink folder to the path!

So yes, scratch that thing that I told you in my previous comment (we were checking if conda was there).

Now, add this to the bashrc file (it always remains persistent to your last save and this file is run everytime you open a terminal) export PATH="/home/your-username/.symlinks:$PATH", and run source ~/.bashrc just to make sure that the path variable is updated (it's like re-running a script). Retry and let me know.

(you're on linux/unix right? I cannot help with Windows :))

Yeah I am running Ubuntu 16.04. So I did that and still same issue. I attached a picture. The only way to get it back to the miniconda location is to run unset PYTHONPATH and then when I run anything in a conda env, it finds the right path by itself.

Yes I am on Linux (specifically Ubuntu 16.04). I have added it to path and still getting the same error where the command doesn't register. Do you know any other common bugs it could be?

For now, I'm thinking to just add a question in the bashrc asking if I will be using conda during this session, and have that set the python path every time.

 

Another (cleaner) possibility is to use conda without anaconda. That way you maintain your system's python environment completely and use conda as an environment manager with all the features you are used to.

pip install conda is all you need..

 

LOL so I could've skipped a whole hassle? Well good thing I learned about symlinks because of this haha. I always installed conda from the script, but I suppose I will start doing that.

 

Worked for me, thanks. I like your approach, no need to remember another script name or command.

 
code of conduct - report abuse