Hi all, first time to use pyoxidizer, got an error...
# general
j
Hi all, first time to use pyoxidizer, got an error complaining about
ERROR: Package 'xx-api' requires a different Python: 3.9.7 not in '==3.10.9'
, more details in the thread
Copy code
modifying distutils/_msvccompiler.py for oxidation
modifying distutils/command/build_ext.py for oxidation
modifying distutils/unixccompiler.py for oxidation
pip installing to /tmp/pyoxidizer-pip-installs2bRxt/install
Processing ./xx_api-0.1.0-py3-none-any.whl
Processing ./xx_lib-0.1.0-py3-none-any.whl
Collecting fastapi[all]
  Using cached fastapi-0.95.0-py3-none-any.whl (57 kB)
Collecting tiktoken
  Using cached tiktoken-0.3.3-cp39-cp39-macosx_11_0_arm64.whl (706 kB)
Collecting certifi
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting aiohttp
  Using cached aiohttp-3.8.4-cp39-cp39-macosx_11_0_arm64.whl (338 kB)
Collecting openai
  Using cached openai-0.27.4-py3-none-any.whl (70 kB)
Collecting loguru
  Using cached loguru-0.7.0-py3-none-any.whl (59 kB)
Collecting elasticsearch
  Using cached elasticsearch-8.7.0-py3-none-any.whl (387 kB)
Collecting uvicorn
  Using cached uvicorn-0.21.1-py3-none-any.whl (57 kB)
ERROR: Package 'xx-api' requires a different Python: 3.9.7 not in '==3.10.9'
error[PYOXIDIZER_PYTHON_EXECUTABLE]: calling pip install
I have this config in pants.toml
Copy code
[python]
interpreter_constraints = ["CPython==3.10.9"]
not sure why it’s trying to package with python 3.9.7
b
What version of pants are you using?
j
2.15.0
w
Can you show your BUILD file target definition?
j
sure
Copy code
python_distribution(
    name="dist",
    dependencies=[":sources"],
    wheel=True,
    sdist=False,
    provides=python_artifact(name="xx-api", version="0.1.0"),
)

pyoxidizer_binary(
    name="bin",
    entry_point="api.main",  # Optional
    dependencies=[":dist", "backend/lib/models:dist"],
)

python_sources(
    name="sources",
    sources=["api/**/*.py"],
)

// in backend/lib/models
python_sources()
python_distribution(
    name="dist",
    dependencies=[":models"],
    wheel=True,
    sdist=False,
    provides=python_artifact(name="xx-lib", version="0.1.0"),
)
w
Hmm, weird - have you tried specifying PyOxidizer’s constraints?