You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interactive installation of cython via the pip package manager inside the alpine container in the "Creating Your Own Container Images" does not work anymore
#209
As of May 2023, pip version 23.3.1 (which gets installed by the previous command in the lesson $ apt add --update python3 py3-pip python3-dev, this does not work anymore!
When we run the above command, we get the following error:
error: externally-managed-environment
× This environment is externally managed
╰─>
The system-wide python installation should be maintained using the system
package manager (apk) only.
If the package in question is not packaged already (and hence installable via
"apk add py3-somepackage"), please consider installing it inside a virtual
environment, e.g.:
python3 -m venv /path/to/venv
. /path/to/venv/bin/activate
pip install mypackage
To exit the virtual environment, run:
deactivate
The virtual environment is not deleted, and can be re-entered by re-sourcing
the activate file.
To automatically manage virtual environments, consider using pipx (from the
pipx package).
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
Cython does not get installed. I am not quite sure if it is acceptable to teach/encourage students to pass the --break-system-packages flag to pip just to get around this issue (we'll have to update the lessons in multiple places as well as the two Dockerfiles located within the docker-intro.zip file). Even when passing this flag, after the installation of cython, we get a strong warning:
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager.
It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Perhaps a different example (maybe a non-python one) shall be helpful to avoid such confusions (esp to beginners)?
The text was updated successfully, but these errors were encountered:
Thanks for spotting this and raising the issue. We need to have a think about what the example should be - Python was chosen for a reason as it is something that users often want to install but if it no longer works in a sensible way then a rethink is needed.
Potential options:
Installing R (maybe too large to be a useful example)
Creating a venv as part of the install process as suggested in the output above
Picking a completely different tool (happy to hear any suggestions)
OK - recent PRs have removed the Cython install via pip to get rid of the rror in the short term. We should review if this is the correct approach long term
We need to have a think about what the example should be
How about invoking gcc --version as the default entrypoint command? We could have the task of compiling & running a simple hello_world.c file in lieu of the python example? Alpine being so minimal, probably doesn't have gcc in its default image, and we get to demonstrate the apk add gcc command for both the interactive and the dockerfile sections of the lesson. Will also require rewriting sum.py in C. Thoughts?
Possibly. Most course attendees do not use compilers on a day-to-day basis so this may not be a good choice as you will likely need to explain what a compiler is for attendees which is a rabbit hole we probably do not want to go down.
)In the lesson on Creating Your Own Container Images, in the interactive installation section, we currently have the command to install
cython
within the container asAs of May 2023, pip version 23.3.1 (which gets installed by the previous command in the lesson
$ apt add --update python3 py3-pip python3-dev
, this does not work anymore!When we run the above command, we get the following error:
Cython does not get installed. I am not quite sure if it is acceptable to teach/encourage students to pass the
--break-system-packages
flag topip
just to get around this issue (we'll have to update the lessons in multiple places as well as the two Dockerfiles located within thedocker-intro.zip
file). Even when passing this flag, after the installation ofcython
, we get a strong warning:Perhaps a different example (maybe a non-python one) shall be helpful to avoid such confusions (esp to beginners)?
The text was updated successfully, but these errors were encountered: