0

I just installed anacondain order to use numba and I'd like to use the anaconda environment in IPython (occasionally). The issue is that I either set the anaconda install to be default system python env and then IPython always uses the anaconda env, or I can't use anaconda's env with IPython.

I have read the docs and IPython's help but I can't find a way to do it (I'm probably not using the correct search terms, because I'm sure this is something that can't be done).

Specifically I'm looking for a way to start IPython like this:

ipython --use-env=/home/user/anaconda

or something like that. Maybe creating a separate IPython profile that already starts with that env option.

1 Answer 1

1

With Anaconda you can install iPython into an environment. You would activate this environment and launch iPython. iPython will then use the environment it is launched from. Say I wanted a Python2 environment with Pandas, iPython and Numpy.

This creates the environment:

conda create -n py27 python=2.7 numpy pandas ipython

This activates the environment(Linux/Mac OS X):

source activate py27

This launches iPython using that environment:

ipython

More information on Anaconda environments can be found here, http://conda.pydata.org/docs/using/envs.html. With any Anaconda installation you can create multiple environments with different packages, package versions, and even Python 2 or Python 3 as Anaconda will figure out the version dependencies for you.

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you, but I'd rather avoid this option and maintain my one anaconda environment for simplicity reasons (and work-related ones, since I'm sharing projects with other people). I'll accept this in last case, but I'll keep looking for a way to create a different IPyhon profile with that environment. Thanks again.
Trying to point your system installation of iPython to the Anaconda environment is overkill. The iPython included with Anaconda is no different. You can specifically call the Anaconda iPython that uses the Anaconda environment by calling the path to the executable. Linux/Mac OS X: ~/anaconda/bin/ipython Windows: C:\Users\username\Anaconda\Scripts\ipython.exe You can even make a link or alias.
Yes, that's exactly what I did actually. Created an alias for the default anaconda environment. I just wanted to avoid creating another environment. But I still think that there must be an IPython option telling it which python to use when it starts.
@TomCho there isn't an option, because IPython is installed into a Python installation environment, and it runs in the environment it's installed in. It does have an old fudge to try to detect if a virtualenv is active, but that doesn't work 100%. We recommend installing IPython in each virtual/conda env where you want to use it.
@ThomasK I see. I didn't know it was installed into a Python environment. It makes sense now. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.