Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests assume sysconfig scheme to invoke pip #6025

Closed
markedmiston opened this issue Mar 2, 2023 · 7 comments
Closed

Tests assume sysconfig scheme to invoke pip #6025

markedmiston opened this issue Mar 2, 2023 · 7 comments
Assignees
Labels
kind/bug-report Something doesn't seem to work. triage/needs-reproduction [bugs only] the bug was not provenly reproduced yet

Comments

@markedmiston
Copy link
Contributor

Description of the issue
Test code which create new virtual environments assumes the location of pip is /bin/pip in relation to the base directory. This is an assumption by relying on one installation scheme. Python currently supports nine schemes, https://docs.python.org/3/library/sysconfig.html#installation-paths. For example, on a system with posix_prefix the scripts path would be /usr/local/bin.

How to reproduce the issue
Run the pytests on a system with a different sysconfig scheme than posix_local. This may be easier to reproduce with Python 3.10.

Related:
pypa/virtualenv#2415
https://lists.debian.org/debian-python/2022/03/msg00039.html

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/cirq-pytest/test_isolated/bin/pip'

/usr/lib/python3.10/subprocess.py:1847: FileNotFoundError
------------------------------------------------------------------ Captured stdout call -------------------------------------------------------------------
Pytest worker [gw4] is creating /tmp/cirq-pytest/test_isolated for 'test_isolated'.
Removing /tmp/cirq-pytest/test_isolated, due to error: [Errno 2] No such file or directory: '/tmp/cirq-pytest/test_isolated/bin/pip'


================================================================= short test summary info =================================================================
FAILED dev_tools/cloned_env_test.py::test_isolated_env_cloning[b] - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/cirq-pytest/test_isolated/bin/pip'
FAILED dev_tools/cloned_env_test.py::test_isolated_env_cloning[a] - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/cirq-pytest/test_isolated/bin/pip'
FAILED dev_tools/cloned_env_test.py::test_isolated_env_cloning[c] - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/cirq-pytest/test_isolated/bin/pip'
=================================== 3 failed, 15989 passed, 106 skipped, 93 xfailed, 655 warnings in 119.59s (0:01:59) ====================================

Cirq version
1.1.0

@markedmiston markedmiston added the kind/bug-report Something doesn't seem to work. label Mar 2, 2023
@pavoljuhas pavoljuhas added triage/discuss Needs decision / discussion, bring these up during Cirq Cynque triage/needs-reproduction [bugs only] the bug was not provenly reproduced yet labels Mar 8, 2023
@verult
Copy link
Collaborator

verult commented Apr 12, 2023

From Cirq sync:

  • Context: This issue was found in the Cirq getting started guides.
  • @markedmiston Could you add more steps for reproduction (for example, what was the operating system where you saw the error)?

@markedmiston
Copy link
Contributor Author

markedmiston commented Apr 26, 2023

I am using gLinux. I had a working Cirq using pyenv local 3.9.16 and was able to reproduce by running the virtual environment steps from the development doc. It used Python 3.10.9.

mkvirtualenv cirq-py3 --python=/usr/bin/python3
workon cirq-py3
python -m pip install --upgrade pip    
python -m pip install -r dev_tools/requirements/dev.env.txt

./check/pytest .

@dstrain115 dstrain115 removed the triage/discuss Needs decision / discussion, bring these up during Cirq Cynque label Apr 26, 2023
@dstrain115
Copy link
Collaborator

@pavoljuhas will investigate and report back.

@pavoljuhas
Copy link
Collaborator

@markedmiston - I have followed the steps in your comment and saw all the tests passing with the exception of

FAILED dev_tools/docker_test.py::test_docker_stable - AssertionError: assert 1 == 0
FAILED dev_tools/docker_test.py::test_docker_pre - AssertionError: assert 1 == 0

These failures were expected because I did not configure docker on my workstation.
After installing docker and fixing access permissions per https://stackoverflow.com/a/54504083 these tests passed as well.

Is there anything else that you saw going wrong?

@markedmiston
Copy link
Contributor Author

I did not test with Docker and did not see any other errors. I presume if you drop into a Python shell on your container and checked the sysconfig scheme it would be the same as your host's Python. With a venv I believe the default is posix_venv which is the same as posix_prefix.

@pavoljuhas
Copy link
Collaborator

@markedmiston - I have specifically run the tests that were failing in the initial comment and they are all passing in my (cirq-py3) environment. If you can reproduce those errors on your side please advice how.
Otherwise I am not sure what is the problem here.

@pavoljuhas
Copy link
Collaborator

Closing as non-reproducible. Please reopen if you run into the initially reported errors again.

@pavoljuhas pavoljuhas closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-report Something doesn't seem to work. triage/needs-reproduction [bugs only] the bug was not provenly reproduced yet
Projects
None yet
Development

No branches or pull requests

4 participants