Skip to content

--inside-venv error in installed package #120

Closed

Description

@penguin-wwy

My command:

./bin/python3 -m pyperformance run --affinity 1 -o dev.json

Output:

...
...

Execute: /data/pipeline/pipeline_guard/python-3.6dev-b501-release/venv/cpython3.6-ce4115b70348-compat-338b0f56cea8/bin/python -m pip freeze
packaging==21.3
pyparsing==3.0.6
pyperf==2.3.0
pyperformance==1.0.3
toml==0.10.2

Traceback (most recent call last):
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/venv/cpython3.6-ce4115b70348-compat-338b0f56cea8/lib/python3.6/site-packages/pyperformance/__main__.py", line 2, in <module>
    pyperformance.cli.main()
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/venv/cpython3.6-ce4115b70348-compat-338b0f56cea8/lib/python3.6/site-packages/pyperformance/cli.py", line 306, in main
    _main()
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/venv/cpython3.6-ce4115b70348-compat-338b0f56cea8/lib/python3.6/site-packages/pyperformance/cli.py", line 255, in _main
    assert not options.inside_venv
AssertionError

Add log and print the subprocess command which executed in exec_in_virtualenv. Then error:

[test@TENCENT64 /data/pipeline/pipeline_guard/python-3.6dev-b501-release]$ /data/pipeline/pipeline_guard/python-3.6dev-b501-release/venv/cpython3.6-ce4115b70348-compat-338b0f56cea8/bin/python -m pyperformance run --affinity 1 -o dev.json --inside-venv
Traceback (most recent call last):
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/venv/cpython3.6-ce4115b70348-compat-338b0f56cea8/lib/python3.6/site-packages/pyperformance/__main__.py", line 2, in <module>
    pyperformance.cli.main()
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/venv/cpython3.6-ce4115b70348-compat-338b0f56cea8/lib/python3.6/site-packages/pyperformance/cli.py", line 306, in main
    _main()
  File "/data/pipeline/pipeline_guard/python-3.6dev-b501-release/venv/cpython3.6-ce4115b70348-compat-338b0f56cea8/lib/python3.6/site-packages/pyperformance/cli.py", line 255, in _main
    assert not options.inside_venv
AssertionError

def _main():
parser, options = parse_args()
if not is_installed():
assert not options.inside_venv
print('switching to a venv.', flush=True)
exec_in_virtualenv(options)

def is_installed():
parent = os.path.dirname(PKG_ROOT)
return os.path.exists(os.path.join(parent, 'setup.py'))

is_installed means setup.py is existed ? If this is the case then I cannot use --inside-venv after pip install.

How do I use it properly, or is this a problem that needs to be fixed?

Thank you :)

Activity

  1. corydolphin commented on Jan 2, 2022

    @corydolphin

    I hit the same issue. Downgrading to 1.0.1 works, suggesting it is in the last two versions

  2. gpshead commented on Jan 2, 2022

    @gpshead
    Member

    #109 caused this regression in 1.0.3. pip install pyperformance==1.0.2 appears to work. @ericsnowcurrently

  3. gpshead commented on Jan 2, 2022

    @gpshead
    Member

    In my case I hit this when effectively trying to do:

    build% ../cpython/configure --prefix=/some/place && make install
    /some/place/bin/pip install pyperformance
    /some/place/bin/pyperformance run
    
  4. pablogsal commented on Jan 3, 2022

    @pablogsal
    Member

    I'm going to yank in PyPI the 1.0.3 release as it seems is broken :(

  5. ericsnowcurrently commented on Jan 3, 2022

    @ericsnowcurrently
    Member

    I'm looking into this.

  6. added a commit that references this issue on Jan 4, 2022
  7. ericsnowcurrently commented on Jan 4, 2022

    @ericsnowcurrently
    Member

    @gpshead, @penguin-wwy, @corydolphin, I've pushed what should be a fix. Would you mind checking the latest main branch to verify the problem is gone? Thanks!

  8. gpshead commented on Jan 5, 2022

    @gpshead
    Member

    It appears to work now.

    build a python with --prefix and installed it, used install/bin/python -m pip install . in a pyperformance checkout, and used install/bin/pyperformance to run a benchmark. success.

    thanks!

  9. ericsnowcurrently commented on Jan 5, 2022

    @ericsnowcurrently
    Member

    Thanks, @gpshead!

    @pablogsal, we should be good to do another release. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions