ValveSoftware / steam-runtime

A runtime environment for Steam applications
Other
1.17k stars 86 forks source link

Unable to crate a python virtual environment to build my game #648

Closed rubenlg closed 4 months ago

rubenlg commented 4 months ago

Your system information

Please describe your issue in as much detail as possible:

I tried to create a python virtual environment, which I need to build some of my dependencies, but it wasn't possible.

Steps for reproducing this issue:

  1. sudo docker run -it registry.gitlab.steamos.cloud/steamrt/scout/sdk:latest /bin/bash
  2. cd tmp; python3.5 -m venv test_environment

    The virtual environment was not created successfully because ensurepip is not
    available.  On Debian/Ubuntu systems, you need to install the python3-venv
    package using the following command.
    
    apt-get install python3-venv
  3. apt-get install python3-venv E: Unable to locate package python3-venv
  4. apt-get install python3.5-venv
    The following packages have unmet dependencies:
    python3.5-venv : Depends: python-pip-whl (>= 8.1.0-2) but it is not installable
TTimo commented 4 months ago

You should be able to use apt in your scout sdk container and install the needed packages, including pip, venv etc.

Note however that we do not provide Python 3 in the scout runtime. It is only in the sdk to support build systems. If you are building a Python app for distribution in Steam it probably needs to be fully packaged without relying on an OS provided Python (e.g. cx_freeze or pyinstaller).

rubenlg commented 4 months ago

My game doesn't use Python, only the build process of one dependency I'm compiling requires Python, and only while building, not at runtime. I already tried using apt to install dependencies, but as you can see above, installing venv is not possible due to a missing dependency (python-pip-whl).

In any case, it seems to be very challenging to compile some of my dependencies in scout, so I'll go with sniper and will ask support to enable sniper as a dependency for my game.

smcv commented 4 months ago

so I'll go with sniper

This is probably a good idea. sniper is based on Debian 11, which is considerably newer and more complete.

Please open an issue in this issue tracker when you are ready for your game to be configured to run on sniper, if there isn't a "self-service" mechanism to do that by then.

During development, you will probably find https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/slr-for-game-developers.md#launching-non-steam-games-in-a-steam-linux-runtime-container useful.

In any case, it seems to be very challenging to compile some of my dependencies in scout

Unfortunately, yes. There are quite a lot of backported packages already (including python3.5), but there are limits to what's feasible in a development environment from 12 years ago.

You might be able to work around inability to use venv by putting your build-dependencies in a directory and crafting an appropriate PYTHONPATH manually, like developers had to do before venv was invented... but honestly, if using sniper is an option for you, I'd suggest doing that instead.

rubenlg commented 4 months ago

Thanks! I'll cose this issue and open a new one to enable sniper for my game demo, since it's already prepared for it and tested locally. I was already building my game in a Docker instance with Debian 11, so the migration was very easy.