David-OConnor / pyflow

An installation and dependency system for Python
MIT License
1.33k stars 44 forks source link

Running ipython fails with `No module named 'pexpect'` #168

Open Luthaf opened 2 years ago

Luthaf commented 2 years ago

Hi, this project looks very interesting, thanks for working on it!

I tried to install jupyter & run the ipython CLI, but got this error:

Install command and output ``` $ pyflow install --dev jupyter Found lockfile ⬇ Installing pyrsistent 0.18.1 ... ⬇ Installing pathspec 0.9.0 ... ⬇ Installing asttokens 2.0.5 ... ⬇ Installing black 22.1.0 ... Added a console script: black Added a console script: black-primer Added a console script: blackd ⬇ Installing python_dateutil 2.8.2 ... ⬇ Installing defusedxml 0.7.1 ... ⬇ Installing jupyterlab_widgets 2.0.0b1 ... ⬇ Installing jupyter 1.0.0 ... ⬇ Installing jedi 0.18.0 ... ⬇ Installing markupsafe 2.0.1 ... ⬇ Installing qtpy 2.0.1 ... ⬇ Installing mistune 0.8.4 ... ⬇ Installing jupyter_client 7.1.2 ... Added a console script: jupyter-kernel Added a console script: jupyter-kernelspec Added a console script: jupyter-run ⬇ Installing pure_eval 0.2.2 ... ⬇ Installing six 1.16.0 ... ⬇ Installing qtconsole 5.2.2 ... ⬇ Installing tornado 6.1 ... ⬇ Installing typing_extensions 4.0.1 ... ⬇ Installing parso 0.8.3 ... ⬇ Installing wcwidth 0.2.5 ... ⬇ Installing argon2_cffi 21.3.0 ... ⬇ Installing widgetsnbextension 4.0.0b1 ... ⬇ Installing pickleshare 0.7.5 ... ⬇ Installing jsonschema 4.4.0 ... Added a console script: jsonschema ⬇ Installing appnope 0.1.2 ... ⬇ Installing ipython_genutils 0.2.0 ... ⬇ Installing argon2_cffi_bindings 21.2.0 ... ⬇ Installing bleach 4.1.0 ... ⬇ Installing nest_asyncio 1.5.4 ... ⬇ Installing nbformat 5.1.3 ... Added a console script: jupyter-trust ⬇ Installing attrs 21.4.0 ... ⬇ Installing nbconvert 6.4.1 ... Added a console script: jupyter-dejavu Added a console script: jupyter-nbconvert ⬇ Installing pygments 2.11.2 ... Added a console script: pygmentize ⬇ Installing jupyterlab_pygments 0.1.2 ... ⬇ Installing platformdirs 2.4.1 ... ⬇ Installing pyzmq 22.3.0 ... ⬇ Installing prometheus_client 0.13.1 ... ⬇ Installing backcall 0.2.0 ... ⬇ Installing pandocfilters 1.5.0 ... ⬇ Installing stack_data 0.1.4 ... ⬇ Installing jupyter_console 6.4.0 ... Added a console script: jupyter-console ⬇ Installing mypy_extensions 0.4.3 ... ⬇ Installing webencodings 0.5.1 ... ⬇ Installing traitlets 5.1.1 ... ⬇ Installing ipywidgets 8.0.0b1 ... ⬇ Installing executing 0.8.2 ... ⬇ Installing ipykernel 6.9.0 ... ⬇ Installing nbclient 0.5.10 ... Added a console script: jupyter-execute ⬇ Installing tomli 2.0.1 ... ⬇ Installing packaging 21.3 ... ⬇ Installing notebook 6.4.8 ... Added a console script: jupyter-bundlerextension Added a console script: jupyter-nbextension Added a console script: jupyter-notebook Added a console script: jupyter-serverextension ⬇ Installing pyparsing 3.0.7 ... ⬇ Installing matplotlib_inline 0.1.3 ... ⬇ Installing click 8.0.3 ... ⬇ Installing jinja2 3.0.3 ... ⬇ Installing decorator 5.1.1 ... ⬇ Installing terminado 0.13.1 ... ⬇ Installing send2trash 1.8.1b0 ... Added a console script: send2trash ⬇ Installing ipython 8.0.1 ... Added a console script: ipython Added a console script: ipython3 ⬇ Installing prompt_toolkit 3.0.27 ... ⬇ Installing jupyter_core 4.9.1 ... Added a console script: jupyter Added a console script: jupyter-migrate Added a console script: jupyter-troubleshoot ⬇ Installing debugpy 1.5.1 ... ⬇ Installing testpath 0.5.0 ... ⬇ Installing entrypoints 0.4 ... ⬇ Installing cffi 1.15.0 ... ⬇ Installing pycparser 2.21 ... ⬇ Installing setuptools 60.8.1 ... Installation complete ```
$ pyflow ipython
Traceback (most recent call last):
  File "~/code/project/__pypackages__/3.9/bin/ipython", line 4, in <module>
    from IPython import start_ipython
  File "~/code/project/__pypackages__/3.9/lib/IPython/__init__.py", line 51, in <module>
    from .core.application import Application
  File "~/code/project/__pypackages__/3.9/lib/IPython/core/application.py", line 27, in <module>
    from IPython.core import release, crashhandler
  File "~/code/project/__pypackages__/3.9/lib/IPython/core/crashhandler.py", line 28, in <module>
    from IPython.core import ultratb
  File "~/code/project/__pypackages__/3.9/lib/IPython/core/ultratb.py", line 110, in <module>
    from IPython.utils import path as util_path
  File "~/code/project/__pypackages__/3.9/lib/IPython/utils/path.py", line 17, in <module>
    from IPython.utils.process import system
  File "~/code/project/__pypackages__/3.9/lib/IPython/utils/process.py", line 19, in <module>
    from ._process_posix import system, getoutput, arg_split, check_pid
  File "~/code/project/__pypackages__/3.9/lib/IPython/utils/_process_posix.py", line 23, in <module>
    import pexpect
ModuleNotFoundError: No module named 'pexpect'

Running pyflow install --dev pexpect fixes it, but this is a bit surprising, since a similar set of install commands works fine with virtualenv:

$ python -m venv virtualenv
$ source virtualenv/bin/activate
(virtualenv) $ pip install --upgrade pip
(virtualenv) $ pip install jupyter
(virtualenv) $ ipython
Full output for these commands ``` $ python -m venv virtualenv $ source virtualenv/bin/activate (virtualenv) $ pip install --upgrade pip Requirement already satisfied: pip in ./virtualenv/lib/python3.9/site-packages (21.2.3) Collecting pip Using cached pip-22.0.3-py3-none-any.whl (2.1 MB) Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 21.2.3 Uninstalling pip-21.2.3: Successfully uninstalled pip-21.2.3 Successfully installed pip-22.0.3 (virtualenv) $ pip install jupyter Collecting jupyter Using cached jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB) Collecting nbconvert Using cached nbconvert-6.4.1-py3-none-any.whl (557 kB) Collecting ipykernel Using cached ipykernel-6.9.0-py3-none-any.whl (128 kB) Collecting qtconsole Using cached qtconsole-5.2.2-py3-none-any.whl (120 kB) Collecting notebook Using cached notebook-6.4.8-py3-none-any.whl (9.9 MB) Collecting ipywidgets Using cached ipywidgets-7.6.5-py2.py3-none-any.whl (121 kB) Collecting jupyter-console Using cached jupyter_console-6.4.0-py3-none-any.whl (22 kB) Collecting jupyter-client<8.0 Using cached jupyter_client-7.1.2-py3-none-any.whl (130 kB) Collecting traitlets<6.0,>=5.1.0 Using cached traitlets-5.1.1-py3-none-any.whl (102 kB) Collecting nest-asyncio Using cached nest_asyncio-1.5.4-py3-none-any.whl (5.1 kB) Collecting appnope Using cached appnope-0.1.2-py2.py3-none-any.whl (4.3 kB) Collecting matplotlib-inline<0.2.0,>=0.1.0 Using cached matplotlib_inline-0.1.3-py3-none-any.whl (8.2 kB) Collecting tornado<7.0,>=4.2 Using cached tornado-6.1-cp39-cp39-macosx_10_9_x86_64.whl (416 kB) Collecting debugpy<2.0,>=1.0.0 Using cached debugpy-1.5.1-py2.py3-none-any.whl (4.1 MB) Collecting ipython>=7.23.1 Using cached ipython-8.0.1-py3-none-any.whl (747 kB) Collecting widgetsnbextension~=3.5.0 Using cached widgetsnbextension-3.5.2-py2.py3-none-any.whl (1.6 MB) Collecting jupyterlab-widgets>=1.0.0 Using cached jupyterlab_widgets-1.0.2-py3-none-any.whl (243 kB) Collecting nbformat>=4.2.0 Using cached nbformat-5.1.3-py3-none-any.whl (178 kB) Collecting ipython-genutils~=0.2.0 Using cached ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB) Collecting pygments Using cached Pygments-2.11.2-py3-none-any.whl (1.1 MB) Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 Using cached prompt_toolkit-3.0.27-py3-none-any.whl (380 kB) Collecting jupyter-core Using cached jupyter_core-4.9.1-py3-none-any.whl (86 kB) Collecting bleach Using cached bleach-4.1.0-py2.py3-none-any.whl (157 kB) Collecting pandocfilters>=1.4.1 Using cached pandocfilters-1.5.0-py2.py3-none-any.whl (8.7 kB) Collecting defusedxml Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB) Collecting testpath Using cached testpath-0.5.0-py3-none-any.whl (84 kB) Collecting nbclient<0.6.0,>=0.5.0 Using cached nbclient-0.5.10-py3-none-any.whl (69 kB) Collecting mistune<2,>=0.8.1 Using cached mistune-0.8.4-py2.py3-none-any.whl (16 kB) Collecting jinja2>=2.4 Using cached Jinja2-3.0.3-py3-none-any.whl (133 kB) Collecting entrypoints>=0.2.2 Using cached entrypoints-0.4-py3-none-any.whl (5.3 kB) Collecting jupyterlab-pygments Using cached jupyterlab_pygments-0.1.2-py2.py3-none-any.whl (4.6 kB) Collecting Send2Trash>=1.8.0 Using cached Send2Trash-1.8.0-py3-none-any.whl (18 kB) Collecting terminado>=0.8.3 Using cached terminado-0.13.1-py3-none-any.whl (14 kB) Collecting prometheus-client Using cached prometheus_client-0.13.1-py3-none-any.whl (57 kB) Collecting pyzmq>=17 Using cached pyzmq-22.3.0-cp39-cp39-macosx_10_9_x86_64.whl (1.3 MB) Collecting argon2-cffi Using cached argon2_cffi-21.3.0-py3-none-any.whl (14 kB) Collecting qtpy Using cached QtPy-2.0.1-py3-none-any.whl (65 kB) Requirement already satisfied: setuptools>=18.5 in ./virtualenv/lib/python3.9/site-packages (from ipython>=7.23.1->ipykernel->jupyter) (57.4.0) Collecting backcall Using cached backcall-0.2.0-py2.py3-none-any.whl (11 kB) Collecting pexpect>4.3 Using cached pexpect-4.8.0-py2.py3-none-any.whl (59 kB) Collecting jedi>=0.16 Using cached jedi-0.18.1-py2.py3-none-any.whl (1.6 MB) Collecting pickleshare Using cached pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB) Collecting stack-data Using cached stack_data-0.1.4-py3-none-any.whl (20 kB) Collecting decorator Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB) Collecting black Using cached black-22.1.0-cp39-cp39-macosx_10_9_x86_64.whl (1.3 MB) Collecting MarkupSafe>=2.0 Using cached MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl (13 kB) Collecting python-dateutil>=2.1 Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting jsonschema!=2.5.0,>=2.4 Using cached jsonschema-4.4.0-py3-none-any.whl (72 kB) Collecting wcwidth Using cached wcwidth-0.2.5-py2.py3-none-any.whl (30 kB) Collecting ptyprocess Using cached ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB) Collecting argon2-cffi-bindings Using cached argon2_cffi_bindings-21.2.0-cp38-abi3-macosx_10_9_universal2.whl (53 kB) Collecting packaging Using cached packaging-21.3-py3-none-any.whl (40 kB) Collecting webencodings Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB) Collecting six>=1.9.0 Using cached six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting parso<0.9.0,>=0.8.0 Using cached parso-0.8.3-py2.py3-none-any.whl (100 kB) Collecting attrs>=17.4.0 Using cached attrs-21.4.0-py2.py3-none-any.whl (60 kB) Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 Using cached pyrsistent-0.18.1-cp39-cp39-macosx_10_9_universal2.whl (81 kB) Collecting cffi>=1.0.1 Using cached cffi-1.15.0-cp39-cp39-macosx_10_9_x86_64.whl (178 kB) Collecting typing-extensions>=3.10.0.0 Using cached typing_extensions-4.0.1-py3-none-any.whl (22 kB) Collecting tomli>=1.1.0 Using cached tomli-2.0.1-py3-none-any.whl (12 kB) Collecting mypy-extensions>=0.4.3 Using cached mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB) Collecting platformdirs>=2 Using cached platformdirs-2.4.1-py3-none-any.whl (14 kB) Collecting click>=8.0.0 Using cached click-8.0.3-py3-none-any.whl (97 kB) Collecting pathspec>=0.9.0 Using cached pathspec-0.9.0-py2.py3-none-any.whl (31 kB) Collecting pyparsing!=3.0.5,>=2.0.2 Using cached pyparsing-3.0.7-py3-none-any.whl (98 kB) Collecting executing Using cached executing-0.8.2-py2.py3-none-any.whl (16 kB) Collecting asttokens Using cached asttokens-2.0.5-py2.py3-none-any.whl (20 kB) Collecting pure-eval Using cached pure_eval-0.2.2-py3-none-any.whl (11 kB) Collecting pycparser Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB) Installing collected packages: webencodings, wcwidth, Send2Trash, pure-eval, ptyprocess, pickleshare, mypy-extensions, mistune, ipython-genutils, executing, backcall, appnope, typing-extensions, traitlets, tornado, tomli, testpath, six, pyzmq, pyrsistent, pyparsing, pygments, pycparser, prompt-toolkit, prometheus-client, platformdirs, pexpect, pathspec, parso, pandocfilters, nest-asyncio, MarkupSafe, jupyterlab-widgets, entrypoints, defusedxml, decorator, debugpy, click, attrs, terminado, python-dateutil, packaging, matplotlib-inline, jupyterlab-pygments, jupyter-core, jsonschema, jinja2, jedi, cffi, black, asttokens, stack-data, qtpy, nbformat, jupyter-client, bleach, argon2-cffi-bindings, nbclient, ipython, argon2-cffi, nbconvert, ipykernel, qtconsole, notebook, jupyter-console, widgetsnbextension, ipywidgets, jupyter Successfully installed MarkupSafe-2.0.1 Send2Trash-1.8.0 appnope-0.1.2 argon2-cffi-21.3.0 argon2-cffi-bindings-21.2.0 asttokens-2.0.5 attrs-21.4.0 backcall-0.2.0 black-22.1.0 bleach-4.1.0 cffi-1.15.0 click-8.0.3 debugpy-1.5.1 decorator-5.1.1 defusedxml-0.7.1 entrypoints-0.4 executing-0.8.2 ipykernel-6.9.0 ipython-8.0.1 ipython-genutils-0.2.0 ipywidgets-7.6.5 jedi-0.18.1 jinja2-3.0.3 jsonschema-4.4.0 jupyter-1.0.0 jupyter-client-7.1.2 jupyter-console-6.4.0 jupyter-core-4.9.1 jupyterlab-pygments-0.1.2 jupyterlab-widgets-1.0.2 matplotlib-inline-0.1.3 mistune-0.8.4 mypy-extensions-0.4.3 nbclient-0.5.10 nbconvert-6.4.1 nbformat-5.1.3 nest-asyncio-1.5.4 notebook-6.4.8 packaging-21.3 pandocfilters-1.5.0 parso-0.8.3 pathspec-0.9.0 pexpect-4.8.0 pickleshare-0.7.5 platformdirs-2.4.1 prometheus-client-0.13.1 prompt-toolkit-3.0.27 ptyprocess-0.7.0 pure-eval-0.2.2 pycparser-2.21 pygments-2.11.2 pyparsing-3.0.7 pyrsistent-0.18.1 python-dateutil-2.8.2 pyzmq-22.3.0 qtconsole-5.2.2 qtpy-2.0.1 six-1.16.0 stack-data-0.1.4 terminado-0.13.1 testpath-0.5.0 tomli-2.0.1 tornado-6.1 traitlets-5.1.1 typing-extensions-4.0.1 wcwidth-0.2.5 webencodings-0.5.1 widgetsnbextension-3.5.2 (virtualenv) $ ipython ```

