Try using conda env update:
conda activate myenv
conda env update --file local.yml --prune
--prune
uninstalls dependencies which were removed from local.yml
, as pointed out in this answer by @Blink.
Or without the need to activate the environment (thanks @NumesSanguis):
conda env update --name myenv --file local.yml --prune
See Updating an environment in Conda User Guide.