Possible error in v2.0.0rc1. When I run `./pants r...
# general
j
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
j
f
I’m not seeing which
Subsystem
defines that option though for the
repl
goal
j
ipython v5 is required for python2.7.
f
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
pants.option.errors.UnknownFlagsError: Unknown flags --no-ignore-cwd on scope ipython
with
--no-ipython-ignore-cwd
.
f
hmm I came up with that option name by inferring it from the
options_scope
checking help output instead
j
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
maybe it needs to be
--ipython-ignore-cwd=False
?
yeah the option is marked
type=str,
j
I tried with lower case
false
and that didn't work. And
Fales
didn't work either
f
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
That worked until it didn't.
f
?
j
Crashed ipython before I could do anything
"OSError: [Errno 9] Bad file descriptor"
Might be a different error.
f
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
yup
and if you know that ipython<6, then it should always be
False
because it wont work.
h
@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
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
Thank you Raúl! You found two new bugs, both fixed by https://github.com/pantsbuild/pants/pull/10991