Because it is not generally possible nor even desirable to reproduce the exact same code environment (think of bugfixes and security updates for example), when exporting/importing a code environment, DSS uses the "requested" state of the packages, not the "current" state.
The concept of code envs is that you give a list of packages with optional version constraints that you want installed. When you click update, Pip installs the missing packages so that your requirements are matched.
Here, your requirements are only "PyGithub". In other words, you don't require your code env to have lxml, bs4 or markdownify, so DSS won't ask pip to install them. Add them to the "Requested packages" list before exporting.
Thanks Clément, I totally missed the "Required packages" option.
But even after specifying my 4 packages on "Required" before exporting, after the import phase I still have to go into the imported code-env and click on "Update" to have them installed. I would really think that everything (including required) would be installed seamlessly when I import.
This is a pain and it is really counter-intuitive : if I give to someone my custom code-env, he would think that everything is already pre-packaged without the need to click on something _after_ the import...
And overall, I understand the "Required packages" design, but again, if I build a custom code-env, it is because the native Python env is missing some of my wanted packages, there is no need for "custom but not mandatory" stuff (at least for me, I don't need distinction (required or not) for a custom code-env)