Skip to content

Add venv PIP test to CI #4911

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

Closed
youknowone opened this issue Apr 21, 2023 · 5 comments · Fixed by #4924
Closed

Add venv PIP test to CI #4911

youknowone opened this issue Apr 21, 2023 · 5 comments · Fixed by #4924

Comments

@youknowone
Copy link
Member

#4904

I remember it worked once ensurepip is added first time. But broken. This is regression. Adding a job in CI will prevent it.

@itsankitkp
Copy link
Contributor

#4904

I remember it worked once ensurepip is added first time. But broken. This is regression. Adding a job in CI will prevent it.

What is correct steps to get pip working in venv? (notwithstanding current regression)
Is it same as steps mentioned in #4904 ?

@youknowone
Copy link
Member Author

Very similar in concept, but details different.

cargo build --release --features=ssl  # jit is not used
./target/release/rustpython -m ensurepip
./target/release/rustpython -m venv testvenv

And try1

. ./testvenv/bin/activate
python -m pip

resulted

/Users/user/Projects/RustPython/testvenv/bin/python: No module named pip

Try 2

./testvenv/bin/pip

resulted

Traceback (most recent call last):
  File "./testvenv/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

Not sure if try 2 worked, but at least try 1 worked.

@itsankitkp
Copy link
Contributor

itsankitkp commented Apr 22, 2023

In rustvenv

>>> import sys
>>> sys.path
['/tmp', '/home/ankit/RustPython/pylib/Lib', '/tmp/venv/lib/python3.11/site-packages']
  1. /tmp/venv/lib/python3.11 is empty
  2. /tmp/venv/lib/rustrustpython3.11 exists but it is not in syspath. Also, notice rust two times.
  3. /tmp/venv/lib/rustrustpython3.11 contains site-packages (as required).
  4. If we move site packages from rustrustpython3.11 to python3.11 things work.
  5. If if we add rustrustpython to syspath, things work as well (both above methods)
>>> import sys
>>> sys.path
['/home/ankit', '/home/ankit/RustPython/pylib/Lib', '/tmp/venv/lib/python3.11/site-packages']
>>> sys.path.append('/tmp/venv/lib/rustrustpython3.11/site-packages')
>>> import pip

@youknowone

@youknowone
Copy link
Member Author

Thank you! It seems we need to remove the redundant rust prefix

@itsankitkp
Copy link
Contributor

Yes, found the issue and added a fix in #4924

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants