Skip to content

[Bug]: Invalid virtaulenv created bypy_venv #277

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
liningpan opened this issue Feb 28, 2024 · 4 comments
Closed

[Bug]: Invalid virtaulenv created bypy_venv #277

liningpan opened this issue Feb 28, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@liningpan
Copy link

What happened?

Based on my testing, in 0.5.0 python 3.11 works in general, but the virtual environment created by py_venv still had the same issues as reported in #159, #159 (comment).

In 0.6.0 (thanks Alex for creating a release for me to test), the python interpreter is able to start, but neither packages from pip nor in the bazel workspace can be loaded. The first_party.pth file looks like this

../../../..
../../../../site-packages
../../../../site-packages
../../../../site-packages
../../../../site-packages
../../../../site-packages
../../../../site-packages
../../../../site-packages
../../../../
../../../../

The same behavior is also reported here #226 (comment).

I don't know if this will be fixed by the rust venv work. I decided to create this issues since the recurring issue is now spread across multiple threads. It might also be helpful to have this feature tested in CI.

Version

Development (host) and target OS/architectures: Arch Linux x86

Output of bazel --version: 6.5.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

  • rules_python: 0.31.0
  • aspect_rules_py: 0.5.0 / 0.6.0

Language(s) and/or frameworks involved:

  • Python 3.11

How to reproduce

No response

Any other information?

No response

@liningpan liningpan added the bug Something isn't working label Feb 28, 2024
@mattem
Copy link
Collaborator

mattem commented Feb 28, 2024

0.6.0 is the commit before the refactor. I can't repo at HEAD

$ bazel run //:venv
INFO: Analyzed target //:venv (3 packages loaded, 2207 targets configured).
...
INFO: Running command line: bazel-bin/venv

$ /Users/matt/workspace/rules_py/.venv/bin/python
Python 3.11.7 (main, Jan  7 2024, 23:23:46) [Clang 16.0.3 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.getsitepackages()
['/Users/matt/workspace/rules_py/.venv/lib/python3.11/site-packages']

$ .venv/bin/python
Python 3.11.7 (main, Jan  7 2024, 23:23:46) [Clang 16.0.3 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.getsitepackages()
['/Users/matt/workspace/rules_py/.venv/lib/python3.11/site-packages']

Generated .pth file contains full paths when generating outside the sandbox for action,

$ cat .venv/lib/python3.11/site-packages/venv.venv.pth
/private/var/tmp/_bazel_matt/442be3b1483cc77971c0d7bfbd105b2d/execroot/aspect_rules_py/bazel-out/darwin_arm64-fastbuild/bin/venv.runfiles/.
/private/var/tmp/_bazel_matt/442be3b1483cc77971c0d7bfbd105b2d/execroot/aspect_rules_py/bazel-out/darwin_arm64-fastbuild/bin/venv.runfiles/aspect_rules_py

@liningpan
Copy link
Author

Oh that looks much better. Do you guys have an ETA for the refactor?

@mattem
Copy link
Collaborator

mattem commented Feb 28, 2024

It's landed at HEAD, so you could dep on that instead.
We are currently working through releasing the binaries needed for the toolchains, they are currently just committed to the repo here, so if you don't mind that can give it a try now, no rust toolchain should be needed.

@liningpan
Copy link
Author

I just tested v0.7.1 and it appears to be working. It would be nice to document glibc requirement somewhere, as it won't run on centos7 (which is reasonable at this point).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants