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

pip_install doesn't treat python_version correctly for Python 3.10+ #468

Closed
stdbug opened this issue May 8, 2021 · 6 comments
Closed

pip_install doesn't treat python_version correctly for Python 3.10+ #468

stdbug opened this issue May 8, 2021 · 6 comments
Assignees

Comments

@stdbug
Copy link

stdbug commented May 8, 2021

Description

pip_install doesn't treat python_version correctly for Python 3.10+

🔬 Minimal Reproduction

Try installing "asgiref=3.3.4" pip dependency via pip_install with python having version >= 3.10
asgiref's METADATA mentions requirement for typing-extnensions:

Requires-Dist: typing-extensions ; python_version < "3.8"

🔥 Exception or Error

BUILD file not found in directory 'pypi__typing_extensions' of external repository @workspace_name.

🌍 Your Environment

Debian 10
bazel 4.0.0
Rules_python version: both 2.0 and current master

Anything else relevant?

It seems like an issue is in line 53 of wheel.py where it should be or [] instead of or [""], but I don't have a holistic understanding of rules_python, so no PR, just a bug

@thundergolfer
Copy link
Collaborator

pip_install ignores python_version requriement

Could be that there's a Python version mismatch between what's used at runtime when installing the dependencies and what's used when running the py_ target. But...

That doesn't match up in my head with the error you provide:

BUILD file not found in directory 'pypi__typing_extensions' of external repository @workspace_name.


If I install that package at your specified version with Python 3.9.2 and rules_python 0.2.0 I can successfully run a program using the dependency.

import asgiref.sync

def run():
    print("hello world")
    print(asgiref.sync.__file__)

if __name__ == "__main__":
    run()

Output:

hello world
/private/var/tmp/_bazel_jonathon/d674c99385955331871afd0b7a4cb642/execroot/rules_python_demo/bazel-out/darwin-fastbuild/bin/helloworld/helloworld.runfiles/pypi/pypi__asgiref/asgiref/sync.py

I think to better debug your issue it would be helpful to get a reproduction.

@stdbug
Copy link
Author

stdbug commented May 9, 2021

My fault for poor investigation. Fails with Python 3.10, but not with Python 3.9. Anyway, closing until I figure out stable way to reproduce it

@stdbug stdbug closed this as completed May 9, 2021
@stdbug
Copy link
Author

stdbug commented Jun 4, 2021

Yes, this is Python 3.10+ problem. The problem is actually with setuptools package. The version that is used by rules_python is 44 which doesn't include the commit that fixes default python_version variable definition for markers

@stdbug stdbug reopened this Jun 4, 2021
@stdbug stdbug changed the title pip_install ignores python_version requriement pip_install doesn't treat python_version correctly for Python 3.10+ Jun 4, 2021
@thundergolfer
Copy link
Collaborator

Thanks for that update. I guess this would be sorted by merging #422.

@thundergolfer thundergolfer self-assigned this Jun 8, 2021
@bweston92
Copy link

Hey @codeschlosser is this issue ok to close now is the problem fixed?

@stdbug
Copy link
Author

stdbug commented Jul 7, 2021

Works now, thanks!

@stdbug stdbug closed this as completed Jul 7, 2021
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

No branches or pull requests

3 participants