Hello everyone, the project I'm working on is usin...
# general
i
Hello everyone, the project I'm working on is using pants 1.5.0. As I know, when I run the command ./pants -version for the first time, the Python environment for pants will be set up in ~/.cache/pants/. It works for a long time. But now I encounter a problem when trying to build by pants in a new Mac. The error is Exception message: Could not satisfy all requirements for cffi==1.11.1: cffi==1.11.1(from: pantsbuild.pants.contrib.go==1.5.0->pantsbuild.pants==1.5.0), cffi>=1.12(from: pantsbuild.pants.contrib.go==1.5.0->pyopenssl==17.3.0->cryptography>=1.9) I found this is caused by the upgrading of cryptography from 2.4.2 to 3.3.1 My quesiton is that, can I make the pants fetch cryptography in a fixed version (say, 2.4.2) when I setup the pants in a new Mac? Many thanks in advance!
h
Hello! To check, do you have cryptography in the plugins option in pants.ini? What is the full entry for that option?
h
This might be related to running Pants on a different Python version? Are you using the system python, or did you install a specific version (say using pyenv or brew)?
i
Hi @hundreds-father-404, thank you for your response! pyOpenSSL-17.3.0 is used and cryptography is required by pyOpenSSL, but "requires": ["cryptography (>=1.9)". so the version of cryptography may vary when there's a new upgrade available
Hi @happy-kitchen-89482, thank you. Yes, there's python (2.7) in my Mac but I think pants is using the python environment bootstrap by itself (located in ~/.cache/pants/)
h
Okay, did y'all write a Pants plugin and it uses cryptography? Otherwise, normally the plugins section would only include the pants contrib libraries. I'm trying to understand what that's being used for.
i
No, I did not write any plugin. we just use pants to build jar package. I find the pyOpenSSL in /Users/kun.he/.cache/pants/setup/bootstrap-Darwin-x86_64/pants.iHBHhp/install/lib/python2.7/site-packages/pyOpenSSL-17.3.0.dist-info but we did not use OpenSSL/cryptography explicitly.
h
Ah okay, I see.
pyopenssl==17.3.0
was a requirement for Pants in 1.5, which is why that’s being pulled in - not because you set the
plugins
option. Two things to try: 1. In the
./pants
script, there’s a line that says something like these https://github.com/pantsbuild/setup/blob/69351495867bd555a76b4a523f816b66acb8506f/pants#L264-L265. They’ll be slightly different because you’re using an older version of the script. Add
cryptography==2.4.2
before the
${pants_requirement}
, meaning you’d tell pip to install that before installing Pants. 2. If that fails, you can set up a constraints file. Create a file at the top level called
_pants_constraints.txt
, with one entry
cryptography==2.4.2
. Then, change those two lines from earlier to say
-c _pants_constraints.txt
.
i
thank you @hundreds-father-404! I try to add the ryptography==2.4.2 to pants requirements and it works. Now ryptography 2.4.2 is fetched to the setup directory.
h
Great! By the way, we've made a ton of substantial improvements to pants the past 3 years since pants 1.5, including a feature called dependency inference that cuts down BUILD file boilerplate by about 90%. https://blog.pantsbuild.org/dependency-inference/ Would y'all be interested in incrementally upgrading to more recent versions of Pants? We're happy to help support where possible
i
Yes, I'm planning upgrade it to the latest version to avoid such lagacy problems. Thank you gain!
h
Awesome! Check out https://www.pantsbuild.org/docs/upgrade-tips for some tips on upgrades
i
One more question @hundreds-father-404 one of my colleagues found the pants plugin for IntellijIDEA 2020.3 is no longer available. Is there any suggestion to make the latest IntellijIDEA to support pants? Thanks!
h
Check out the #intellij channel. I don't think Twitter is actively maintaining the plugin anymore iiuc :/ We're trying to figure out what IDE support will look like in newer pants versions
i
Thank you @hundreds-father-404 for so much help to me!
❤️ 1