https://pantsbuild.org/ logo
j

jolly-midnight-72759

10/17/2020, 3:05 AM
Possible error in v2.0.0rc1. When I run
./pants repl --shell=ipython
or
./pants repl --shell=ipython project/src/python/project
I get the following error:
Copy code
ERROR: Could not find a version that satisfies the requirement ipython==7.16.1 (from versions: 0.10, 0.10.1, 0.10.2, 0.11, 0.12, 0.12.1, 0.13, 0.13.1, 0.13.2, 1.0.0, 1.1.0, 1.2.0, 1.2.1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 4.0.0b1, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.1.0rc1, 4.1.0rc2, 4.1.0, 4.1.1, 4.1.2, 4.2.0, 4.2.1, 5.0.0b1, 5.0.0b2, 5.0.0b3, 5.0.0b4, 5.0.0rc1, 5.0.0, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.3.0, 5.4.0, 5.4.1, 5.5.0, 5.6.0, 5.7.0, 5.8.0, 5.9.0, 5.10.0)
ERROR: No matching distribution found for ipython==7.16.1
When I constrain with
version = "ipython<6"
I get following
ipython
error:
Copy code
<the ipython help screen>
[TerminalIPythonApp] CRITICAL | Bad config encountered during initialization:
[TerminalIPythonApp] CRITICAL | Unrecognized flag: '--ignore-cwd'
pants repl --shell=python
works for both python2 and python3 targets.
f

fast-nail-55400

10/17/2020, 3:08 AM
j

jolly-midnight-72759

10/17/2020, 3:10 AM
f

fast-nail-55400

10/17/2020, 3:11 AM
I’m not seeing which
Subsystem
defines that option though for the
repl
goal
j

jolly-midnight-72759

10/17/2020, 3:11 AM
ipython v5 is required for python2.7.
f

fast-nail-55400

10/17/2020, 3:11 AM
ah found it: src/python/pants/backend/python/subsystems/ipython.py
so set
--no-ipython-ignore-cwd
the ipython code probably should check the version constraint before using that option though
maybe open an issue on pants?
👍🏽 1
j

jolly-midnight-72759

10/17/2020, 3:14 AM
pants.option.errors.UnknownFlagsError: Unknown flags --no-ignore-cwd on scope ipython
with
--no-ipython-ignore-cwd
.
f

fast-nail-55400

10/17/2020, 3:16 AM
hmm I came up with that option name by inferring it from the
options_scope
checking help output instead
j

jolly-midnight-72759

10/17/2020, 3:21 AM
Copy code
--ipython-ignore-cwd=<str>
  PANTS_IPYTHON_IGNORE_CWD
  ignore_cwd
      default: True
      current value: False (from pants.toml)
      Whether to tell IPython not to put the CWD on the import path. Normally you want this to be
      True, so that imports come from the hermetic environment Pants creates.  However IPython<7.13.0
      doesn't support this option, so if you're using an earlier version (e.g., because you have
      Python 2.7 code) then you will need to set this to False, and you may have issues with imports
      from your CWD shading the hermetic environment.
Looks like there is a bug. I'll open an issue. Thank you @fast-nail-55400!
f

fast-nail-55400

10/17/2020, 3:21 AM
maybe it needs to be
--ipython-ignore-cwd=False
?
yeah the option is marked
type=str,
j

jolly-midnight-72759

10/17/2020, 3:22 AM
I tried with lower case
false
and that didn't work. And
Fales
didn't work either
f

fast-nail-55400

10/17/2020, 3:22 AM
we really should change that to
type=bool
hmm try
--ipython-ignore-cwd=''
python considers empty strings to be “false” so maybe that will work
if so, definitely a misfeature/bug
j

jolly-midnight-72759

10/17/2020, 3:24 AM
That worked until it didn't.
f

fast-nail-55400

10/17/2020, 3:24 AM
?
j

jolly-midnight-72759

10/17/2020, 3:24 AM
Crashed ipython before I could do anything
"OSError: [Errno 9] Bad file descriptor"
Might be a different error.
f

fast-nail-55400

10/17/2020, 3:25 AM
lol:
Copy code
help="Whether to tell IPython not to put the CWD on the import path. "
            "Normally you want this to be True, so that imports come from the hermetic "
            "environment Pants creates.  However IPython<7.13.0 doesn't support this option, "
            "so if you're using an earlier version (e.g., because you have Python 2.7 code) "
            "then you will need to set this to False, and you may have issues with imports "
            "from your CWD shading the hermetic environment.",
the help says to set it to False but with
type=str
that is clearly wrong…
j

jolly-midnight-72759

10/17/2020, 3:26 AM
yup
and if you know that ipython<6, then it should always be
False
because it wont work.
h

hundreds-breakfast-49010

10/19/2020, 5:42 PM
@jolly-midnight-72759 we have an open issue for ipython not working with pantsd with the error you described earlier: https://github.com/pantsbuild/pants/issues/9939
right now the workaround is to avoid using pantsd with ipython
👍 1
j

jolly-midnight-72759

10/19/2020, 5:46 PM
Thank you. I made a note in the issue I opened. When I’m in front of a keyboard, I’ll rerun the steps in my issue with the workaround.
h

hundreds-father-404

10/19/2020, 8:59 PM
Thank you Raúl! You found two new bugs, both fixed by https://github.com/pantsbuild/pants/pull/10991
2 Views