IPython import failure and python sys.path in general

前端 未结 9 1424
清酒与你
清酒与你 2021-01-17 10:35

I\'m following this post to make one ipython rule all the virtualenvs.

From what I understand, the main idea of the post is that when in a virtualenv, ipython can no

相关标签:
9条回答
  • 2021-01-17 10:58

    IPython seems to work now!

    Because ipython can not find simplegeneric. I tried to locate simplegeneric and found simplegeneric is in '/usr/lib/pymodules/python2.7'. After '/usr/lib/pymodules/python2.7' being added, ipython works fine.

    Jeff Tratner's comment really helps!

    0 讨论(0)
  • 2021-01-17 11:02

    Similar traceback I experienced with python 3.5.4 and pip 10.0.1 after installing ipython successfully.

    line 32, in <module>
    from .debugger import TerminalPdb, Pdb
    File "/usr/lib/python3.5/site-packages/IPython/terminal/debugger.py", line 6, in <module>
        from IPython.core.completer import IPCompleter
    File "/usr/lib/python3.5/site-packages/IPython/core/completer.py", line 137, in <module>
        from IPython.utils import generics
    File "/usr/lib/python3.5/site-packages/IPython/utils/generics.py", line 8, in <module>
    from simplegeneric import generic
    ImportError: No module named 'simplegeneric'
    

    updating or installing the simplegeneric i.e sudo pip install simplegeneric --upgrade I get

    Requirement already up-to-date: simplegeneric in /usr/lib/python3.5/site-packages (0.8.1)

    After some initial trial I searched on google/stackoverflow to see if anyone else faced similar problem and found this. And its @zjk answer that helps me to find solution.

    Solutions: Found only egg folder in the python3.5 installed package dir. So I removed them and fresh install the simplegeneric.

    sudo rm -rf /usr/lib/python3.5/site-packages/simplegeneric-0.8.1-py3.5.egg-info/
    sudo pip install simplegeneric
    

    after that ipython worked just like charm.

    N.B: I install the package at the system level that's why sudo required.

    0 讨论(0)
  • 2021-01-17 11:05

    Making changes to the path did not help in any way. However running ipython as a super user worked (although I'm not proud of it!)

    sudo ipython
    
    0 讨论(0)
  • 2021-01-17 11:14

    I had the same problem, in my case the cause of it was that the directory: /usr/lib/python2.7/dist-packages was not added to the path when the virtual environment was created (I would like to know why)

    In my case the following in the terminal solved the problem:

    workon 'your_environment_here'
    add2virtualenv /usr/lib/python2.7/dist-packages
    

    Note: This assumes you are using virtualenvwrapper

    0 讨论(0)
  • 2021-01-17 11:16

    I experienced some weirdness in a new ubuntu host, and realized I was getting different behaviors for mkvirtualenv on mac versus the ubuntu. I got past this difference with

    'mkvirtualenv --system-site-packages mynewenv'
    
    0 讨论(0)
  • 2021-01-17 11:19

    In my case, it was a package higher up in my customized Python path named "path" that was causing the ImportError from:

    import IPython.external.path as path
    

    See https://github.com/ipython/ipython/issues/3994

    0 讨论(0)
提交回复
热议问题