Environment.yml installs wrong numpy version

In order to try and fix the missing compiler errors i asked about in this question Compilation no longer works after reboot , I turned my requirements.txt into an environment.yml. However, it now seems to install the wrong version of numpy even if i sepecify the right version in conda and pip dependency. I know you shouldnt install the same package in both conda and pip but I tried it to see if it fixes this new issue.

This is the environment.yml

name: streamlit_aquaplan
dependencies:
  - python=3.9
  - gcc_linux-64
  - gxx_linux-64
  - numpy=1.21.*
  - numba=0.55.*
  - streamlit=1.11.*
  - pip
  - pip:
    - folium>=0.12.1.post1
    - geopandas==0.10.2
    - wget==3.2
    - streamlit==1.11.1
    - pygeos
    - jupyter
    - leafmap==0.10.3
    - aquacrop==2.2
    - streamlit-folium==0.6.14
    - aquacropeto==0.1.1
    - stqdm==0.0.4
    - plotly==5.8.0
    - earthengine-api==0.1.312
    - matplotlib
    - seaborn
    - geemap==0.16.1
    - cffi==1.15.0
    - xarray
    - zarr
    - gcsfs
    - cftime
    - nc-time-axis
    - streamlit-aggrid
    - branca
    - numpy==1.21.5
    - numba==0.55.0

And this is the error when deploying on streamlit cloud

 File "/home/appuser/venv/lib/python3.9/site-packages/numba/__init__.py", line 140, in _ensure_critical_deps

    raise ImportError("Numba needs NumPy 1.21 or less")

Going back through the logs we see that we do install the right version first:

Collecting numpy==1.21.5

  Downloading numpy-1.21.5-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.7/15.7 MB 168.0 MB/s eta 0:00:00

Then after all these packages installed it says this:

[08:34:50] 🐍 Python dependencies were installed from /app/aquaplan/environment.yml using conda.

Check if streamlit is installed


──────────────────────────────── Installing Streamlit ──────────────────────────────────


Collecting streamlit

  Downloading streamlit-1.12.0-py2.py3-none-any.whl (9.1 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.1/9.1 MB 111.3 MB/s eta 0:00:00[2022-08-18 08:34:52.307577] 


So it now starts installing the wrong version. of streamlit as if it hadnt just installed the right one.

And during this process it now starts installing the wrong version of numpy:

Collecting numpy

  Downloading numpy-1.23.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.1/17.1 MB 212.3 MB/s eta 0:00:00[2022-08-18 08:34:56.995061] 

Once it finishes downloading all these new packages it uninstalls all the ones it downloaded earlier which were the correct versions:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

numba 0.55.0 requires numpy<1.22,>=1.18, but you have numpy 1.23.2 which is incompatible.

ipytree 0.2.1 requires ipywidgets<8,>=7.5.0, but you have ipywidgets 8.0.0 which is incompatible.

ipysheet 0.5.0 requires ipywidgets<8.0,>=7.5.0, but you have ipywidgets 8.0.0 which is incompatible.

ipyleaflet 0.17.0 requires ipywidgets<8,>=7.6.0, but you have ipywidgets 8.0.0 which is incompatible.

aquacrop 2.2 requires numpy<1.22.0,>=1.18.0, but you have numpy 1.23.2 which is incompatible.

Successfully installed MarkupSafe-2.1.1 altair-4.2.0 asttokens-2.0.8 attrs-22.1.0 backcall-0.2.0 blinker-1.5 cachetools-5.2.0 certifi-2022.6.15 charset-normalizer-2.1.0 click-8.1.3 commonmark-0.9.1 debugpy-1.6.3 decorator-5.1.1 entrypoints-0.4 executing-0.10.0 gitdb-4.0.9 gitpython-3.1.27 idna-3.3 importlib-metadata-4.12.0 ipykernel-6.15.1 ipython-8.4.0 ipywidgets-8.0.0 jedi-0.18.1 jinja2-3.1.2 jsonschema-4.10.3 jupyter-client-7.3.4 jupyter-core-4.11.1 jupyterlab-widgets-3.0.0 matplotlib-inline-0.1.6 nest-asyncio-1.5.5 numpy-1.23.2 packaging-21.3 pandas-1.4.3 parso-0.8.3 pexpect-4.8.0 pickleshare-0.7.5 pillow-9.2.0 prompt-toolkit-3.0.30 protobuf-3.20.1 psutil-5.9.1 ptyprocess-0.7.0 pure-eval-0.2.2 pyarrow-9.0.0 pydeck-0.7.1 pygments-2.13.0 pympler-1.0.1 pyparsing-3.0.9 pyrsistent-0.18.1 python-dateutil-2.8.2 pytz-2022.2.1 pytz-deprecation-shim-0.1.0.post0 pyzmq-23.2.1 requests-2.28.1 rich-12.5.1 semver-2.13.0 setuptools-65.0.2 six-1.16.0 smmap-5.0.0 stack-data-0.4.0 streamlit-1.12.0 toml-0.10.2 toolz-0.12.0 tornado-6.2 traitlets-5.3.0 typing-extensions-4.3.0 tzdata-2022.2 tzlocal-4.2 urllib3-1.26.11 validators-0.20.0 watchdog-2.1.9 wcwidth-0.2.5 widgetsnbextension-4.0.0 zipp-3.8.1


────────────────────────────────────────────────────────────────────────────────────────


[08:35:35] 📦 Processed dependencies!

2

Any help would be greatly appreciated.

Tom