Hi, I am facing a strange issue. I have the line:...
# general
c
Hi, I am facing a strange issue. I have the line:
hydra-core==1.2.0
on the
requirements.txt
on the root of the repo. It is defined as a target with, on the root BUILD file:
Copy code
python_requirements(
    name="reqs",
    source="requirements.txt",
)
On a package, I am using the hydra library,
import hydra
but I get
ModuleNotFoundError: No module named 'hydra'
when testing the code (
./pants test semantic_segmentation:
), before the hydra import, many other libraries specified on the requirements.txt are imported and the work normally. Cannot figure out what the issue might be.
You likely need to define a
module_mapping
h
yeah, Pants guesses that the name of the top-level module provided by a requirement is the same as the requirement (after normalization)
but that is not true here: hydra-core != hydra
So you'll need to add that mapping manually
b
c
Thank you, I changed the target to:
Copy code
python_requirements(
    name="reqs",
    source="requirements.txt",
    module_mapping={"hydra-core": ["hydra"]},
)
But I got the following error: If I remove the field
module_mapping={"hydra-core": ["hydra"]},
, it works, but yields the import error.
Copy code
20:53:08.67 [ERROR] 1 Exception encountered:

  ProcessExecutionFailure: Process 'Building requirements.pex with 14 requirements: Pillow==9.1.1, PyYAML==6.0, albumentations==1.2.1, boto3==1.23.8, clearml==1.3.2, click==8.1.3, hydra-core==1.2.0, matplotlib==3.5.0, numpy==1.21.4, opencv-python==4.5.5.64, pytorch_lightning==1.6.5, scipy==1.7.2, torch==1.11.0, tqdm==4.62.3' failed with exit code 1.
stdout:

stderr:
pid 22282 -> /home/ubuntu/.cache/pants/named_caches/pex_root/venvs/d65c7684c0aaba6c1b5815e3964acf5250cf53e0/3a90ad1b0750f7c251fd496e695a64af32555d46/pex --disable-pip-version-check --no-python-version-warning --exists-action a --isolated -q --cache-dir /home/ubuntu/.cache/pants/named_caches/pex_root --log /tmp/process-executionCNhUCW/.tmp/pex-pip-logf7jemqgu/pip.log download --dest /tmp/process-executionCNhUCW/.tmp/tmpcbqtbuvu/home.ubuntu.anaconda3.envs.pants.bin.python3.9 Pillow==9.1.1 PyYAML==6.0 albumentations==1.2.1 boto3==1.23.8 clearml==1.3.2 click==8.1.3 hydra-core==1.2.0 matplotlib==3.5.0 numpy==1.21.4 opencv-python==4.5.5.64 pytorch_lightning==1.6.5 scipy==1.7.2 torch==1.11.0 tqdm==4.62.3 --index-url <https://pypi.org/simple/> --retries 5 --timeout 15 exited with -9 and STDERR:
None
b
I wonder what exit code -9 signifies 🤔
h
Josh is being facetious I assume 🙂 -9 means the process was killed by the OS, usually this is because it OOMed
b
Sadly I'm not that leet. I had no idea 😩