How to install pip for make use of nixos.python38Full?

Hello people! It’s my first time typing here. So forgive me for any misconceptions.
I have installed the respective package, but I’m not found pip package compatible with this.
I’m learning to programme with this Learning Python by Building Games book.
They instruct me to install Python PyGame and PyOpenGL in a sequence (python3 > pip > pygame), where one depends on previous.

How I can do this on NixOS?

Thanks for any help you can give me.

pip is used as a package manager to install other packages. They say to install it because it’s needed only for the install of pygame. However, nixpkgs can just do this for you:

[15:00:27] jon@jon-workstation ~/projects/nixpkgs (master)
$ nix-shell -p python3Packages.pygame

[nix-shell:~/projects/nixpkgs]$ python
Python 3.7.6 (default, Dec 18 2019, 19:23:55)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
>>>

however, that will only get you a single package, and you’re likely going to need a lot more than just pygame, please take a look at https://github.com/NixOS/nixpkgs/blob/a52195355312d2a9f5e71d4ff742bcc30c6f90ec/doc/languages-frameworks/python.section.md#how-to-consume-python-modules-using-pip-in-a-virtualenv-like-i-am-used-to-on-other-operating-systems- for using nixpkgs with virtualenv

1 Like

Thanks @jonringer. This solves my doubt sure!
But how I see on this video python environments on nix they fail a little. For example, this solution give me a different result for the python version.

[nix-shell:~]$ python
Python 3.7.5 (default, Oct 14 2019, 23:08:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> 

I will try this certainly! Thanks for your help one more time @jonringer.

1 Like

it’s by design, I have my channels set to unstable, and I’m assuming you’re on stable. So there will be some divergence on package version. However, the principles are still the same in terms of nix :slight_smile: