Skip to content

--inside-venv error in installed package #120

Closed
@penguin-wwy

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 :)

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions