How to install python in a typescript repl?

I imported a project from github and I cannot install python in the shell terminal because it is not allowed by the container. I have not seen any other method to do this so how can I do it?

hey there, you can try adding it to nix!

  1. press the three dots on the file manager and press open hidden files
  2. press replit.nix
  3. add pkg.python310Full or something

oh I see the replit employee is here, nvm what I said

2 Likes

You can add python to a Typescript Repl by changing your replit.nix file to this:

{ pkgs }: {
	deps = [
		pkgs.python39Packages.poetry
    pkgs.nodejs-18_x
    pkgs.python310Full
    pkgs.replitPackages.prybar-python310
    pkgs.replitPackages.stderred
    pkgs.nodePackages.typescript-language-server
    pkgs.yarn
    pkgs.replitPackages.jest
	];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONBIN = "${pkgs.python310Full}/bin/python3.10";
    LANG = "en_US.UTF-8";
    STDERREDBIN = "${pkgs.replitPackages.stderred}/bin/stderred";
    PRYBAR_PYTHON_BIN = "${pkgs.replitPackages.prybar-python310}/bin/prybar-python310";
  };
}
3 Likes

I got past this error with the following, thanks @ReplitIronclad!

	deps = [
    pkgs.yarn
    pkgs.esbuild
		pkgs.python39Packages.poetry
    pkgs.nodejs-18_x
    pkgs.nodePackages.typescript
    pkgs.nodePackages.typescript-language-server
    pkgs.python310Full
    pkgs.replitPackages.prybar-python310
    pkgs.replitPackages.stderred
    pkgs.yarn
    pkgs.replitPackages.jest
	];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONBIN = "${pkgs.python310Full}/bin/python3.10";
    LANG = "en_US.UTF-8";
    STDERREDBIN = "${pkgs.replitPackages.stderred}/bin/stderred";
    PRYBAR_PYTHON_BIN = "${pkgs.replitPackages.prybar-python310}/bin/prybar-python310";
  };
}```
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.