And pexpect is installed automatically:

[...]
Collecting pexpect>4.3
  Using cached pexpect-4.8.0-py2.py3-none-any.whl (59 kB)
[...]

Installing collected packages: [...], pexpect, [...]
Successfully installed [...] pexpect-4.8.0 [...]

Environement:

NEXT-JP commented 2 years ago

I am getting this error as well. Maybe a problem with dependency graph generator? If I run pyflow install pexpect then try to initiate ipython it runs.

0atman commented 2 years ago

After pyflow install ipython followed by pyflow install pexpect I now get this error on Ubuntu 20.04:

pyflow ipython
Traceback (most recent call last):
  File "/home/oatman/projects/pftest/__pypackages__/3.9/bin/ipython", line 4, in <module>
    from IPython import start_ipython
  File "/home/oatman/projects/pftest/__pypackages__/3.9/lib/IPython/__init__.py", line 53, in <module>
    from .terminal.embed import embed
  File "/home/oatman/projects/pftest/__pypackages__/3.9/lib/IPython/terminal/embed.py", line 15, in <module>
    from IPython.core.interactiveshell import DummyMod, InteractiveShell
  File "/home/oatman/projects/pftest/__pypackages__/3.9/lib/IPython/core/interactiveshell.py", line 73, in <module>
    from IPython.core.history import HistoryManager
  File "/home/oatman/projects/pftest/__pypackages__/3.9/lib/IPython/core/history.py", line 11, in <module>
    import sqlite3
  File "/home/oatman/.local/share/pyflow/python-3.9.0/lib/python3.9/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/home/oatman/.local/share/pyflow/python-3.9.0/lib/python3.9/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

I've got the sqlite dev libraries install, I wonder if there is a way to install the right version of python?