I am currently scratching my head on differing behavior for python and ipython.
Background: I want to play with tensorflow, and following the instructions of some online resources, I installed anaconda3 which would take care about everything. I am not particularly familiar with anaconda and just followed the instructions.
Now, I created a virtual environment (xyzzy in the example below). Then, within this environment, I invoked an interactive python shell and tried to import numpy, pandas and tensorflow.
(xyzzy) countermode@peppermint:~$ python
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas'
>>> import numpy as np
>>> import tensorflow as tf
>>>
Well, ok, it seems that pandas is somehow not accessible, although it actually is installed.
Anyway, now the same with ipython:
(xyzzy) countermode@peppermint:~$ ipython
Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pandas as pd
In [2]: import numpy as np
In [3]: import tensorflow as tf
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-64156d691fe5> in <module>()
----> 1 import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
So now the pandas import works fine while tensorflow appears to be gone.
Ummm... what is going on here? Why do I see this behavior? And how can I resolve it?
Supplementary information
This all happens on Linux Mint, the system is updated, anaconda and all packages maintained by it are updated, all packages within the environment are updated. I did not meddle with anything.
Conclusion
After installing ipython in the virtual environment both shells "agreed" on their behavior.