https://pantsbuild.org/ logo
p

plain-sundown-25537

01/17/2020, 4:11 PM
hello! as we are working in mixed py2 and py3 env, is it possible to tell repl to mixed with different ipython versions ?
ipython_requirements: ['ipython~=5.8.0; python_version<3']
?
h

hundreds-father-404

01/17/2020, 4:13 PM
Do you mean “If Py2, use 5.8.0, but if Py3, use the newest possible”?
👍 1
p

plain-sundown-25537

01/17/2020, 6:10 PM
Yes
This is common case for py2py3 coexist scenario
h

hundreds-father-404

01/17/2020, 7:39 PM
Try this:
Copy code
ipython_requirements: ['ipython==5.8.0; python_version<3', 'ipython==6.2.0; python_version>=3',]
Does that work?
c

calm-artist-46894

01/17/2020, 8:34 PM
@hundreds-father-404 with the suggested config: For py2:
Copy code
Traceback (most recent call last):
  File "/home/zxiong/cruise/mlp-ark/.pants.d/repl/py/CPython-2.7.15/8f140806ba7bbfd55992eb790c58eb4cd2b37b59/.bootstrap/pex/pex.py", line 397, in execute
    exit_code = self._wrap_coverage(self._wrap_profiling, self._execute)
  File "/home/zxiong/cruise/mlp-ark/.pants.d/repl/py/CPython-2.7.15/8f140806ba7bbfd55992eb790c58eb4cd2b37b59/.bootstrap/pex/pex.py", line 329, in _wrap_coverage
    return runner(*args)
  File "/home/zxiong/cruise/mlp-ark/.pants.d/repl/py/CPython-2.7.15/8f140806ba7bbfd55992eb790c58eb4cd2b37b59/.bootstrap/pex/pex.py", line 360, in _wrap_profiling
    return runner(*args)
  File "/home/zxiong/cruise/mlp-ark/.pants.d/repl/py/CPython-2.7.15/8f140806ba7bbfd55992eb790c58eb4cd2b37b59/.bootstrap/pex/pex.py", line 442, in _execute
    return self.execute_entry(self._pex_info.entry_point)
  File "/home/zxiong/cruise/mlp-ark/.pants.d/repl/py/CPython-2.7.15/8f140806ba7bbfd55992eb790c58eb4cd2b37b59/.bootstrap/pex/pex.py", line 540, in execute_entry
    return runner(entry_point)
  File "/home/zxiong/cruise/mlp-ark/.pants.d/repl/py/CPython-2.7.15/8f140806ba7bbfd55992eb790c58eb4cd2b37b59/.bootstrap/pex/pex.py", line 554, in execute_pkg_resources
    runner = entry.resolve()
  File "/home/zxiong/cruise/mlp-ark/.pants.d/repl/py/CPython-2.7.15/8f140806ba7bbfd55992eb790c58eb4cd2b37b59/.bootstrap/pex/vendor/_vendored/setuptools/pkg_resources/__init__.py", line 2385, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named IPython
For py3, it works but resolve ipython to
7.11.1
(not the one specified, so I guess it is the default value or latest) ps. I am not hijacking leozc’s thread, I work with him
😁 1
😕 1
h

happy-kitchen-89482

01/21/2020, 3:27 PM
ipython_requirements
is in the
repl.py
section?
h

hundreds-father-404

01/21/2020, 10:56 PM
Hey @calm-artist-46894 @plain-sundown-25537, try this. I got it working locally:
Copy code
[repl.py]
ipython_requirements: [
    "ipython==5.8.0 ; python_version<'3'",
    "ipython==7.11.1 ; python_version>='3'",
  ]
Also run
./pants clean-all
the first time. We forgot to set
fingerprint=True
so the cache is not invalidated 🤦‍♂️ I’ll put up a fix today for this. (Also, it’s not an issue with V2 🎉)
FYI: https://github.com/pantsbuild/pants/pull/8996 This also moves the options into a new
ipython
subsystem, which will allow us to port
./pants repl
to V2 🙂
👍 1
3 Views