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.

Cannot import pexpect

See original GitHub issue

Not sure where this is coming from. I’m creating a new conda env and doing conda install jupyter. Following this I can’t use anything because ipython won’t work. pexpect is definitely installed but ipython can’t find it:

(jupyter)see4-206:~/code/notedown (master *=)$ python
Python 2.7.10 |Continuum Analytics, Inc.| (default, Sep 15 2015, 14:50:01)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import IPython
/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/IPython/config.py:13: ShimWarning: The `IPython.config` package has been deprecated. You should import from traitlets.config instead.
  "You should import from traitlets.config instead.", ShimWarning)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/IPython/core/application.py", line 24, in <module>
    from IPython.core import release, crashhandler
  File "/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/IPython/core/crashhandler.py", line 28, in <module>
    from IPython.core import ultratb
  File "/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/IPython/core/ultratb.py", line 116, in <module>
    from IPython.utils import path as util_path
  File "/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/IPython/utils/path.py", line 21, in <module>
    from IPython.utils.process import system
  File "/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/IPython/utils/process.py", line 28, in <module>
    from ._process_posix import _find_cmd, system, getoutput, arg_split, check_pid
  File "/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/IPython/utils/_process_posix.py", line 24, in <module>
    from IPython.external import pexpect
ImportError: cannot import name pexpect
>>> import pexpect
>>> pexpect.__file__
'/nfs/see-fs-02_users/eeaol/src/anaconda/envs/jupyter/lib/python2.7/site-packages/pexpect/__init__.pyc'
>>>

This isn’t a problem if I pip install jupyter - in that case I have a jsonschema problem that can be upgraded out of.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cardosancommented, Oct 5, 2015

Had exactly the same issue in deleting an environment and recreating another one with same name. I solved the prob cleaning (conda clean -p -t -i -y) before creating the new enviro

1reaction
aarencommented, Sep 25, 2015

Problem fixed (for me at least).

I noticed that my ipython installs were coming from a cache rather than a new download. I ‘fixed’ the error by physically deleting all ipython packages from anaconda/pkgs and then reinstalling. There is probably a better way of fixing it (possibly with conda clean) but I can’t test now because the bad environment is gone.

I’ve no idea how it went bad in the first place, but this is a fairly old anaconda install.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named pexpect - Stack Overflow
Found the solution. pexpect was not part of the remote machine's Python installation. I simply executed sudo -E pip install pexpect.
Read more >
issue importing pexpect into python #543 - GitHub
Hi, I have already installed pexpect but I am not able to import it into python. Can anyone please assist me? Thanks Some...
Read more >
Request help on pexpect - Python Forum
Installed pexpect is successfully imported in python2 but not in python3, How can I get it working on python3? [root@IBBFDPLSPW010 ~]# python3
Read more >
Installation — Pexpect 4.8 documentation - Read the Docs
Pexpect is on PyPI, and can be installed with standard tools: pip install pexpect ... This version of Pexpect requires Python 3.3 or...
Read more >
[Fixed] ModuleNotFoundError: No module named 'pexpect'
The most likely reason is that Python doesn't provide pexpect in its standard library. You need to install it first! ... Before being...
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