Rust as a dependency for SSL and flask


I was working in Python specifically flask, and I was building this embedded server in flask, for a Raspberry PI. And I wanted at minimal to use SSL.

So why on earth am I posting this is on a rust forum? ... python != Rust... Dude is crazy huh?
(I hope not)
This Python's Cryptography library requires a recent version of Rust.

So I'm trying to stuff all this stuff inside a Docker container. And I'm reading this install script.

I was looking at the install script: --default-host Choose a default host triple
--default-toolchain Choose a default toolchain to install
--default-toolchain none Do not install any toolchains
--profile [minimal|default|complete] Choose a profile
-c, --component ... Component name to also install
-t, --target ... Target name to also install

So in my best Will Farrell impersonation:
WHAT on gods green earth is HOST TRIPPLE!

From Stack overflow: What is a "default host triple" in Rust? - Stack Overflow

Host triples identify the architecture and OS of the system that will ultimately run your executable. Mine is x86_64-pc-linux-gnu for example. The general form is cpu-vendor-os. Windows might be something like x86_64-pc-windows-msvc. ...

Host triple. Is this accurate?

Here is what seems to be working. I'm using a debian buster image.

From run on down.

RUN pip3 install /be/be-1.0.0-py3-none-any.whl \

&& apt -y install curl build-essential libssl-dev libffi-dev python3-dev cargo \

&& curl --proto '=https' --tlsv1.2 -sSf -o \

&& sh -y --profile default \

&& pip3 install pyOpenSSL

One more note:
I was stepping into the container, and testing the commands. Things fell apart when I issued the command: pip3 install pyOpenSSL I was seeing an error where a rust compiler could not be found. Solution - in the container was to launch a nested bash session.

Tool-chain seems to like enviroment variables. Feels a bit foreign. Not Linux like... Counter-intuitive.


What are you referring to? Environment variables aren't that common when compiling Rust unless you're doing some fairly specalized stuff.

I just ran the Rust install script - was annoyed at having to think about anything new, and off tangent.

I didn't understand why I was getting errors saying things like "can not find Rust compiler" immediately after installing Rust.

I think the problem was the shell I pulled to test the commands in my disposable Linux container.

Rust - is not the goal - or anywhere even close to it. I don't want to have to think about it all.

Some docker crap.

FROM alpine:3.13.1


RUN apk update && apk upgrade &&
echo "**** install Python " &&
apk add --no-cache python3 &&
if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi &&

echo "
install pip ***" &&
python3 -m ensurepip &&
rm -r /usr/lib/python
/ensurepip &&
pip3 install --no-cache --upgrade pip setuptools wheel &&
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi &&
apk add curl gcc musl-dev python3-dev libffi-dev openssl-dev cargo &&
curl --proto '=https' --tlsv1.2 -sSf -o &&
sh -y --profile default &&
pip3 install pyOpenSSL

  • rust install in alpine needs work yet. but functions in tests now.

    curl --proto '=https' --tlsv1.2 -sSf -o &&
    sh -y --profile default &&
    pip3 install pyOpenSSL

I'm referring to having to type the word bash in my console after installing the package.

I Couldn't figure out what was not working, and I started writing this request for help.

Rust is required by a dependency of pyOpenSSL.

If you use rustup to install rust toolchain, it will by default install symlinks to actual rust compiler in $HOME/.cargo/bin or $CARGO_HOME value. You have to add that directory into your PATH environment variable.