4

I have following deploy.yaml file

name: The fancy name
on:
  push:
    branches:
      - master

jobs:
  deploy:
    name: deploy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v1
        with:
          python-version: '3.x'
          architecture: 'x64'
      - name: Install dependencies
        run: |
          python3 -m pip install --upgrade pip
          pip install -r requirements.txt
      - name: Tests
        run: python3 -m pytest

here is what i have in requirements.txt file

apache-beam==2.18.0
protobuf==3.11.2
pytest==5.3.5
Faker==4.0.0

But github action is failing with following errors

/Python/3.8.1/x64/lib/python3.8/config-3.8-x86_64-linux-gnu
  -- Looking for python3.8
  -- Found Python lib /opt/hostedtoolcache/Python/3.8.1/x64/lib/libpython3.8.so
  -- Found PythonLibs: /opt/hostedtoolcache/Python/3.8.1/x64/lib/libpython3.8.so
  CMake Error at cmake_modules/FindNumPy.cmake:62 (message):
    NumPy import failure:

    Traceback (most recent call last):

What should be the path forward here?

      File "<string>", line 1, in <module>

    ModuleNotFoundError: No module named 'numpy'

  Call Stack (most recent call first):
    CMakeLists.txt:189 (find_package)
Em Ae
  • 8,167
  • 27
  • 95
  • 162
  • 1
    According to your `requirements.txt` file, you are not installing NumPy with your other dependencies. Add `numpy==1.18.2` to `requirements.txt` to install NumPy (latest version at time of writing). There could also be a problem with the virtual environment (or lack thereof) if you are using one locally but not in your GitHub Actions workflow. – Blair Nangle Apr 05 '20 at 09:09
  • My project wasn't dependent on `numpy` so the problem wasn't `numpy` by itsel. The problem was `python` version. I changed the version to `3.6` and it worked perfeclty. – Em Ae Apr 05 '20 at 17:16
  • I had specified my requirements only in `setup.py`, adding a `requirements.txt` with only `.` inside as described in https://stackoverflow.com/a/49684835/1870254 solved the problem for me. – jan-glx Sep 09 '22 at 12:25

1 Answers1

0

Not sure if anyone else ran into this issue and needs an answer. For me specifying specific python version worked. I don't remember exactly but i had to put either 3.6 or 3.7 for python.

Just to be clear, my project didn't require numpy, it was some other dependency which was compatible with python 3.8 and pulled numpy in the code.

Em Ae
  • 8,167
  • 27
  • 95
  • 162