Apologies if this is the wrong place to post this,...
# general
b
Apologies if this is the wrong place to post this, but I am having trouble getting started on MacOS 12.5.1. I am using python3.9 but not working.
Copy code
Installing pantsbuild.pants==2.13.0 into a virtual environment at /Users/ian/.cache/pants/setup/bootstrap-Darwin-arm64/2.13.0_py39
++ scrub_env_vars
++ pex_env_vars=(${!PEX_@})
++ local -r pex_env_vars
++ [[ ! 0 -eq 0 ]]
++ '[' -n '' ']'
++ /Users/ian/.pyenv/shims/python3.9 /Users/ian/.cache/pants/setup/bootstrap-Darwin-arm64/virtualenv-20.4.7/virtualenv.pex --quiet --no-download /Users/ian/.cache/pants/setup/bootstrap-Darwin-arm64/pants.QDZmgq/install
++ /Users/ian/.cache/pants/setup/bootstrap-Darwin-arm64/pants.QDZmgq/install/bin/pip install --quiet -U pip 'setuptools<58'
++ /Users/ian/.cache/pants/setup/bootstrap-Darwin-arm64/pants.QDZmgq/install/bin/pip install --quiet --progress-bar off pantsbuild.pants==2.13.0
ERROR: Could not find a version that satisfies the requirement pantsbuild.pants==2.13.0 (from versions: 0.0.17, 0.0.18, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 0.0.32, 0.0.33, 0.0.34, 0.0.35, 0.0.36, 0.0.37, 0.0.38, 0.0.39, 0.0.40, 0.0.41, 0.0.42, 0.0.43, 0.0.44, 0.0.45, 0.0.46, 0.0.47, 0.0.48, 0.0.49, 0.0.50, 0.0.51, 0.0.52, 0.0.53, 0.0.54, 0.0.55, 0.0.56, 0.0.57, 0.0.58, 0.0.59, 0.0.60, 0.0.61, 0.0.62, 0.0.63, 0.0.64, 0.0.65, 0.0.66, 0.0.67, 0.0.68, 0.0.69, 0.0.70, 0.0.71, 0.0.72, 0.0.73, 0.0.74, 0.0.75, 0.0.76, 0.0.77, 0.0.79, 0.0.80, 0.0.81, 0.0.82, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0)
ERROR: No matching distribution found for pantsbuild.pants==2.13.0
h
Ooof, sorry about this.
That
pantsbuild.pants-2.13.0-cp39-cp39-macosx_11_0_arm64.whl is not a supported wheel on this platform
error is informative
I have no problem installing that wheel in a venv on my macbook m1 running macos 12.6
so this is weird
I’m also using a pyenv-installed python 3.9
What does
file /Users/ian/.cache/pants/setup/bootstrap-Darwin-arm64/pants.QDZmgq/install/bin/pip
show?
b
Sorry Benjy cleared my cache to x86. I abandoned that I now have sources working great. So I hesitate breaking stuff.
So, if I revisit installing from binary and get stuck will certainly re-post
h
Cool, sorry for the trouble, and you have my admiration for your perseverance on building from sources! Let us know if you have any other issues or questions.
2
b
and you have my amazement at the audacity of what you are all doing with this project.
❤️ 1
once I get my feet under me, i will certainly revisit and figure out where to contribute back
I am stuck on something seemingly simple
trying to install a package that I know needs Cython to install
but can't get the logs to cooperate
Copy code
python_requirement(
    name="cython",
    requirements=["Cython==0.29.32"],
)

