question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IPython in a conda environment calls the wrong python

See original GitHub issue

When I launch ipython from within a conda environment, ipython runs the python from the base conda environment instead of the python from the current environment.

This is a recent conda installation on macOS.

(phforge-test) Antonios-MacBook-Pro:~ anto$ which python
/Users/anto/miniconda3/envs/phforge-test/bin/python
(phforge-test) Antonios-MacBook-Pro:~ anto$ which ipython
/Users/anto/miniconda3/envs/phforge-test/bin/ipython
(phforge-test) Antonios-MacBook-Pro:~ anto$ python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
(phforge-test) Antonios-MacBook-Pro:~ anto$ ipython
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:52:12) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: quit()
(phforge-test) Antonios-MacBook-Pro:~ anto$ 

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

64reactions
takluyvercommented, Jan 19, 2018

Have you done hash -r since entering the conda environment? Bash can cache paths to executables, so sometimes it doesn’t use the one reported by which. Running hash -r resets the cache.

27reactions
realdougcommented, Sep 4, 2018

I ran into this and the simple fix was: conda install -c anaconda ipython

Calling ipython at the command line is going to first look in the bin folder for your conda environment but if ipython isn’t found it will fall back to /usr/local/bin or whatever is in your path.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ipython uses wrong python version with anaconda
I hadn't realized that I had to install ipython separately for the python 3.6 environment; I'd thought it was a default part of...
Read more >
What to do when things go wrong - The Jupyter Notebook
Jupyter fails to start · Have you installed it? ;-) · If you're using a menu shortcut or Anaconda launcher to...
Read more >
Adding Python 3 to Jupyter Notebook - Northwestern University
We're going to make a new environment called p3workshop. Do this by typing: conda create -n p3workshop python=3.7 ipykernel jupyter anaconda.
Read more >
Frequently Asked Questions — Spyder 5 documentation
Q: How do I run Spyder installed in a conda environment using Anaconda Navigator ... Q: How do I install Python packages to...
Read more >
5 Steps — How to add your Conda environment to ... - Medium
python -m ipykernel install --user --name=tensor_flow_env. Using the above command, I will now have this conda environment in my Jupyter notebook.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found