Skip to content

Instantly share code, notes, and snippets.

@minrk
Last active June 13, 2024 23:52
Show Gist options
  • Save minrk/6d73fc9159448f1f83f8a6d5c2b2dfac to your computer and use it in GitHub Desktop.
Save minrk/6d73fc9159448f1f83f8a6d5c2b2dfac to your computer and use it in GitHub Desktop.
FROM ubuntu:22.04
RUN apt-get update && apt-get -y install python3 python3-pip python3-setuptools python3-venv
RUN python3 -m pip install --user --upgrade setuptools pip
# uncomment to test https://github.com/pypa/pip/pull/11466
# RUN python3 -m pip install https://github.com/minrk/pip/archive/build_env_isolation.tar.gz
COPY . /pkg
WORKDIR /pkg
# installs 'UNKNOWN'
RUN python3 -m pip install --user -v .
# installs 'debug'
RUN python3 -m pip install --user -v --no-build-isolation .
[build-system]
requires = [
"setuptools>=60",
]
build-backend = "setuptools.build_meta"
[project]
version = "0.1.0"
requires-python = ">=3.7"
license = {text = "MIT License"}
name = "debug"
description = "..."
[project.scripts]
# instapy = "..."
import site
import sys
import setuptools
from setuptools import setup
print("\n\n")
print(f"in setup.py: {setuptools.__version__=}, {setuptools.__file__=}")
path_lines = '\n '.join(sys.path)
print(f"sys.path=\n {path_lines}")
sp_lines = "\n ".join(site.getsitepackages())
print(f"site.getsitepackages()=\n {sp_lines}")
print("\n\n")
setup()
@minrk
Copy link
Author

minrk commented Sep 21, 2022

output of pip list after building:

Package    Version Location                                  Installer
---------- ------- ----------------------------------------- ---------
debug      0.1.0   /root/.local/lib/python3.10/site-packages pip
pip        22.2.2  /root/.local/lib/python3.10/site-packages pip
setuptools 65.3.0  /root/.local/lib/python3.10/site-packages pip
UNKNOWN    0.0.0   /root/.local/lib/python3.10/site-packages pip
wheel      0.37.1  /usr/lib/python3/dist-packages

@minrk
Copy link
Author

minrk commented Sep 21, 2022

output of python3 -m pip install --user -v . in the image:

Using pip 22.2.2 from /root/.local/lib/python3.10/site-packages/pip (python 3.10)
Processing /pkg
  Running command pip subprocess to install build dependencies
  Collecting setuptools>=60
    Using cached setuptools-65.3.0-py3-none-any.whl (1.2 MB)
  Installing collected packages: setuptools
  Successfully installed setuptools-65.3.0
  WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
  Installing build dependencies ... done
  Running command Getting requirements to build wheel



  in setup.py: setuptools.__version__='59.6.0', setuptools.__file__='/usr/lib/python3/dist-packages/setuptools/__init__.py'
  sys.path=
    /root/.local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process
    /tmp/pip-build-env-nnvodc1n/site
    /usr/lib/python310.zip
    /usr/lib/python3.10
    /usr/lib/python3.10/lib-dynload
    /usr/lib/python3/dist-packages
    /tmp/pip-build-env-nnvodc1n/overlay/local/lib/python3.10/dist-packages
    /tmp/pip-build-env-nnvodc1n/normal/local/lib/python3.10/dist-packages



  running egg_info
  writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
  Getting requirements to build wheel ... done
  Running command pip subprocess to install backend dependencies
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Installing collected packages: wheel
  Successfully installed wheel-0.37.1
  WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
  Installing backend dependencies ... done
  Running command Preparing metadata (pyproject.toml)



  in setup.py: setuptools.__version__='59.6.0', setuptools.__file__='/usr/lib/python3/dist-packages/setuptools/__init__.py'
  sys.path=
    /root/.local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process
    /tmp/pip-build-env-nnvodc1n/site
    /usr/lib/python310.zip
    /usr/lib/python3.10
    /usr/lib/python3.10/lib-dynload
    /usr/lib/python3/dist-packages
    /tmp/pip-build-env-nnvodc1n/overlay/local/lib/python3.10/dist-packages
    /tmp/pip-build-env-nnvodc1n/normal/local/lib/python3.10/dist-packages



  running dist_info
  creating /tmp/pip-modern-metadata-lumlss5l/UNKNOWN.egg-info
  writing manifest file '/tmp/pip-modern-metadata-lumlss5l/UNKNOWN.egg-info/SOURCES.txt'
  writing manifest file '/tmp/pip-modern-metadata-lumlss5l/UNKNOWN.egg-info/SOURCES.txt'
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: UNKNOWN
  Running command Building wheel for UNKNOWN (pyproject.toml)



  in setup.py: setuptools.__version__='59.6.0', setuptools.__file__='/usr/lib/python3/dist-packages/setuptools/__init__.py'
  sys.path=
    /root/.local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process
    /tmp/pip-build-env-nnvodc1n/site
    /usr/lib/python310.zip
    /usr/lib/python3.10
    /usr/lib/python3.10/lib-dynload
    /usr/lib/python3/dist-packages
    /tmp/pip-build-env-nnvodc1n/overlay/local/lib/python3.10/dist-packages
    /tmp/pip-build-env-nnvodc1n/normal/local/lib/python3.10/dist-packages



  running bdist_wheel
  running build
  running install
  running install_egg_info
  running egg_info
  writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
  Copying UNKNOWN.egg-info to build/bdist.linux-aarch64/wheel/UNKNOWN-0.0.0.egg-info
  running install_scripts
  Building wheel for UNKNOWN (pyproject.toml) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=961 sha256=4a9e634849916b8988eec907181960f7c1b64902f6fde1aff0942345cf05fad8
  Stored in directory: /tmp/pip-ephem-wheel-cache-y_l7xbx6/wheels/f4/97/62/d830ae24c7a7d1498335e7680364beac4e5b80f39c4d727897
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
  Attempting uninstall: UNKNOWN
    Found existing installation: UNKNOWN 0.0.0
    Uninstalling UNKNOWN-0.0.0:
      Removing file or directory /root/.local/lib/python3.10/site-packages/UNKNOWN-0.0.0.dist-info/
      Successfully uninstalled UNKNOWN-0.0.0
Successfully installed UNKNOWN-0.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment