Closed shankari closed 1 year ago
This failed another check because the version of react is too old
Identified Version
16.14.0
Latest Version
18.2.0
Let's try to upgrade to a more recent version of dash
This repo uses 1.3.5
The reason for this is that the older version of the image used an older version of python, and newer versions of pandas need newer versions of python https://stackoverflow.com/a/75603915/4040267
However, we recently upgraded to the most recent version of everything https://github.com/e-mission/e-mission-server/pull/900
So switching to the new image allows us to upgrade to the most recent version of pandas (and the other dependencies)
Ran into this error after the upgrade. It seems to be related to pandas 2.0.0 We actually don't need pandas again, since the emission environment includes both pandas and arrow. Let's try removing it and retrying
Traceback (most recent call last):
File "/usr/src/app/pages/home.py", line 184, in generate_plot_trips_trend
trend_df = compute_trips_trend(df, date_col = "trip_start_time_str")
File "/usr/src/app/pages/home.py", line 67, in compute_trips_trend
trips_df[date_col] = pd.to_datetime(trips_df[date_col], utc=True)
File "/root/miniconda-23.1.0/envs/emission/lib/python3.9/site-packages/pandas/core/tools/datetimes.py", line 1050, in to_datetime
values = convert_listlike(arg._values, format)
File "/root/miniconda-23.1.0/envs/emission/lib/python3.9/site-packages/pandas/core/tools/datetimes.py", line 453, in _convert_listlike_datetimes
return _array_strptime_with_fallback(arg, name, utc, format, exact, errors)
File "/root/miniconda-23.1.0/envs/emission/lib/python3.9/site-packages/pandas/core/tools/datetimes.py", line 484, in _array_strptime_with_fallback
result, timezones = array_strptime(arg, fmt, exact=exact, errors=errors, utc=utc)
File "pandas/_libs/tslibs/strptime.pyx", line 530, in pandas._libs.tslibs.strptime.array_strptime
File "pandas/_libs/tslibs/strptime.pyx", line 351, in pandas._libs.tslibs.strptime.array_strptime
ValueError: time data "2021-09-20T16:30:32.960140-06:00" doesn't match format "%Y-%m-%dT%H:%M:%S%z", at position 1. You might want to try:
- passing `format` if your strings have a consistent format;
- passing `format='ISO8601'` if your strings are all ISO8601 but not necessarily in exactly the same format;
- passing `format='mixed'`, and the format will be inferred for each element individually. You might want to use `dayfirst` alongside this.
That works!
However, although we have updated the dash version, the react version is still react 16.
<script src="[/_dash-component-suites/dash/deps/react@16.v2_9_3m1682209658.14.0.js](view-source:http://localhost:8050/_dash-component-suites/dash/deps/react@16.v2_9_3m1682209658.14.0.js)"></script>
<script src="[/_dash-component-suites/dash/deps/react-dom@16.v2_9_3m1682209658.14.0.js](view-source:http://localhost:8050/_dash-component-suites/dash/deps/react-dom@16.v2_9_3m1682209658.14.0.js)"></script>
<script src="[/_dash-component-suites/dash/deps/prop-types@15.v2_9_3m1682209658.8.1.js](view-source:http://localhost:8050/_dash-component-suites/dash/deps/prop-types@15.v2_9_3m1682209658.8.1.js)"></script>
Ok, so it looks like the available react versions are
_available_react_versions = {"16.14.0", "18.2.0"}
it looks like we can override it using the REACT_VERSION
environment variable.
_env_react_version = os.getenv("REACT_VERSION")
Bingo! Fixed!
<script src="[/_dash-component-suites/dash/deps/react@18.v2_9_3m1682210504.2.0.js](view-source:http://localhost:8050/_dash-component-suites/dash/deps/react@18.v2_9_3m1682210504.2.0.js)"></script>
<script src="[/_dash-component-suites/dash/deps/react-dom@18.v2_9_3m1682210504.2.0.js](view-source:http://localhost:8050/_dash-component-suites/dash/deps/react-dom@18.v2_9_3m1682210504.2.0.js)"></script>
The package versions in https://github.com/e-mission/op-admin-dashboard/blob/master/requirements.txt are not the most recent versions.
For example, the most recent version of pandas is
This repo uses 1.3.5
The older the packages are, the more likely they are to contain vulnerabilities, so we should really have the most recent version of the packages possible.
Is there a reason that we are using older packages?