IPython is somewhat aware of virtualenvs - it will add them to sys.path so that you can import packages which are installed inside the virtualenv. But it can't make them work 100% - it can't isolate them, because it's using packages from outside the virtualenv, and it can't adapt to the Python version the virtualenv is created with. The error you show looks like you're running code written for Python 2 on Python 3.
If you need IPython to work entirely within a virtualenv, the recommendation is still to install it in the virtualenv. With recent versions of pip, this should be quick and painless. Thomas On 23 April 2017 at 01:14, Xtian Simon <[email protected]> wrote: > My question is about the specific situation of using *iPython* and *python > virtual environments (virtualenvwrapper). > <https://wiki.archlinux.org/index.php/Python/Virtual_environment>* > > Recently needed to install and use virtual environments; however, when I > launch iPython, I get a lot of errors: > > [TerminalIPythonApp] WARNING | Unknown error in handling startup files: > ------------------------------------------------------------ > --------------- > AttributeError Traceback (most recent call last > ) > /usr/lib/python3.6/site-packages/IPython/core/interactiveshell.py in > safe_execfile(self, fname, *where, **kw) > 2480 fname, glob, loc, > -> 2481 self.compile if kw['shell_futures'] else None) > > [...] > > AttributeError: 'filter' object has no attribute 'remove' > > > > Searching the web for the issue, I found a few posts suggesting that > iPython was "unaware" of virtual environments, Calling IPython from a > virtualenv > <http://stackoverflow.com/questions/20327621/calling-ipython-from-a-virtualenv/30650831#30650831>(c. > 2012) but a commenter suggests that's no longer the case > <http://stackoverflow.com/questions/20327621/calling-ipython-from-a-virtualenv/30650831#comment30355114_20327621> > (2013). > > The workaround in 2012 was to add some code to the iPython config file > <http://rodesia.org/2012/09/04/making-ipython-virtualenv-aware/>. And the > OP in 'Calling iPython from a virtualenv' suggests another workaround is to > install iPython inside each virtual environment. *I really don't want to > do that.* > > I don't see a lot of posts about iPython and virtual environments, so I'm > thinking it's just me. So, > Is iPython still virtualenv unaware? > > -- > You received this message because you are subscribed to the Google Groups > "Project Jupyter" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/jupyter/d27e1252-6ac2-476e-a8a7-3a584c3a9a66%40googlegroups.com > <https://groups.google.com/d/msgid/jupyter/d27e1252-6ac2-476e-a8a7-3a584c3a9a66%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAOvn4qg7t9Gw5YVke9WQzO%2B_CEZJ6%2BLA_L7TW3zAVKXybLpJ-w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