python_requirement(
    name="cyac",
    requirements=["cyac"],
    dependencies=[":cython"],
)
it's giving me this at the bottom:
Copy code
WARNING: Discarding <https://files.pythonhosted.org/packages/0a/c2/5b5de7cc3e54306f4b547ab294e6533631eaee88613814b0089cb8027b53/cyac-1.5.tar.gz#sha256=fd6a2dd7371070c5b5df7c870c391df056098fd3f456b6712f2860d501288fb5> (from <https://pypi.org/simple/cyac/>). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
It's doing this:
Copy code
14:21:43.14 [INFO] Completed: Building requirements.pex with 2 requirements: Cython==0.29.32, cyac
and then...
Copy code
ERROR: No matching distribution found for cyac
if I do a simple library like requests, stuff works.
i don't know how to do "verbose" to actually see what the issue really is.
(I was guessing about the Cython thing because I did another venv outside of pants to see what I get with a clean venv
Copy code
pip install cyac
Collecting cyac
  Using cached cyac-1.5.tar.gz (39 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/pk/5nxbk5c50fg_nqc136tw1ncc0000gn/T/pip-install-1tyg1i4p/cyac_ad50b0582b534f4fb9caca02b284ffac/setup.py", line 4, in <module>
          from Cython.Build import cythonize
      ModuleNotFoundError: No module named 'Cython'
      [end of output]
tips appreciated. ty
So, it seems very specific to this library (cyac). Another similar project installs fine as does pandas.
@happy-kitchen-89482 triggering this log:
Copy code
ian@Ians-MBP nucleus % /Users/ian/.cache/pants/named_caches/pex_root/venvs/c9e55cc98846b062ba9676b3c1a5214512602544/3534239ad433d2b82aecb6a1cb1bf017df38de42/bin/python -sE /Users/ian/.cache/pants/named_caches/pex_root/venvs/c9e55cc98846b062ba9676b3c1a5214512602544/3534239ad433d2b82aecb6a1cb1bf017df38de42/pex install cyac==1.5
Collecting cyac==1.5
  Using cached cyac-1.5.tar.gz (39 kB)
    ERROR: Command errored out with exit status 1:
     command: /Users/ian/.cache/pants/named_caches/pex_root/venvs/c9e55cc98846b062ba9676b3c1a5214512602544/3534239ad433d2b82aecb6a1cb1bf017df38de42/bin/python -c 'import sys, setuptools
, tokenize; sys.argv[0] = '"'"'/private/var/folders/pk/5nxbk5c50fg_nqc136tw1ncc0000gn/T/pip-install-95y_2i9w/cyac_5a6d75760aa141a28fadf45838fcd354/setup.py'"'"'; __file__='"'"'/private/var/folders/pk/5nxbk5c50fg_nqc136tw1ncc0000gn/T/pip-install-95y_2i9w/cyac_5a6d75760aa141a28fadf45838fcd354/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/pk/5nxbk5c50fg_nqc136tw1ncc0000gn/T/pip-pip-egg-info-h_ldlds2
         cwd: /private/var/folders/pk/5nxbk5c50fg_nqc136tw1ncc0000gn/T/pip-install-95y_2i9w/cyac_5a6d75760aa141a28fadf45838fcd354/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/ian/.cache/pants/named_caches/pex_root/venvs/c9e55cc98846b062ba9676b3c1a5214512602544/3534239ad433d2b82aecb6a1cb1bf017df38de42/lib/python3.10/site-packages/setuptools/__init__.py", line 18, in <module>
        from pex.third_party.setuptools.extern.six import PY3, string_types
    ModuleNotFoundError: No module named 'pex'
sticking __PEX_UNVENDORED__=TRUE in front of this hacked pip thing makes it work.
so, now going to figure out what pex vendoring in pants is all about...
h
Huh, so this error is happening while pip is building the cyac sdist?
b
that's my understanding
I am running tests and every package installs fine except
cyac
that's the github repo's setup.py
h
This reproduces in the pantsbuild/pex repo, entirely outside of Pants:
Copy code
python -m pex cyac
Oh wait, different error
But that error is weird too, and leads me to believe that cyac is pretty broken
b
ok.
could be. it's a pretty obscure little python package I am experimenting with
h
Or at least pex+cyac is, presumably cyac works for you in a venv outside of pants/pex?
b
thanks for the tip about pex
correct
h
pip install cyac
fails for me on missing cython
b
yep.
Copy code
python_requirement(
    name="cython",
    requirements=["Cython==0.29.32"],
)

python_requirement(
    name="cyac",
    requirements=["cyac"],
    dependencies=[":cython"],
)
h
How are you using cython outside of Pants today?
b
trying the above in my BUILD file
h
I can’t get it to install even in pip
b
Copy code
ian@Ians-MBP /tmp % python -m venv venv

ian@Ians-MBP /tmp % source venv/bin/activate
(venv) ian@Ians-MBP /tmp % pip install Cython
Collecting Cython
  Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB)
Installing collected packages: Cython
Successfully installed Cython-0.29.32
WARNING: You are using pip version 21.2.4; however, version 22.2.2 is available.
You should consider upgrading via the '/private/tmp/venv/bin/python -m pip install --upgrade pip' command.

(venv) ian@Ians-MBP /tmp % pip install cyac
Collecting cyac
  Using cached cyac-1.5.tar.gz (39 kB)
Requirement already satisfied: cython in ./venv/lib/python3.9/site-packages (from cyac) (0.29.32)
Using legacy 'setup.py install' for cyac, since package 'wheel' is not installed.
Installing collected packages: cyac
    Running setup.py install for cyac ... done
Successfully installed cyac-1.5
WARNING: You are using pip version 21.2.4; however, version 22.2.2 is available.
You should consider upgrading via the '/private/tmp/venv/bin/python -m pip install --upgrade pip' command.
(venv) ian@Ians-MBP /tmp %
h
OK, so you first install cython in a separate pip call
then install cyac
that does work for me
but is not great
b
yes. it needs Cython to be around.
this library's setup does a better job:
I assume the SO article explains it:
# Delayed import; https://stackoverflow.com/questions/37471313/setup-requires-with-cython try: from Cython.Build import cythonize except ImportError: def cythonize(*args, **kwargs): from Cython.Build import cythonize return cythonize(*args, **kwargs)
Maybe I will vendor this cyac library for now. But then I need to figure out how to do Cython builds
I assume "dependencies" aren't pre-loaded... but rather "joint-loaded"
and this scenario isn't something you would have planned for.
h
Just checking in to see if you were able to make progress on this?
I’m not sure how to handle a library like
cyac
whose own setup.py is broken
If you vendor cyac then you can edit its setup.py to do the right thing
and in fact Pants can build it for you, because pants understands build-time deps for distributions via pep-517/518